68eca0cac7016d24b926225bd1e927f33f17f07d
[platform/framework/web/web-ui-fw.git] / libs / js / jquery-mobile-1.0.1pre / tests / unit / media / media_core.js
1 /*
2  * mobile media unit tests
3  */
4
5 (function($){
6         var cssFn = $.fn.css,
7                         widthFn = $.fn.width;
8
9         // make sure original definitions are reset
10         module('jquery.mobile.media.js', {
11                 setup: function(){
12                         $(document).trigger('mobileinit.htmlclass');
13                 },
14                 teardown: function(){
15                         $.fn.css = cssFn;
16                         $.fn.width = widthFn;
17                 }
18         });
19
20         test( "media query check returns true when the position is absolute", function(){
21                 $.fn.css = function(){ return "absolute"; };
22                 same($.mobile.media("screen 1"), true);
23         });
24
25         test( "media query check returns false when the position is not absolute", function(){
26                 $.fn.css = function(){ return "not absolute"; };
27                 same($.mobile.media("screen 2"), false);
28         });
29
30         test( "media query check is cached", function(){
31                 $.fn.css = function(){ return "absolute"; };
32                 same($.mobile.media("screen 3"), true);
33
34                 $.fn.css = function(){ return "not absolute"; };
35                 same($.mobile.media("screen 3"), true);
36         });
37
38
39 })(jQuery);