mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-05-18 03:21:07 +00:00
added unit tests for the zoom plugin
This commit is contained in:
parent
db453434a8
commit
5fcf89e0d9
2 changed files with 80 additions and 0 deletions
46
tests/unit/zoom/index.html
Normal file
46
tests/unit/zoom/index.html
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<title>jQuery Mobile Zoom Maniplation Integration Test</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
|
<script src="../../../external/requirejs/require.js"></script>
|
||||||
|
<script src="../../../js/jquery.js"></script>
|
||||||
|
<script src="../jquery.setNameSpace.js"></script>
|
||||||
|
<script src="../../../tests/jquery.testHelper.js"></script>
|
||||||
|
<script src="../../../external/qunit.js"></script>
|
||||||
|
<script>
|
||||||
|
$.testHelper.asyncLoad([
|
||||||
|
[
|
||||||
|
"jquery.mobile.zoom"
|
||||||
|
],
|
||||||
|
[ "jquery.mobile.init" ],
|
||||||
|
[
|
||||||
|
"./zoom.js"
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="../../../css/themes/default/jquery.mobile.css"/>
|
||||||
|
<link rel="stylesheet" href="../../../external/qunit.css"/>
|
||||||
|
|
||||||
|
<script src="../swarminject.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h1 id="qunit-header">jQuery Mobile FieldContainer Test Suite</h1>
|
||||||
|
<h2 id="qunit-banner"></h2>
|
||||||
|
<h2 id="qunit-userAgent"></h2>
|
||||||
|
<ol id="qunit-tests">
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
<div data-nstest-role="page">
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
34
tests/unit/zoom/zoom.js
Normal file
34
tests/unit/zoom/zoom.js
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* mobile Fixed Toolbar unit tests
|
||||||
|
*/
|
||||||
|
(function($){
|
||||||
|
module('jquery.mobile.fixedToolbar.js');
|
||||||
|
|
||||||
|
var defaultMeta = $( "meta[name=viewport]" ).attr("content");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function injectMeta( content ){
|
||||||
|
$( "meta[name=viewport]" ).attr("content", content || defaultMeta );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
test( "User zooming is enabled by default", function(){
|
||||||
|
ok( $.mobile.zoom.enabled === true, "property is true" );
|
||||||
|
});
|
||||||
|
|
||||||
|
test( "Meta viewport content is manipulated with maximum-scale", function(){
|
||||||
|
$.mobile.zoom.disable();
|
||||||
|
ok( $( "meta[name=viewport]" ).attr( "content" ).match( /,maximum\-scale=1$/ ), "The meta viewport tag's content contains maximum-scale=1 after enable is called" );
|
||||||
|
|
||||||
|
$.mobile.zoom.enable();
|
||||||
|
ok( $( "meta[name=viewport]" ).attr( "content" ).indexOf( ",maximum-scale=10" ) > 0, "The meta viewport tag's content contains maximum-scale=10 after enable is called" );
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
})(jQuery);
|
||||||
Loading…
Reference in a new issue