Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
70 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* bender-tags: editor,unit */ | ||
/* bender-ckeditor-plugins: dialog,dialogui */ | ||
|
||
( function() { | ||
'use strict'; | ||
|
||
var container = new CKEDITOR.dom.element( 'div' ); | ||
|
||
bender.test( { | ||
'test CKEDITOR.ui.dialog.radio wai-aria role=radiogroup': function() { | ||
var htmlList = []; | ||
|
||
new CKEDITOR.ui.dialog.radio( this.getDialogMockup(), this.getMockupRadioDefinition(), htmlList ); | ||
|
||
container.setHtml( htmlList.join( '' ) ); | ||
|
||
var wrapper = container.findOne( '.cke_dialog_ui_radio' ); | ||
|
||
assert.areSame( 'radiogroup', wrapper.getAttribute( 'role' ), 'Role "radiogroup" for set for the container' ); | ||
}, | ||
|
||
'test CKEDITOR.ui.dialog.labeledElement wai-aria role': function() { | ||
var outputHtml = [], | ||
contentFunction = function() { return ''; }; | ||
|
||
new CKEDITOR.ui.dialog.labeledElement( this.getDialogMockup(), {}, outputHtml, contentFunction ); | ||
|
||
container.setHtml( outputHtml.join( '' ) ); | ||
|
||
var labeled = container.findOne( '.cke_dialog_ui_labeled_content' ); | ||
|
||
assert.areSame( 'presentation', labeled.getAttribute( 'role' ), 'Role "presentation" set for labeled content' ); | ||
}, | ||
|
||
// Returns the simplest possible radio dialog element definition. | ||
getMockupRadioDefinition: function() { | ||
return { | ||
items: [ | ||
// At least one item is required. | ||
[ 'val', 'label' ] | ||
], | ||
type: 'radio' | ||
}; | ||
}, | ||
|
||
// Returns the simplest possible object that mimics a `CKEDITOR.dialog` variable. | ||
getDialogMockup: function() { | ||
return { | ||
_: { | ||
focusList: [] | ||
}, | ||
on: function() {} | ||
}; | ||
} | ||
} ); | ||
} )(); |