-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Dialog: Add aria-modal support #2257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
a8a6e26
729c6d0
268dc62
7f88e7f
22ea1a7
546144d
2506b1c
4810065
8283b78
42edf77
174bb27
e42ab78
3da0e24
67490a0
2b40401
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,6 +84,26 @@ QUnit.test( "ARIA", function( assert ) { | |
element.remove(); | ||
} ); | ||
|
||
QUnit.test( "aria-modal", function( assert ) { | ||
assert.expect( 3 ); | ||
|
||
var element = $( "<div>" ).dialog( "options", "modal", true ), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's
The widget needs to be initialized first. It'd help if you read https://learn.jquery.com/jquery-ui/how-jquery-ui-works/ which explains these basics. Here, you should just create the widget passing proper options to it as described in the "Initialization" section of that doc. That also made me realize we also need to modify the if ( key === "modal" ) {
uiDialog.attr( "aria-modal", value ? "true" : null );
} in there. Unfortunately, it seems the one in Then, we need tests for both the setting the option initially and then modifying it later to cover all grounds. To summarize, I'd create three sections in this test - one with And then, within each of those sections, first do a proper assertion and then call There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks a lot for the detailed explanation, that helped figuring things out, even though it was way out of my comfort zone. but with the help of @rocketeerbkw i was able to finish the draft thursday night. |
||
wrapper = element.dialog( "widget" ); | ||
assert.equal( wrapper.attr( "aria-modal" ), "true", "aria-modal attribute set to true" ); | ||
element.remove(); | ||
|
||
var element = $( "<div>" ).dialog( "options", "modal", false ), | ||
wrapper = element.dialog( "widget" ); | ||
assert.equal( wrapper.attr( "aria-modal" ), "false", "aria-modal attribute set to false" ); | ||
element.remove(); | ||
|
||
var element = $( "<div>" ).dialog( "options", "modal", null ), | ||
wrapper = element.dialog( "widget" ); | ||
assert.equal( wrapper.attr( "aria-modal" ), null, "no aria-modal attribute added" ); | ||
element.remove(); | ||
} ); | ||
|
||
|
||
QUnit.test( "widget method", function( assert ) { | ||
assert.expect( 1 ); | ||
var dialog = $( "<div>" ).appendTo( "#qunit-fixture" ).dialog(); | ||
|
Uh oh!
There was an error while loading. Please reload this page.