From 5aac8f563f3ff7227fe9790c2ac8620223e3bd45 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rn=20Zaefferer?= Date: Sat, 17 Nov 2012 13:23:57 +0100 Subject: [PATCH] Dialog: Add missing unit test for aria-describedby attribute --- tests/unit/dialog/dialog_core.js | 28 +++++++++++----------------- 1 file 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 = $('
').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 = $( "
" ).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 = $( '

descriotion

' ).dialog(); + strictEqual( el.dialog( "widget" ).attr( "aria-describedby" ), undefined, "no aria-describedby added, as already present in markup" ); el.remove(); }); -- 2.39.5