From 31d45a76e2fb9f8be83f055628088c583d4e9f9b Mon Sep 17 00:00:00 2001 From: Ray Ling Date: Tue, 5 Apr 2011 08:59:19 +0800 Subject: [PATCH 1/7] append 'click' event listener for no-touch support device test. --- tests/functional/addrbar.html | 4 ++-- tests/functional/gridlayout.html | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/functional/addrbar.html b/tests/functional/addrbar.html index 321dcb8a..731b8da4 100755 --- a/tests/functional/addrbar.html +++ b/tests/functional/addrbar.html @@ -11,13 +11,13 @@ diff --git a/tests/functional/gridlayout.html b/tests/functional/gridlayout.html index d72fe640..aff752a2 100644 --- a/tests/functional/gridlayout.html +++ b/tests/functional/gridlayout.html @@ -10,19 +10,19 @@ From d5cf4fc29a722c2600baff77e9ae7aca85325aaa Mon Sep 17 00:00:00 2001 From: BradBroulik Date: Thu, 28 Jul 2011 16:45:39 -0500 Subject: [PATCH 2/7] Unit tests for dialog theme inheritance --- tests/unit/dialog/dialog_events.js | 9 ++++++++- tests/unit/dialog/index.html | 13 +++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/tests/unit/dialog/dialog_events.js b/tests/unit/dialog/dialog_events.js index bdde626a..916aa414 100644 --- a/tests/unit/dialog/dialog_events.js +++ b/tests/unit/dialog/dialog_events.js @@ -5,13 +5,20 @@ module('jquery.mobile.dialog.js'); asyncTest( "dialog hash is added when the dialog is opened and removed when closed", function(){ - expect( 2 ); + expect( 6 ); //bring up the dialog $("a[href='#foo-dialog']").click(); setTimeout(function(){ ok(/&ui-state=dialog/.test(location.hash), "ui-state=dialog =~ location.hash"); + + // Assert dialog theme inheritance (issue 1375): + ok($('#foo-dialog').hasClass('ui-body-b'), 'Expected theme ui-body-b'); + ok($('#foo-dialog').find( ":jqmData(role=header)" ).hasClass('ui-bar-b'), 'Expected header theme inherited from parent ui-bar-b'); + ok($('#foo-dialog').find( ":jqmData(role=content)" ).hasClass('ui-body-b'), 'Expect content inheritance from dialog theme ui-body-b'); + ok($('#foo-dialog').find( ":jqmData(role=footer)" ).hasClass('ui-bar-c'), 'Expected footer theme ui-bar-c'); + // close the dialog $(".ui-dialog").dialog("close"); }, 500); diff --git a/tests/unit/dialog/index.html b/tests/unit/dialog/index.html index 7e3a82f2..665c4d6d 100644 --- a/tests/unit/dialog/index.html +++ b/tests/unit/dialog/index.html @@ -25,15 +25,20 @@
-
+
-
-
+
+

Dialog

- foo +
+ foo +
+
+ footer +
From bf4db8dae19c9dd5f4461ae0cafd8136f94a6120 Mon Sep 17 00:00:00 2001 From: BradBroulik Date: Fri, 5 Aug 2011 17:49:47 -0500 Subject: [PATCH 3/7] Added unit tests for dialog theme inheritance. --- tests/unit/dialog/dialog_events.js | 8 ++++---- tests/unit/dialog/index.html | 10 ++++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/unit/dialog/dialog_events.js b/tests/unit/dialog/dialog_events.js index 916aa414..623fb08c 100644 --- a/tests/unit/dialog/dialog_events.js +++ b/tests/unit/dialog/dialog_events.js @@ -14,10 +14,10 @@ ok(/&ui-state=dialog/.test(location.hash), "ui-state=dialog =~ location.hash"); // Assert dialog theme inheritance (issue 1375): - ok($('#foo-dialog').hasClass('ui-body-b'), 'Expected theme ui-body-b'); - ok($('#foo-dialog').find( ":jqmData(role=header)" ).hasClass('ui-bar-b'), 'Expected header theme inherited from parent ui-bar-b'); - ok($('#foo-dialog').find( ":jqmData(role=content)" ).hasClass('ui-body-b'), 'Expect content inheritance from dialog theme ui-body-b'); - ok($('#foo-dialog').find( ":jqmData(role=footer)" ).hasClass('ui-bar-c'), 'Expected footer theme ui-bar-c'); + ok($('#foo-dialog').hasClass('ui-body-b'), 'Expected explicit theme ui-body-b'); + ok($('#foo-dialog').find( ":jqmData(role=header)" ).hasClass('ui-bar-a'), 'Expected header to inherit from $.mobile.page.prototype.options.headerTheme'); + ok($('#foo-dialog').find( ":jqmData(role=content)" ).hasClass('ui-body-d'), 'Expect content to inherit from $.mobile.page.prototype.options.contentTheme'); + ok($('#foo-dialog').find( ":jqmData(role=footer)" ).hasClass('ui-bar-a'), 'Expected footer to inherit from $.mobile.page.prototype.options.footerTheme'); // close the dialog $(".ui-dialog").dialog("close"); diff --git a/tests/unit/dialog/index.html b/tests/unit/dialog/index.html index 665c4d6d..f250593d 100644 --- a/tests/unit/dialog/index.html +++ b/tests/unit/dialog/index.html @@ -6,6 +6,12 @@ jQuery Mobile Dialog Test Suite + @@ -33,10 +39,10 @@

Dialog

-
+
foo
-
+
footer
From 6ebaf991a831b155e54d240e3fd1e880064a8ca9 Mon Sep 17 00:00:00 2001 From: John Bender Date: Wed, 10 Aug 2011 17:06:56 -0700 Subject: [PATCH 4/7] moved dialog test to pageSequence helper, and small cleanup --- tests/unit/dialog/dialog_events.js | 42 +++++++++++++++++------------- tests/unit/dialog/index.html | 4 +-- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/tests/unit/dialog/dialog_events.js b/tests/unit/dialog/dialog_events.js index 623fb08c..ee3c0fce 100644 --- a/tests/unit/dialog/dialog_events.js +++ b/tests/unit/dialog/dialog_events.js @@ -7,25 +7,31 @@ asyncTest( "dialog hash is added when the dialog is opened and removed when closed", function(){ expect( 6 ); - //bring up the dialog - $("a[href='#foo-dialog']").click(); + $.testHelper.pageSequence([ + function(){ + //bring up the dialog + $("#foo-dialog-link").click(); + }, - setTimeout(function(){ - ok(/&ui-state=dialog/.test(location.hash), "ui-state=dialog =~ location.hash"); - - // Assert dialog theme inheritance (issue 1375): - ok($('#foo-dialog').hasClass('ui-body-b'), 'Expected explicit theme ui-body-b'); - ok($('#foo-dialog').find( ":jqmData(role=header)" ).hasClass('ui-bar-a'), 'Expected header to inherit from $.mobile.page.prototype.options.headerTheme'); - ok($('#foo-dialog').find( ":jqmData(role=content)" ).hasClass('ui-body-d'), 'Expect content to inherit from $.mobile.page.prototype.options.contentTheme'); - ok($('#foo-dialog').find( ":jqmData(role=footer)" ).hasClass('ui-bar-a'), 'Expected footer to inherit from $.mobile.page.prototype.options.footerTheme'); - - // close the dialog - $(".ui-dialog").dialog("close"); - }, 500); + function(){ + var fooDialog; + ok(/&ui-state=dialog/.test(location.hash), "ui-state=dialog =~ location.hash", "dialog open"); - setTimeout(function(){ - ok(!/&ui-state=dialog/.test(location.hash), "ui-state=dialog !~ location.hash"); - start(); - }, 1000); + fooDialog = $('#foo-dialog'); + // Assert dialog theme inheritance (issue 1375): + ok(fooDialog.hasClass('ui-body-b'), 'Expected explicit theme ui-body-b'); + ok(fooDialog.find( ":jqmData(role=header)" ).hasClass('ui-bar-a'), 'Expected header to inherit from $.mobile.page.prototype.options.headerTheme'); + ok(fooDialog.find( ":jqmData(role=content)" ).hasClass('ui-body-d'), 'Expect content to inherit from $.mobile.page.prototype.options.contentTheme'); + ok(fooDialog.find( ":jqmData(role=footer)" ).hasClass('ui-bar-a'), 'Expected footer to inherit from $.mobile.page.prototype.options.footerTheme'); + + // close the dialog + $(".ui-dialog").dialog("close"); + }, + + function(){ + ok(!/&ui-state=dialog/.test(location.hash), "ui-state=dialog !~ location.hash"); + start(); + } + ]); }); })(jQuery); diff --git a/tests/unit/dialog/index.html b/tests/unit/dialog/index.html index f250593d..8402d45b 100644 --- a/tests/unit/dialog/index.html +++ b/tests/unit/dialog/index.html @@ -11,7 +11,7 @@ // Expect content to inherit this theme when not explicitly set $.mobile.page.prototype.options.contentTheme = "d"; }); - + @@ -32,7 +32,7 @@
- +
From c41c65a1cfd391df19544114a3a71ad546a3b02b Mon Sep 17 00:00:00 2001 From: John Bender Date: Wed, 10 Aug 2011 17:07:34 -0700 Subject: [PATCH 5/7] quote consistency --- tests/unit/dialog/dialog_events.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/unit/dialog/dialog_events.js b/tests/unit/dialog/dialog_events.js index ee3c0fce..6a6711c9 100644 --- a/tests/unit/dialog/dialog_events.js +++ b/tests/unit/dialog/dialog_events.js @@ -17,12 +17,12 @@ var fooDialog; ok(/&ui-state=dialog/.test(location.hash), "ui-state=dialog =~ location.hash", "dialog open"); - fooDialog = $('#foo-dialog'); + fooDialog = $("#foo-dialog"); // Assert dialog theme inheritance (issue 1375): - ok(fooDialog.hasClass('ui-body-b'), 'Expected explicit theme ui-body-b'); - ok(fooDialog.find( ":jqmData(role=header)" ).hasClass('ui-bar-a'), 'Expected header to inherit from $.mobile.page.prototype.options.headerTheme'); - ok(fooDialog.find( ":jqmData(role=content)" ).hasClass('ui-body-d'), 'Expect content to inherit from $.mobile.page.prototype.options.contentTheme'); - ok(fooDialog.find( ":jqmData(role=footer)" ).hasClass('ui-bar-a'), 'Expected footer to inherit from $.mobile.page.prototype.options.footerTheme'); + ok(fooDialog.hasClass("ui-body-b"), "Expected explicit theme ui-body-b"); + ok(fooDialog.find( ":jqmData(role=header)" ).hasClass("ui-bar-a"), "Expected header to inherit from $.mobile.page.prototype.options.headerTheme"); + ok(fooDialog.find( ":jqmData(role=content)" ).hasClass("ui-body-d"), "Expect content to inherit from $.mobile.page.prototype.options.contentTheme"); + ok(fooDialog.find( ":jqmData(role=footer)" ).hasClass("ui-bar-a"), "Expected footer to inherit from $.mobile.page.prototype.options.footerTheme"); // close the dialog $(".ui-dialog").dialog("close"); From f352f05cc96b51e642536b4e3fe24871200f6ae1 Mon Sep 17 00:00:00 2001 From: John Bender Date: Wed, 10 Aug 2011 17:10:31 -0700 Subject: [PATCH 6/7] core style guide --- tests/unit/dialog/dialog_events.js | 35 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/tests/unit/dialog/dialog_events.js b/tests/unit/dialog/dialog_events.js index 6a6711c9..0e53179f 100644 --- a/tests/unit/dialog/dialog_events.js +++ b/tests/unit/dialog/dialog_events.js @@ -1,37 +1,38 @@ /* * mobile dialog unit tests */ -(function($){ - module('jquery.mobile.dialog.js'); +(function($) { + module( "jquery.mobile.dialog.js" ); - asyncTest( "dialog hash is added when the dialog is opened and removed when closed", function(){ + asyncTest( "dialog hash is added when the dialog is opened and removed when closed", function() { expect( 6 ); $.testHelper.pageSequence([ - function(){ + function() { //bring up the dialog - $("#foo-dialog-link").click(); + $( "#foo-dialog-link" ).click(); }, - function(){ - var fooDialog; - ok(/&ui-state=dialog/.test(location.hash), "ui-state=dialog =~ location.hash", "dialog open"); + function() { + var fooDialog = $( "#foo-dialog" ); + + // make sure the dialog came up + ok( /&ui-state=dialog/.test(location.hash), "ui-state=dialog =~ location.hash", "dialog open" ); - fooDialog = $("#foo-dialog"); // Assert dialog theme inheritance (issue 1375): - ok(fooDialog.hasClass("ui-body-b"), "Expected explicit theme ui-body-b"); - ok(fooDialog.find( ":jqmData(role=header)" ).hasClass("ui-bar-a"), "Expected header to inherit from $.mobile.page.prototype.options.headerTheme"); - ok(fooDialog.find( ":jqmData(role=content)" ).hasClass("ui-body-d"), "Expect content to inherit from $.mobile.page.prototype.options.contentTheme"); - ok(fooDialog.find( ":jqmData(role=footer)" ).hasClass("ui-bar-a"), "Expected footer to inherit from $.mobile.page.prototype.options.footerTheme"); + ok( fooDialog.hasClass( "ui-body-b" ), "Expected explicit theme ui-body-b" ); + ok( fooDialog.find( ":jqmData(role=header)" ).hasClass( "ui-bar-a" ), "Expected header to inherit from $.mobile.page.prototype.options.headerTheme" ); + ok( fooDialog.find( ":jqmData(role=content)" ).hasClass( "ui-body-d" ), "Expect content to inherit from $.mobile.page.prototype.options.contentTheme" ); + ok( fooDialog.find( ":jqmData(role=footer)" ).hasClass( "ui-bar-a" ), "Expected footer to inherit from $.mobile.page.prototype.options.footerTheme" ); // close the dialog - $(".ui-dialog").dialog("close"); + $( ".ui-dialog" ).dialog( "close" ); }, - function(){ - ok(!/&ui-state=dialog/.test(location.hash), "ui-state=dialog !~ location.hash"); + function() { + ok( !/&ui-state=dialog/.test(location.hash), "ui-state=dialog !~ location.hash" ); start(); } ]); }); -})(jQuery); +})( jQuery ); From 70bd1ba3711f93a7bf95dda3d4bc664d69f71a02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andri=20M=C3=B6ll?= Date: Mon, 25 Jul 2011 15:23:10 -0700 Subject: [PATCH 7/7] Fix nested waiting-for-dom for initializePage. Using dom-ready within dom-ready meant that initializePage went to the end of the queue. That brought problems when other dom-ready code expected jQM to be set up, capable of changing pages and so on. But because $.mobile.pageContainer is also set in initializePage, changePage and others didn't work. --- js/jquery.mobile.init.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/jquery.mobile.init.js b/js/jquery.mobile.init.js index ff8cb6d6..67d4fd98 100644 --- a/js/jquery.mobile.init.js +++ b/js/jquery.mobile.init.js @@ -123,9 +123,9 @@ // so if it's 1, use 0 from now on $.mobile.defaultHomeScroll = ( !$.support.scrollTop || $(window).scrollTop() === 1 ) ? 0 : 1; - // dom-ready inits - if ( $.mobile.autoInitializePage ) { - $( $.mobile.initializePage ); + //dom-ready inits + if( $.mobile.autoInitializePage ){ + $.mobile.initializePage(); } // window load event