Added test for issue #3141

This commit is contained in:
Josh Dean 2012-01-18 19:40:50 -06:00 committed by Ghislain Seguin
parent 57ac32ffc6
commit b1c6c4cd3f
2 changed files with 34 additions and 16 deletions

View file

@ -44,4 +44,20 @@
ok( success, "mousedown executed without exception");
}
});
// Test for issue #3141:
test( "elements of input[type='submit'] with data-role='button' should not be doubly enhanced", function(){
var button = $("#double-enhanced"),
count = 0;
button.bind('vclick', function() {
count++;
});
button.trigger('vclick');
ok( count === 1, "events don't trigger twice");
ok( !button.hasClass('ui-btn') && !button.children().length, "input not styled like button and contains no children");
});
})(jQuery);

View file

@ -5,6 +5,7 @@
<title>jQuery Mobile Button Markup Test Suite</title>
<!-- meta viewport left out on purpose for test append -->
<script src="../../../js/jquery.js"></script>
<script src="../jquery.setNameSpace.js"></script>
<script src="../../../js/"></script>
<script src="../../../external/qunit.js"></script>
<script src="../../jquery.testHelper.js"></script>
@ -24,22 +25,23 @@
</ol>
<div data-nstest-role="page" id="default">
<div data-role="content" id="control-group-content">
<a href="index.html" data-role="button" data-shadow="false">No shadow</a>
<a href="index.html" data-role="button" data-corners="false">No corners</a>
<a href="index.html" data-role="button" data-shadow="false" data-corners="false">No shadow or corners</a>
<a href="index.html" data-role="button" data-icon="delete" data-iconshadow="false">No iconshadow</a>
<button data-shadow="false" data-corners="false" data-icon="delete" data-iconshadow="false">None of the above</button>
<svg id="embedded-svg" width="120" height="120" viewPort="0 0 120 120" version="1.1" xmlns="http://www.w3.org/2000/svg">
<rect x="10" y="10" width="100" height="100"/>
</svg>
</div>
<div data-role="footer" id="control-group-footer" class="ui-bar" data-position="inline">
<div data-role="controlgroup" data-type="horizontal">
<a href="index.html" data-icon="delete">Remove</a>
<a href="index.html" data-icon="plus">Add</a>
<a href="index.html" data-icon="arrow-u">Up</a>
<a href="index.html" data-icon="arrow-d">Down</a>
<div data-nstest-role="content" id="control-group-content">
<input type="submit" data-nstest-role="button" value="Double Enhanced?" id="double-enhanced" />
<a href="index.html" data-nstest-role="button" data-nstest-shadow="false">No shadow</a>
<a href="index.html" data-nstest-role="button" data-nstest-corners="false">No corners</a>
<a href="index.html" data-nstest-role="button" data-nstest-shadow="false" data-nstest-corners="false">No shadow or corners</a>
<a href="index.html" data-nstest-role="button" data-nstest-icon="delete" data-nstest-iconshadow="false">No iconshadow</a>
<button data-nstest-shadow="false" data-nstest-corners="false" data-nstest-icon="delete" data-nstest-iconshadow="false">None of the above</button>
<svg id="embedded-svg" width="120" height="120" viewPort="0 0 120 120" version="1.1" xmlns="http://www.w3.org/2000/svg">
<rect x="10" y="10" width="100" height="100"/>
</svg>
</div>
<div data-nstest-role="footer" id="control-group-footer" class="ui-bar" data-nstest-position="inline">
<div data-nstest-role="controlgroup" data-nstest-type="horizontal">
<a href="index.html" data-nstest-icon="delete">Remove</a>
<a href="index.html" data-nstest-icon="plus">Add</a>
<a href="index.html" data-nstest-icon="arrow-u">Up</a>
<a href="index.html" data-nstest-icon="arrow-d">Down</a>
</div>
</div>
</div>