Dialog: Add aria-modal support by rpkoller · Pull Request #2257 · jquery/jquery-ui (original) (raw)
It's option
, not options
, but you can see in checks on this PR you're getting test failures like:
cannot call methods on dialog prior to initialization; attempted to call method 'options'
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 _setOption
method of the dialog. Find it in the file, you'll need to add:
if ( key === "modal" ) {
uiDialog.attr( "aria-modal", value ? "true" : null );
}
in there. Unfortunately, it seems the one in _createWrapper
is needed as well.
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 modal
set to true
: .dialog( { modal: true } )
; one when it's set to false
, and one when no options are passed: .dialog()
(you still need to initialize like that before calling .dialog( "option", "modal", true )
!)
And then, within each of those sections, first do a proper assertion and then call .dialog( "options", "modal", VALUE )
substituting VALUE
for these three options and check again if the value is as expected. That should give you total 12 assertions in this test.