From d5cf4fc29a722c2600baff77e9ae7aca85325aaa Mon Sep 17 00:00:00 2001 From: BradBroulik Date: Thu, 28 Jul 2011 16:45:39 -0500 Subject: [PATCH 1/2] 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 2/2] 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