diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2012-11-17 13:23:57 +0100 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2012-11-26 10:28:24 +0100 |
commit | 5aac8f563f3ff7227fe9790c2ac8620223e3bd45 (patch) | |
tree | 6adb0249cbed68fa7f1643c94a0ee341e62a8e66 /tests/unit/dialog | |
parent | 32a893128dcda19f570dbd8f07d82e6e8d434cdf (diff) | |
download | jquery-ui-5aac8f563f3ff7227fe9790c2ac8620223e3bd45.tar.gz jquery-ui-5aac8f563f3ff7227fe9790c2ac8620223e3bd45.zip |
Dialog: Add missing unit test for aria-describedby attribute
Diffstat (limited to 'tests/unit/dialog')
-rw-r--r-- | tests/unit/dialog/dialog_core.js | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/tests/unit/dialog/dialog_core.js b/tests/unit/dialog/dialog_core.js index 31b245a61..b5566255c 100644 --- a/tests/unit/dialog/dialog_core.js +++ b/tests/unit/dialog/dialog_core.js @@ -17,24 +17,18 @@ test("title id", function() { el.remove(); }); -// TODO test for aria-describedby -// add only when the attribute isn't anywhere yet -test("ARIA", function() { - expect(4); - - var labelledBy, - el = $('<div></div>').dialog(); - - equal(el.dialog('widget').attr('role'), 'dialog', 'dialog role'); - - labelledBy = el.dialog('widget').attr('aria-labelledby'); - ok(labelledBy.length > 0, 'has aria-labelledby attribute'); - equal(el.dialog('widget').find('.ui-dialog-title').attr('id'), labelledBy, - 'proper aria-labelledby attribute'); - - equal(el.dialog('widget').find('.ui-dialog-titlebar-close').attr('role'), 'button', - 'close link role'); +test( "ARIA", function() { + expect( 4 ); + + var el = $( "<div></div>" ).dialog(), + wrapper = el.dialog( "widget" ); + equal( wrapper.attr( "role" ), "dialog", "dialog role" ); + equal( wrapper.attr( "aria-labelledby" ), wrapper.find( ".ui-dialog-title" ).attr( "id" ) ); + equal( wrapper.attr( "aria-describedby" ), el.attr( "id" ), "aria-describedby added" ); + el.remove(); + el = $( '<div><div aria-describedby="section2"><p id="section2">descriotion</p></div></div>' ).dialog(); + strictEqual( el.dialog( "widget" ).attr( "aria-describedby" ), undefined, "no aria-describedby added, as already present in markup" ); el.remove(); }); |