Skip to content

Commit 67490a0

Browse files
authored
Only declare element & wrapper once in tests
1 parent 3da0e24 commit 67490a0

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

tests/unit/dialog/core.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,26 +87,28 @@ QUnit.test( "ARIA", function( assert ) {
8787
QUnit.test( "aria-modal", function( assert ) {
8888
assert.expect( 9 );
8989

90-
var element = $( "<div>" ).dialog( { modal: true } ),
91-
wrapper = element.dialog( "widget" );
90+
var element, wrapper;
91+
92+
element = $( "<div>" ).dialog( { modal: true } );
93+
wrapper = element.dialog( "widget" );
9294
assert.equal( wrapper.attr( "aria-modal" ), "true", "modal option set to true, aria-modal attribute added" );
9395
element.dialog( "option", "modal", false );
9496
assert.equal( wrapper.attr( "aria-modal" ), undefined, "modal option set to false, aria-modal attribute not added" );
9597
element.dialog( "option", "modal", true );
9698
assert.equal( wrapper.attr( "aria-modal" ), "true", "modal option set to true, aria-modal attribute added" );
9799
element.remove();
98100

99-
var element = $( "<div>" ).dialog( { modal: false } ),
100-
wrapper = element.dialog( "widget" );
101+
element = $( "<div>" ).dialog( { modal: false } );
102+
wrapper = element.dialog( "widget" );
101103
assert.equal( wrapper.attr( "aria-modal" ), undefined, "modal option set to false, aria-modal attribute not added" );
102104
element.dialog( "option", "modal", true );
103105
assert.equal( wrapper.attr( "aria-modal" ), "true", "modal option set to true, aria-modal attribute added" );
104106
element.dialog( "option", "modal", false );
105107
assert.equal( wrapper.attr( "aria-modal" ), undefined, "modal option set to false, aria-modal attribute not added" );
106108
element.remove();
107109

108-
var element = $( "<div>" ).dialog(),
109-
wrapper = element.dialog( "widget" );
110+
element = $( "<div>" ).dialog();
111+
wrapper = element.dialog( "widget" );
110112
assert.equal( wrapper.attr( "aria-modal" ), undefined, "modal option not set, aria-modal attribute not added" );
111113
element.dialog( "option", "modal", true );
112114
assert.equal( wrapper.attr( "aria-modal" ), "true", "modal option set to true, aria-modal attribute added" );

0 commit comments

Comments
 (0)