Skip to content

Commit 6da7e4a

Browse files
author
scottjehl
committed
Made loading message configurable at runtime. Fixes jquery-archive#2044. Fixes jquery-archive#1974. Fixes jquery-archive#1947.
1 parent 12d5277 commit 6da7e4a

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

js/jquery.mobile.init.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
//loading div which appears during Ajax requests
3535
//will not appear if $.mobile.loadingMessage is false
36-
var $loader = $.mobile.loadingMessage ? $( "<div class='ui-loader ui-body-a ui-corner-all'>" + "<span class='ui-icon ui-icon-loading spin'></span>" + "<h1>" + $.mobile.loadingMessage + "</h1>" + "</div>" ) : undefined;
36+
var $loader = $( "<div class='ui-loader ui-body-a ui-corner-all'><span class='ui-icon ui-icon-loading spin'></span><h1></h1></div>" );
3737

3838
$.extend($.mobile, {
3939
// turn on/off page loading message.
@@ -42,6 +42,9 @@
4242
var activeBtn = $( "." + $.mobile.activeBtnClass ).first();
4343

4444
$loader
45+
.find( "h1" )
46+
.text( $.mobile.loadingMessage )
47+
.end()
4548
.appendTo( $.mobile.pageContainer )
4649
//position at y center (if scrollTop supported), above the activeBtn (if defined), or just 100px from top
4750
.css( {

tests/unit/init/init_core.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,5 +201,16 @@
201201
start();
202202
}, 500);
203203
});
204+
205+
asyncTest( "page loading should contain custom loading message when set during runtime", function(){
206+
$.mobile.loadingMessage = "bar";
207+
$.mobile.pageLoading(false);
208+
209+
setTimeout(function(){
210+
same($(".ui-loader h1").text(), "bar");
211+
start();
212+
}, 500);
213+
});
214+
204215
});
205216
})(jQuery);

0 commit comments

Comments
 (0)