diff options
author | timmywil <tim.willison@thisismedium.com> | 2011-03-09 20:20:53 -0500 |
---|---|---|
committer | timmywil <tim.willison@thisismedium.com> | 2011-04-03 19:13:38 -0400 |
commit | 5eecb13fa3391870e904548f03d8a509117984f3 (patch) | |
tree | f191e4b0a88f5184214bbdec8eb15266df05ef05 /test | |
parent | de79e8c7e0d1d2243447d59c70a9058eabf56bc3 (diff) | |
download | jquery-5eecb13fa3391870e904548f03d8a509117984f3.tar.gz jquery-5eecb13fa3391870e904548f03d8a509117984f3.zip |
Now passes in IE8, changed around $.hasAttr and switched the attrHook for selected to be a propHook
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/attributes.js | 34 |
1 files changed, 5 insertions, 29 deletions
diff --git a/test/unit/attributes.js b/test/unit/attributes.js index d4284556b..af423e346 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -3,31 +3,6 @@ module("attributes", { teardown: moduleTeardown }); var bareObj = function(value) { return value; }; var functionReturningObj = function(value) { return (function() { return value; }); }; -// test("jQuery.props: integrity test", function() { -// -// expect(1); -// -// // This must be maintained and equal jQuery.props -// // Ensure that accidental or erroneous property -// // overwrites don't occur -// // This is simply for better code coverage and future proofing. -// var propsShouldBe = { -// "for": "htmlFor", -// "class": "className", -// readonly: "readOnly", -// maxlength: "maxLength", -// cellspacing: "cellSpacing", -// rowspan: "rowSpan", -// colspan: "colSpan", -// tabindex: "tabIndex", -// usemap: "useMap", -// frameborder: "frameBorder" -// }; -// -// same(propsShouldBe, jQuery.props, "jQuery.props passes integrity check"); -// -// }); - test("prop", function() { equals( jQuery('#text1').prop('value'), "Test", 'Check for value attribute' ); equals( jQuery('#text1').prop('value', "Test2").prop('defaultValue'), "Test", 'Check for defaultValue attribute' ); @@ -41,11 +16,12 @@ test("prop", function() { body.foo = 'bar'; equals( $body.prop('foo'), 'bar', 'Make sure the expando is preferred over the dom attribute' ); body.foo = undefined; - ok( $body.attr('foo') === undefined, 'Make sure the expando is preferred over the dom attribute, even if undefined' ); + ok( $body.prop('foo') === undefined, 'Make sure the expando is preferred over the dom attribute, even if undefined' ); var select = document.createElement("select"), optgroup = document.createElement("optgroup"), option = document.createElement("option"); optgroup.appendChild( option ); select.appendChild( optgroup ); + equals( jQuery(option).prop("selected"), true, "Make sure that a single option is selected, even when in an optgroup." ); equals( jQuery(document).prop("nodeName"), "#document", "prop works correctly on document nodes (bug #7451)." ); @@ -85,7 +61,7 @@ test("attr(String)", function() { // Related to [5574] and [5683] var body = document.body, $body = jQuery(body); - ok( $body.attr('foo') === undefined, 'Make sure that a non existent attribute returns undefined' ); + strictEqual( $body.attr('foo'), undefined, 'Make sure that a non existent attribute returns undefined' ); body.setAttribute('foo', 'baz'); equals( $body.attr('foo'), 'baz', 'Make sure the dom attribute is retrieved when no expando is found' ); @@ -118,8 +94,8 @@ if ( !isLocal ) { test("attr(String, Function)", function() { expect(2); - equals( jQuery('#text1').attr('value', function() { return this.id ;})[0].value, "text1", "Set value from id" ); - equals( jQuery('#text1').attr('title', function(i) { return i }).attr('title'), "0", "Set value with an index"); + equals( jQuery('#text1').attr('value', function() { return this.id; })[0].value, "text1", "Set value from id" ); + equals( jQuery('#text1').attr('title', function(i) { return i; }).attr('title'), "0", "Set value with an index"); }); test("attr(Hash)", function() { |