diff options
author | kborchers <kris.borchers@gmail.com> | 2012-05-29 20:55:43 -0500 |
---|---|---|
committer | kborchers <kris.borchers@gmail.com> | 2012-05-29 21:13:17 -0500 |
commit | 40e47c0b08c31e5003833b9c46d36e7468a63de8 (patch) | |
tree | 03b4e71f3dfe102f1f76ce5d7462f5b6dae1a15e /tests/unit | |
parent | 649a670d1c86be5e50b13cc03161d20098f80588 (diff) | |
download | jquery-ui-40e47c0b08c31e5003833b9c46d36e7468a63de8.tar.gz jquery-ui-40e47c0b08c31e5003833b9c46d36e7468a63de8.zip |
Core: Add the uniqueId() and removeUniqueId() methods written by @scottgonzalez to provide a generalized way of generating and removing generated element id's. Also, added a unit test. Fixed #8361 - Add uniqueId() and removeUniqueId()
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/core/core.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/unit/core/core.js b/tests/unit/core/core.js index 7a78ae34d..1026c5b0b 100644 --- a/tests/unit/core/core.js +++ b/tests/unit/core/core.js @@ -153,4 +153,14 @@ test( "outerHeight(true) - setter", function() { equal( el.height(), 32, "height set properly when hidden" ); }); +test( "uniqueId / removeUniqueId", function() { + var el = $( "img" ).eq( 0 ); + + equal( el.attr( "id" ), undefined, "element has no initial id" ); + el.uniqueId(); + ok( /ui-id-\d+$/.test( el.attr( "id" ) ), "element has generated id" ); + el.removeUniqueId(); + equal( el.attr( "id" ), undefined, "unique id has been removed from element" ); +}); + })( jQuery ); |