2010-11-19 07:35:44 +00:00
|
|
|
/*
|
|
|
|
|
* mobile media unit tests
|
|
|
|
|
*/
|
|
|
|
|
|
2011-02-07 07:25:03 +00:00
|
|
|
(function($){
|
|
|
|
|
var cssFn = $.fn.css,
|
|
|
|
|
widthFn = $.fn.width;
|
|
|
|
|
|
|
|
|
|
// make sure original definitions are reset
|
|
|
|
|
module('jquery.mobile.media.js', {
|
|
|
|
|
setup: function(){
|
|
|
|
|
$(document).trigger('mobileinit.htmlclass');
|
|
|
|
|
},
|
|
|
|
|
teardown: function(){
|
|
|
|
|
$.fn.css = cssFn;
|
|
|
|
|
$.fn.width = widthFn;
|
|
|
|
|
}
|
2010-11-19 07:47:40 +00:00
|
|
|
});
|
|
|
|
|
|
2011-02-07 07:25:03 +00:00
|
|
|
test( "media query check returns true when the position is absolute", function(){
|
|
|
|
|
$.fn.css = function(){ return "absolute"; };
|
|
|
|
|
same($.mobile.media("screen 1"), true);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test( "media query check returns false when the position is not absolute", function(){
|
|
|
|
|
$.fn.css = function(){ return "not absolute"; };
|
|
|
|
|
same($.mobile.media("screen 2"), false);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test( "media query check is cached", function(){
|
|
|
|
|
$.fn.css = function(){ return "absolute"; };
|
|
|
|
|
same($.mobile.media("screen 3"), true);
|
|
|
|
|
|
|
|
|
|
$.fn.css = function(){ return "not absolute"; };
|
|
|
|
|
same($.mobile.media("screen 3"), true);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})(jQuery);
|