Skip to content

Commit 6077668

Browse files
author
scottjehl
committed
added a restore method, similar to a widget's destroy. Restores the meta content back to original value
1 parent 5fcf89e commit 6077668

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

js/jquery.mobile.zoom.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ define( [ "jquery", "jquery.mobile.core" ], function( $ ) {
1919
enable: function() {
2020
meta.attr( "content", enabledZoom );
2121
$.mobile.zoom.enabled = true;
22+
},
23+
restore: function() {
24+
meta.attr( "content", initialContent );
25+
$.mobile.zoom.enabled = true;
2226
}
2327
});
2428

tests/unit/zoom/zoom.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@
2828

2929
});
3030

31-
31+
test( "Meta viewport content restore method restores it back to original value", function(){
32+
$.mobile.zoom.disable();
33+
ok( $( "meta[name=viewport]" ).attr( "content" ).match( /,maximum\-scale=1$/ ), "The meta viewport tag's content contains maximum-scale=1 after enable is called" );
34+
35+
$.mobile.zoom.restore();
36+
ok( $( "meta[name=viewport]" ).attr( "content" ) === defaultMeta, "The meta viewport tag's content matches its default state" );
37+
38+
});
39+
3240

3341

3442
})(jQuery);

0 commit comments

Comments
 (0)