Permalink
Browse files

Page: Manipulate correct class in response to "theme" option change

The "theme" option should result in the manipulation of class "ui-page-theme-*",
not "ui-body-*"

Fixes #6668
  • Loading branch information...
gabrielschulhof committed Oct 26, 2013
1 parent 30c669a commit 2b0472674cf311730c639c8ff1e2101a704bbc20
Showing with 8 additions and 1 deletion.
  1. +1 −1 js/widgets/page.js
  2. +7 −0 tests/unit/page/page_core.js
View
@@ -131,7 +131,7 @@ $.widget( "mobile.page", {
_setOptions: function( o ) {
if ( o.theme !== undefined ) {
this.element.removeClass( "ui-body-" + this.options.theme ).addClass( "ui-body-" + o.theme );
this.element.removeClass( "ui-page-theme-" + this.options.theme ).addClass( "ui-page-theme-" + o.theme );
}
if ( o.contentTheme !== undefined ) {
@@ -51,6 +51,13 @@
ok( $( "#a" ).hasClass( "ui-page-theme-" + themedefault ) );
});
test( "setting option 'theme' on page updates classes correctly", function() {
$( "#a" ).page( "option", "theme", "x" );
deepEqual( $( "#a" ).hasClass( "ui-page-theme-x" ), true, "After setting option 'theme' to 'x', the page has the new theme class" );
deepEqual( $( "#a" ).hasClass( "ui-page-theme-" + themedefault ), false, "After setting option 'theme', the page does not have default theme class" );
$( "#a" ).page( "option", "theme", themedefault );
});
test( "B page has non-default theme matching its data-theme attr" , function(){
$( "#b" ).page();
var btheme = $( "#b" ).jqmData( "theme" );

0 comments on commit 2b04726

Please sign in to comment.