From 5fcf89e0d95bb59cc44ebb4c19dd945a7f2e9793 Mon Sep 17 00:00:00 2001 From: scottjehl Date: Thu, 19 Jan 2012 19:28:28 +0700 Subject: [PATCH] added unit tests for the zoom plugin --- tests/unit/zoom/index.html | 46 ++++++++++++++++++++++++++++++++++++++ tests/unit/zoom/zoom.js | 34 ++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 tests/unit/zoom/index.html create mode 100644 tests/unit/zoom/zoom.js diff --git a/tests/unit/zoom/index.html b/tests/unit/zoom/index.html new file mode 100644 index 00000000..84eb44a6 --- /dev/null +++ b/tests/unit/zoom/index.html @@ -0,0 +1,46 @@ + + + + + jQuery Mobile Zoom Maniplation Integration Test + + + + + + + + + + + + + + + + +

jQuery Mobile FieldContainer Test Suite

+

+

+
    +
+ +
+ + +
+ + + + + diff --git a/tests/unit/zoom/zoom.js b/tests/unit/zoom/zoom.js new file mode 100644 index 00000000..7285f8ca --- /dev/null +++ b/tests/unit/zoom/zoom.js @@ -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);