Skip to content
This repository
Browse code

Made loading message configurable at runtime. Fixes #2044. Fixes #1974.…

… Fixes #1947.
  • Loading branch information...
commit 6da7e4a1dc7b0b54fae3357d300f663ed3dc94cd 1 parent 12d5277
authored July 14, 2011
5  js/jquery.mobile.init.js
@@ -33,7 +33,7 @@
33 33
 
34 34
 	//loading div which appears during Ajax requests
35 35
 	//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>" );
37 37
 
38 38
 	$.extend($.mobile, {
39 39
 		// turn on/off page loading message.
@@ -42,6 +42,9 @@
42 42
 				var activeBtn = $( "." + $.mobile.activeBtnClass ).first();
43 43
 			
44 44
 				$loader
  45
+					.find( "h1" )
  46
+						.text( $.mobile.loadingMessage )
  47
+						.end()
45 48
 					.appendTo( $.mobile.pageContainer )
46 49
 					//position at y center (if scrollTop supported), above the activeBtn (if defined), or just 100px from top
47 50
 					.css( {
11  tests/unit/init/init_core.js
@@ -201,5 +201,16 @@
201 201
 				start();
202 202
 			}, 500);
203 203
 		});
  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
+		
204 215
 	});
205 216
 })(jQuery);

0 notes on commit 6da7e4a

Please sign in to comment.
Something went wrong with that request. Please try again.