Tizen 2.1 base
[platform/framework/web/web-ui-fw.git] / libs / js / jquery-mobile-1.0.1pre / tests / unit / buttonMarkup / buttonMarkup_core.js
1 /*
2  * mobile buttonMarkup tests
3  */
4 (function($){
5         module("jquery.mobile.buttonMarkup.js");
6
7         test( "control group buttons should be enhanced inside a footer", function(){
8                 var group, linkCount;
9
10                 group = $("#control-group-footer");
11                 linkCount = group.find( "a" ).length;
12
13                 same( group.find("a.ui-btn").length, linkCount, "all 4 links should be buttons");
14                 same( group.find("a > span.ui-corner-left").length, 1, "only 1 left cornered button");
15                 same( group.find("a > span.ui-corner-right").length, 1, "only 1 right cornered button");
16                 same( group.find("a > span:not(.ui-corner-left):not(.ui-corner-right)").length, linkCount - 2, "only 2 buttons are cornered");
17         });
18
19         test( "control group buttons should respect theme-related data attributes", function(){
20                 var group = $("#control-group-content");
21
22                 ok(!group.find('[data-shadow=false]').hasClass("ui-shadow"),
23                          "buttons with data-shadow=false should not have the ui-shadow class");
24                 ok(!group.find('[data-corners=false]').hasClass("ui-btn-corner-all"),
25                          "buttons with data-corners=false should not have the ui-btn-corner-all class");
26                 ok(!group.find('[data-iconshadow=false] .ui-icon').hasClass("ui-icon-shadow"),
27                          "buttons with data-iconshadow=false should not have the ui-icon-shadow class on their icons");
28         });
29
30         // Test for issue #3046 and #3054:
31         test( "mousedown on SVG elements should not throw an exception", function(){
32                 var svg = $("#embedded-svg"),
33                         success = true,
34                         rect;
35                 ok(svg.length > 0, "found embedded svg document" );
36                 if ( svg.length > 0 ) {
37                         rect = $( "rect", svg );
38                         ok(rect.length > 0, "found rect" );
39                         try {
40                                 rect.trigger("mousedown");
41                         } catch ( ex ) {
42                                 success = false;
43                         }
44                         ok( success, "mousedown executed without exception");
45                 }
46         });
47 })(jQuery);