mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-03-17 14:30:28 +00:00
3046 - closestEnabledButton() conflicts with OpenLayers 3054 - RC3 - button conflicts with svg element, throws error: Uncaught TypeError: Object #<SVGAnimatedString> has no method 'split'
47 lines
1.7 KiB
JavaScript
47 lines
1.7 KiB
JavaScript
/*
|
|
* mobile buttonMarkup tests
|
|
*/
|
|
(function($){
|
|
module("jquery.mobile.buttonMarkup.js");
|
|
|
|
test( "control group buttons should be enhanced inside a footer", function(){
|
|
var group, linkCount;
|
|
|
|
group = $("#control-group-footer");
|
|
linkCount = group.find( "a" ).length;
|
|
|
|
same( group.find("a.ui-btn").length, linkCount, "all 4 links should be buttons");
|
|
same( group.find("a > span.ui-corner-left").length, 1, "only 1 left cornered button");
|
|
same( group.find("a > span.ui-corner-right").length, 1, "only 1 right cornered button");
|
|
same( group.find("a > span:not(.ui-corner-left):not(.ui-corner-right)").length, linkCount - 2, "only 2 buttons are cornered");
|
|
});
|
|
|
|
test( "control group buttons should respect theme-related data attributes", function(){
|
|
var group = $("#control-group-content");
|
|
|
|
ok(!group.find('[data-shadow=false]').hasClass("ui-shadow"),
|
|
"buttons with data-shadow=false should not have the ui-shadow class");
|
|
ok(!group.find('[data-corners=false]').hasClass("ui-btn-corner-all"),
|
|
"buttons with data-corners=false should not have the ui-btn-corner-all class");
|
|
ok(!group.find('[data-iconshadow=false] .ui-icon').hasClass("ui-icon-shadow"),
|
|
"buttons with data-iconshadow=false should not have the ui-icon-shadow class on their icons");
|
|
});
|
|
|
|
// Test for issue #3046 and #3054:
|
|
test( "mousedown on SVG elements should not throw an exception", function(){
|
|
var svg = $("#embedded-svg"),
|
|
success = true,
|
|
rect;
|
|
ok(svg.length > 0, "found embedded svg document" );
|
|
if ( svg.length > 0 ) {
|
|
rect = $( "rect", svg );
|
|
ok(rect.length > 0, "found rect" );
|
|
try {
|
|
rect.trigger("mousedown");
|
|
} catch ( ex ) {
|
|
success = false;
|
|
}
|
|
ok( success, "mousedown executed without exception");
|
|
}
|
|
});
|
|
})(jQuery);
|