From a6533e36766a1084e99a13314c3c802610c8a2f9 Mon Sep 17 00:00:00 2001 From: Ghislain Seguin Date: Fri, 17 Jun 2011 11:59:05 -0700 Subject: [PATCH] Fixed test for "Programmatic removal of list items" (cherry picked from commit 5d4bf2d5412c900fbcd093f1a3549a34dbab8e6c) --- tests/unit/listview/listview_core.js | 30 ++++++++++++++++++---------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/tests/unit/listview/listview_core.js b/tests/unit/listview/listview_core.js index 547cdd36..ffcad5d1 100644 --- a/tests/unit/listview/listview_core.js +++ b/tests/unit/listview/listview_core.js @@ -392,20 +392,28 @@ module("Programmatic list items manipulation"); - test( "Removing list items", 4, function() { - $.testHelper.openPage("#removing-items-from-list-test"); - var ul = $('#removing-items-from-list-test ul'); - ul.find("li").first().remove(); - equal(ul.find("li").length, 3, "There should be only 3 list items left"); + asyncTest( "Removing list items", 4, function() { + $.testHelper.pageSequence([ + function(){ + $.testHelper.openPage("#removing-items-from-list-test"); + }, - ul.listview('refresh'); - ok(ul.find("li").first().hasClass("ui-corner-top"), "First list item should have class ui-corner-top"); + function(){ + var ul = $('#removing-items-from-list-test ul'); + ul.find("li").first().remove(); + equal(ul.find("li").length, 3, "There should be only 3 list items left"); - ul.find("li").last().remove(); - equal(ul.find("li").length, 2, "There should be only 2 list items left"); + ul.listview('refresh'); + ok(ul.find("li").first().hasClass("ui-corner-top"), "First list item should have class ui-corner-top"); - ul.listview('refresh'); - ok(ul.find("li").last().hasClass("ui-corner-bottom"), "Last list item should have class ui-corner-bottom"); + ul.find("li").last().remove(); + equal(ul.find("li").length, 2, "There should be only 2 list items left"); + + ul.listview('refresh'); + ok(ul.find("li").last().hasClass("ui-corner-bottom"), "Last list item should have class ui-corner-bottom"); + start(); + } + ]); }); })(jQuery);