added type attribute regex tests for the different ways that browsers serialize html

This commit is contained in:
John Bender 2011-03-14 23:49:07 -07:00
parent cd654a4eae
commit b56626fba1

View file

@ -2,7 +2,10 @@
* mobile page unit tests
*/
(function($){
module('jquery.mobile.page.js');
var libName = 'jquery.mobile.page.js',
typeAttributeRegex = $.mobile.page.prototype._typeAttributeRegex;
module(libName);
test( "nested header anchors aren't altered", function(){
ok(!$('.ui-header > div > a').hasClass('ui-btn'));
@ -31,4 +34,15 @@
test( "no auto-generated back button exists on first page", function(){
ok( !$('.ui-header > [data-rel="back"]').length );
});
test( "input type replacement regex works properly", function(){
ok(typeAttributeRegex.test( "<input type=range" ), "test no quotes" );
ok(typeAttributeRegex.test( "<input type='range'" ), "test single quotes" );
ok(typeAttributeRegex.test( "<input type=\"range\"" ), "test double quotes" );
ok(typeAttributeRegex.test( "<input type=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_"), "test \w" );
ok(typeAttributeRegex.test( "<input type=\"range\"" ), "test many preceding spaces" );
ok(typeAttributeRegex.test( "<input type='range'>" ), "test final attribute (FF)" );
ok(!typeAttributeRegex.test( "<inputtype=\"range\"" ), "requires preceding space" );
});
})(jQuery);