From 1811b3171539e43bb5ae78f3761f0e5b491bdd22 Mon Sep 17 00:00:00 2001 From: John Bender Date: Fri, 26 Aug 2011 16:51:07 -0700 Subject: [PATCH] added sub page hash key tests --- tests/unit/listview/listview_core.js | 24 ++++++++ tests/unit/listview/listview_pushstate.js | 15 +++++ tests/unit/listview/pushstate-tests.html | 75 +++++++++++++++++++++++ 3 files changed, 114 insertions(+) create mode 100644 tests/unit/listview/listview_pushstate.js create mode 100644 tests/unit/listview/pushstate-tests.html diff --git a/tests/unit/listview/listview_core.js b/tests/unit/listview/listview_core.js index 3f27144e..dd44fef7 100644 --- a/tests/unit/listview/listview_core.js +++ b/tests/unit/listview/listview_core.js @@ -706,4 +706,28 @@ } ]); }); + + asyncTest( "nested pages hash key is always in the hash (replaceState)", function(){ + $.testHelper.pageSequence([ + function(){ + //reset for relative url refs + $.testHelper.openPage( "#" + home ); + }, + + function(){ + // https://github.com/jquery/jquery-mobile/issues/1617 + $.testHelper.openPage("#nested-lists-test"); + }, + + function(){ + // Click on the link of the third li element + $('.ui-page-active li:eq(2) a:eq(0)').click(); + }, + + function(){ + ok( location.hash.search($.mobile.subPageUrlKey) >= 0 ); + start(); + } + ]); + }); })(jQuery); diff --git a/tests/unit/listview/listview_pushstate.js b/tests/unit/listview/listview_pushstate.js new file mode 100644 index 00000000..6af09e7c --- /dev/null +++ b/tests/unit/listview/listview_pushstate.js @@ -0,0 +1,15 @@ +(function($) { + asyncTest( "nested pages hash key is always in the hash on default page with no id (replaceState) ", function(){ + $.testHelper.pageSequence([ + function(){ + // Click on the link of the third li element + $('.ui-page-active li:eq(2) a:eq(0)').click(); + }, + + function(){ + ok( location.hash.search($.mobile.subPageUrlKey) >= 0 ); + start(); + } + ]); + }); +})(jQuery); \ No newline at end of file diff --git a/tests/unit/listview/pushstate-tests.html b/tests/unit/listview/pushstate-tests.html new file mode 100644 index 00000000..2ce7597d --- /dev/null +++ b/tests/unit/listview/pushstate-tests.html @@ -0,0 +1,75 @@ + + + + + + jQuery Mobile Listview Integration Test + + + + + + + + + + + + + +

jQuery Mobile Listview Integration Test

+

+

+
    +
+ +
+
+

Basic multiple lists view

+
+
+
    +
  • Item 1
  • +
  • Item 2
  • +
  • Item 3 +
      +
    • Item A-3-0
    • +
    • Item A-3-1
    • +
    • Item A-3-2
    • +
    +
  • +
+
    +
  • Item 1
  • +
  • Item 2
  • +
  • Item 3 +
      +
    • Item B-3-0 +
        +
      • Item B-3-0-0
      • +
      • Item B-3-0-1 +
          +
        • Item B-3-0-1-0
        • +
        • Item B-3-0-1-1
        • +
        • Item B-3-0-1-2
        • +
        +
      • +
      • Item B-3-0-2
      • +
      +
    • +
    • Item B-3-1 +
        +
      • Item B-3-1-0
      • +
      • Item B-3-1-1
      • +
      • Item B-3-1-2
      • +
      +
    • +
    • Item B-3-2
    • +
    +
  • +
+
+
+ + +