From 3c7c73e5cac2e79bbefb46b496f8fb0d5da9efa3 Mon Sep 17 00:00:00 2001 From: Ghislain Seguin Date: Sun, 15 May 2011 21:13:04 -0700 Subject: [PATCH] Added unit test for issue #1617 --- tests/unit/listview/index.html | 31 ++++++++++++++++++++++++++++ tests/unit/listview/listview_core.js | 22 +++++++++++++++----- 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/tests/unit/listview/index.html b/tests/unit/listview/index.html index d8039b8e..2727ec7a 100644 --- a/tests/unit/listview/index.html +++ b/tests/unit/listview/index.html @@ -71,6 +71,37 @@ +
+
+

Basic multiple lists view

+
+
+
    +
  • Item 1
  • +
  • Item 2
  • +
  • Parent Item +
      +
    • Sub Item 10
    • +
    • Sub Item 11
    • +
    • Sub Item 12
    • +
    +
  • +
+
    +
  • Item 3
  • +
  • Item 4
  • +
  • Parent Item +
      +
    • Sub Item 20
    • +
    • Sub Item 21
    • +
    • Sub Item 22
    • +
    +
  • +
+
+ +
+
diff --git a/tests/unit/listview/listview_core.js b/tests/unit/listview/listview_core.js index 3bb8ab76..14c69eb3 100644 --- a/tests/unit/listview/listview_core.js +++ b/tests/unit/listview/listview_core.js @@ -48,8 +48,8 @@ $.testHelper.openPage("#nested-list-test"); setTimeout(function() { ok($('#nested-list-test').hasClass('ui-page-active'), "makes nested list test page active"); - ok($(':jqmData(url="nested-list-test&ui-page=More-animals-0")').length == 1, "Adds first UL to the page"); - ok($(':jqmData(url="nested-list-test&ui-page=Groups-of-animals-1")').length == 1, "Adds second nested UL to the page"); + ok($(':jqmData(url="nested-list-test&ui-page=More-animals-0-0")').length == 1, "Adds first UL to the page"); + ok($(':jqmData(url="nested-list-test&ui-page=Groups-of-animals-0-1")').length == 1, "Adds second nested UL to the page"); start(); }, 1000); }); @@ -58,7 +58,7 @@ $.testHelper.openPage("#nested-list-test"); $('.ui-page-active li:eq(1) a:eq(0)').click(); setTimeout(function() { - var $new_page = $(':jqmData(url="nested-list-test&ui-page=More-animals-0")'); + var $new_page = $(':jqmData(url="nested-list-test&ui-page=More-animals-0-0")'); ok($new_page.hasClass('ui-page-active'), 'Makes the nested page the active page.'); ok($('.ui-listview', $new_page).find(":contains('Rhumba of rattlesnakes')").length == 1, "The current page should have the proper text in the list."); @@ -68,7 +68,7 @@ }); asyncTest( "should go back to top level when the back button is clicked", function() { - $.testHelper.openPage("#nested-list-test&ui-page=More-animals-0"); + $.testHelper.openPage("#nested-list-test&ui-page=More-animals-0-0"); window.history.back(); setTimeout(function() { @@ -81,6 +81,18 @@ ok($('#nested-list-test .linebreaknode').text() === "More animals", 'Text should be "More animals"'); }); + asyncTest( "Multiple nested lists on a page", function() { + // https://github.com/jquery/jquery-mobile/issues/1617 + $.testHelper.openPage("#nested-lists-test"); + + setTimeout(function() { + $('.ui-page-active li:eq(2) a:eq(0)').click(); + + equal($('.ui-page-active .ui-content .ui-listview li').text(), "Sub Item 10Sub Item 11Sub Item 12", 'Text should be "Sub Item 10Sub Item 11Sub Item 12"'); + start(); + }, 500); + }); + module('Ordered Lists'); asyncTest( "changes to the numbered list page and enhances it", function() { @@ -294,4 +306,4 @@ }, 1000); }); -})(jQuery); \ No newline at end of file +})(jQuery);