Skip to content

Commit 42edf77

Browse files
committed
applying mgol's suggested changes to the aria-modal test
1 parent 8283b78 commit 42edf77

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

tests/unit/dialog/core.js

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,25 +85,42 @@ QUnit.test( "ARIA", function( assert ) {
8585
} );
8686

8787
QUnit.test( "aria-modal", function( assert ) {
88-
assert.expect( 3 );
88+
assert.expect( 12 );
8989

90-
var element = $( "<div>" ).dialog( "options", "modal", true ),
90+
var element = $( "<div>" ).dialog( { modal: true } ),
9191
wrapper = element.dialog( "widget" );
92-
assert.equal( wrapper.attr( "aria-modal" ), "true", "aria-modal attribute set to true" );
92+
assert.equal( wrapper.attr( "aria-modal" ), "true", "modal option set to true, aria-modal attribute added" );
93+
element.dialog( "option", "modal", false );
94+
assert.ok( !wrapper.attr( "aria-modal" ), "modal option set to false, aria-modal attribute not added" );
95+
element.dialog( "option", "modal", null );
96+
assert.ok( !wrapper.attr( "aria-modal" ), "modal option not set, aria-modal attribute not added" );
97+
element.dialog( "option", "modal", true );
98+
assert.equal( wrapper.attr( "aria-modal" ), "true", "modal option set to true, aria-modal attribute added" );
9399
element.remove();
94100

95-
var element = $( "<div>" ).dialog( "options", "modal", false ),
101+
var element = $( "<div>" ).dialog( { modal: false } ),
96102
wrapper = element.dialog( "widget" );
97-
assert.equal( wrapper.attr( "aria-modal" ), "false", "aria-modal attribute set to false" );
103+
assert.ok( !wrapper.attr( "aria-modal" ), "modal option set to false, aria-modal attribute not added" );
104+
element.dialog( "option", "modal", true );
105+
assert.equal( wrapper.attr( "aria-modal" ), "true", "modal option set to true, aria-modal attribute added" );
106+
element.dialog( "option", "modal", null );
107+
assert.ok( !wrapper.attr( "aria-modal" ), "modal option not set, aria-modal attribute not added" );
108+
element.dialog( "option", "modal", false );
109+
assert.ok( !wrapper.attr( "aria-modal" ), "modal option set to false, aria-modal attribute not added" );
98110
element.remove();
99111

100-
var element = $( "<div>" ).dialog( "options", "modal", null ),
112+
var element = $( "<div>" ).dialog(),
101113
wrapper = element.dialog( "widget" );
102-
assert.equal( wrapper.attr( "aria-modal" ), null, "no aria-modal attribute added" );
114+
assert.ok( !wrapper.attr( "aria-modal" ), "modal option not set, aria-modal attribute not added" );
115+
element.dialog( "option", "modal", true );
116+
assert.equal( wrapper.attr( "aria-modal" ), "true", "modal option set to true, aria-modal attribute added" );
117+
element.dialog( "option", "modal", false );
118+
assert.ok( !wrapper.attr( "aria-modal" ), "modal option set to false, aria-modal attribute not added" );
119+
element.dialog( "option", "modal", null );
120+
assert.equal( wrapper.attr( "aria-modal" ), null, "modal option not set, aria-modal attribute not added" );
103121
element.remove();
104122
} );
105123

106-
107124
QUnit.test( "widget method", function( assert ) {
108125
assert.expect( 1 );
109126
var dialog = $( "<div>" ).appendTo( "#qunit-fixture" ).dialog();

0 commit comments

Comments
 (0)