diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-05-29 15:14:35 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-05-29 15:14:35 -0400 |
commit | 649a670d1c86be5e50b13cc03161d20098f80588 (patch) | |
tree | 69a6e4e9d9659a70dbcd5db016579461d851dc85 /tests/unit | |
parent | 0bbad349b982839c607d7c16bf2e46a293532dee (diff) | |
download | jquery-ui-649a670d1c86be5e50b13cc03161d20098f80588.tar.gz jquery-ui-649a670d1c86be5e50b13cc03161d20098f80588.zip |
Tests: Differentiate between attributes and properties in domEqual().
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/testsuite.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/unit/testsuite.js b/tests/unit/testsuite.js index 6c7ecf10b..3c8ec04c4 100644 --- a/tests/unit/testsuite.js +++ b/tests/unit/testsuite.js @@ -138,12 +138,16 @@ TestHelpers.commonWidgetTests = function( widget, settings ) { /* * Experimental assertion for comparing DOM objects. * - * Serializes an element and some properties and it's children if any, otherwise the text. + * Serializes an element and some properties and attributes and it's children if any, otherwise the text. * Then compares the result using deepEqual. */ window.domEqual = function( selector, modifier, message ) { var expected, actual, properties = [ + "disabled", + "readOnly" + ], + attributes = [ "autocomplete", "aria-activedescendant", "aria-controls", @@ -159,11 +163,9 @@ window.domEqual = function( selector, modifier, message ) { "aria-valuemin", "aria-valuenow", "class", - "disabled", "href", "id", "nodeName", - "readOnly", "role", "tabIndex", "title" @@ -179,7 +181,12 @@ window.domEqual = function( selector, modifier, message ) { var children, result = {}; $.each( properties, function( index, attr ) { - result[ attr ] = elem.prop( attr ); + var value = elem.prop( attr ); + result[ attr ] = value !== undefined ? value : ""; + }); + $.each( attributes, function( index, attr ) { + var value = elem.attr( attr ); + result[ attr ] = value !== undefined ? value : ""; }); children = elem.children(); if ( children.length ) { |