Skip to content

Commit

Permalink
added type attribute regex tests for the different ways that browsers…
Browse files Browse the repository at this point in the history
… serialize html
  • Loading branch information
johnbender committed Mar 15, 2011
1 parent cd654a4 commit b56626f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/unit/page/page_core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down Expand Up @@ -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);

0 comments on commit b56626f

Please sign in to comment.