Skip to content

Commit 2af091d

Browse files
committed
Toolbar Tests: updating tests to toolbar from page.sections
1 parent cac7376 commit 2af091d

24 files changed

+70
-136
lines changed

demos/widgets/headers/optimized-persistant-toolbars-a.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
<script src="../../../js/"></script>
1515
<script>
1616
$(function(){
17-
$("[data-role='header'], [data-role='footer']").toolbar();
1817
$("[data-role='navbar']").navbar();
18+
$("[data-role='header'], [data-role='footer']").toolbar();
1919
});
2020
</script>
2121
</head>

js/index.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
'jquery.mobile.degradeInputs.js',
4444
'widgets/optionDemultiplexer.js',
4545
'widgets/dialog.js',
46-
'widgets/page.sections.js',
4746
'widgets/collapsible.js',
4847
'widgets/addFirstLastClasses.js',
4948
'widgets/collapsibleSet.js',

js/jquery.mobile.buttonMarkup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ function updateButtonClass( $btn, classToRemove, classToAdd, hover, state ) {
270270
//auto self-init widgets
271271
$.mobile._enhancer.add( "mobile.buttonmarkup", undefined, function( target ) {
272272

273-
$( ":jqmData(role='button'), .ui-bar > a, .ui-header > a, .ui-footer > a, .ui-bar > :jqmData(role='controlgroup') > a", target )
273+
$( ":jqmData(role='button'), .ui-bar > a, .ui-bar > :jqmData(role='controlgroup') > a", target )
274274
.jqmEnhanceable()
275275
.not( "button, input, .ui-btn, :jqmData(role='none'), :jqmData(role='nojs')" )
276276
.buttonMarkup();

js/jquery.mobile.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ define([
1414
"./jquery.mobile.navigation",
1515
"./jquery.mobile.degradeInputs",
1616
"./widgets/dialog",
17-
"./widgets/page.sections",
1817
"./widgets/collapsible",
1918
"./widgets/collapsibleSet",
2019
"./jquery.mobile.fieldContain",

js/widgets/collapsible.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ $.widget( "mobile.collapsible", $.mobile.widget, {
187187
$.mobile.collapsible.initSelector = ":jqmData(role='collapsible')";
188188

189189
//auto self-init widgets
190-
$.mobile._enhancer.add( "mobile.collapsible" );
190+
$.mobile._enhancer.add( "mobile.collapsible", { dependencies: [ "mobile.page","mobile.toolbar" ] });
191191

192192
})( jQuery );
193193
//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);

js/widgets/fixedToolbar.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//>>css.structure: ../css/structure/jquery.mobile.fixedToolbar.css
66
//>>css.theme: ../css/themes/default/jquery.mobile.theme.css
77

8-
define( [ "jquery", "../jquery.mobile.widget", "../jquery.mobile.core", "../jquery.mobile.navigation", "./page", "./page.sections", "../jquery.mobile.zoom", "../jquery.mobile.registry" ], function( jQuery ) {
8+
define( [ "jquery", "../jquery.mobile.widget", "../jquery.mobile.core", "../jquery.mobile.navigation", "./page","../jquery.mobile.zoom", "../jquery.mobile.registry" ], function( jQuery ) {
99
//>>excludeEnd("jqmBuildExclude");
1010
(function( $, undefined ) {
1111

@@ -37,7 +37,6 @@ define( [ "jquery", "../jquery.mobile.widget", "../jquery.mobile.core", "../jque
3737
_create: function() {
3838
this._super();
3939
if( this.options.position === "fixed" && !this.options.supportBlacklist() ){
40-
4140
this.element.addClass( "ui-"+ this.role +"-fixed" );
4241
this.updatePagePadding();
4342
this._addTransitionClass();
@@ -90,7 +89,7 @@ define( [ "jquery", "../jquery.mobile.widget", "../jquery.mobile.core", "../jque
9089
});
9190
},
9291

93-
_handlePageBeforeShow: function( e ) {
92+
_handlePageBeforeShow: function( ) {
9493
var o = this.options;
9594
if ( o.disablePageZoom ) {
9695
$.mobile.zoom.disable( true );
@@ -153,12 +152,10 @@ define( [ "jquery", "../jquery.mobile.widget", "../jquery.mobile.core", "../jque
153152

154153
// This behavior only applies to "fixed", not "fullscreen"
155154
if ( this.options.fullscreen ) { return; }
156-
console.log(header);
157155
// tbPage argument can be a Page object or an event, if coming from throttled resize.
158156
tbPage = ( tbPage && tbPage.type === undefined && tbPage ) || this.page || $el.closest( ".ui-page" );
159-
tbPage = ( !!this.page )? this.page: ".ui-page-active"
157+
tbPage = ( !!this.page )? this.page: ".ui-page-active";
160158
$( tbPage ).css( "padding-" + ( header ? "top" : "bottom" ), $el.outerHeight() + pos );
161-
console.log( $el.outerHeight() );
162159
},
163160

164161
_useTransition: function( notransition ) {
@@ -223,7 +220,6 @@ define( [ "jquery", "../jquery.mobile.widget", "../jquery.mobile.core", "../jque
223220
_bindToggleHandlers: function() {
224221
var self = this,
225222
o = self.options,
226-
$el = self.element,
227223
delayShow, delayHide,
228224
isVisible = true,
229225
page = ( !!this.page )? this.page: $(".ui-page");

js/widgets/fixedToolbar.workarounds.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//>>label: Toolbars: Fixed: Workarounds
44
//>>group: Widgets
55
//>>css.structure: ../css/structure/jquery.mobile.fixedToolbar.css
6-
define( [ "jquery", "../jquery.mobile.widget", "../jquery.mobile.core", "../jquery.mobile.navigation", "./page", "./page.sections", "../jquery.mobile.zoom", "./fixedToolbar" ], function( jQuery ) {
6+
define( [ "jquery", "../jquery.mobile.widget", "../jquery.mobile.core", "../jquery.mobile.navigation", "./page", "../jquery.mobile.zoom", "./fixedToolbar" ], function( jQuery ) {
77
//>>excludeEnd("jqmBuildExclude");
88
(function( $, undefined ) {
99
$.widget( "mobile.toolbar", $.mobile.toolbar, {

js/widgets/forms/select.custom.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ define( [
1818
"./select",
1919
"../listview",
2020
"../page",
21-
"../popup",
22-
// NOTE expects ui content in the defined page, see selector for menuPageContent definition
23-
"../page.sections" ], function( jQuery ) {
21+
"../popup" ], function( jQuery ) {
2422
//>>excludeEnd("jqmBuildExclude");
2523
(function( $, undefined ) {
2624
var extendSelect = function( widget ) {

js/widgets/listview.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//>>css.structure: ../css/structure/jquery.mobile.listview.css
66
//>>css.theme: ../css/themes/default/jquery.mobile.theme.css
77

8-
define( [ "jquery", "../jquery.mobile.widget", "../jquery.mobile.buttonMarkup", "./page", "./page.sections", "./addFirstLastClasses", "../jquery.mobile.registry" ], function( jQuery ) {
8+
define( [ "jquery", "../jquery.mobile.widget", "../jquery.mobile.buttonMarkup", "./page", "./addFirstLastClasses", "../jquery.mobile.registry" ], function( jQuery ) {
99
//>>excludeEnd("jqmBuildExclude");
1010
(function( $, undefined ) {
1111

js/widgets/page.js

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ $.widget( "mobile.page", $.mobile.widget, {
1111
options: {
1212
theme: "c",
1313
domCache: false,
14-
keepNativeDefault: ":jqmData(role='none'), :jqmData(role='nojs')"
14+
keepNativeDefault: ":jqmData(role='none'), :jqmData(role='nojs')",
15+
contentTheme: null
1516
},
1617

1718
// DEPRECATED for > 1.4
@@ -22,7 +23,8 @@ $.widget( "mobile.page", $.mobile.widget, {
2223
},
2324

2425
_create: function() {
25-
var self = this;
26+
var attrPrefix = "data-" + $.mobile.ns,
27+
self = this;
2628
// if false is returned by the callbacks do not create the page
2729
if ( this._trigger( "beforecreate" ) === false ) {
2830
return false;
@@ -36,18 +38,13 @@ $.widget( "mobile.page", $.mobile.widget, {
3638
pagebeforehide: "removeContainerBackground",
3739
pagebeforeshow: "_handlePageBeforeShow"
3840
});
39-
40-
this.element.find("[data-role='content']").each( function(){
41-
var $this = $( this ),
42-
role = $this[ 0 ].getAttribute( attrPrefix + "role" ) || undefined,
43-
attrPrefix = "data-" + $.mobile.ns,
44-
theme = $this[ 0 ].getAttribute( attrPrefix + "theme" ) || undefined,
45-
contentTheme = theme || null || ( self.element.jqmData("role") === "dialog" && self.options.theme );
46-
47-
if ( contentTheme ) {
48-
$this.addClass( "ui-body-" + ( contentTheme ) );
41+
this.element.find("["+attrPrefix+"role='content']").each( function(){
42+
var $this = $( this );
43+
self.options.contentTheme = self.options.theme || self.options.contentTheme || ( self.element.jqmData("role") === "dialog" && self.options.theme );
44+
$this.addClass("ui-content");
45+
if ( self.options.contentTheme ) {
46+
$this.addClass( "ui-body-" + ( self.options.contentTheme ) );
4947
}
50-
5148
// Add ARIA role
5249
$this.attr( "role", "main" ).addClass("ui-content");
5350
});

0 commit comments

Comments
 (0)