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
7 changed files
with
223 additions
and
16 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
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,62 @@ | ||
/* bender-tags: editor,unit */ | ||
/* bender-ckeditor-plugins: toolbar */ | ||
|
||
( function() { | ||
'use strict'; | ||
|
||
bender.test( { | ||
'test editor#ariaEditorHelpLabel event - handled': function() { | ||
var fired = 0; | ||
|
||
bender.editorBot.create( { | ||
name: 'editor1', | ||
creator: 'inline', | ||
config: { | ||
removePlugins: 'a11yhelp', | ||
on: { | ||
pluginsLoaded: function() { | ||
this.on( 'ariaEditorHelpLabel', function( evt ) { | ||
evt.data.label = 'foo'; | ||
fired += 1; | ||
} ); | ||
} | ||
} | ||
} | ||
}, function( bot ) { | ||
var editor = bot.editor, | ||
describedBy = editor.editable().getAttribute( 'aria-describedby' ); | ||
|
||
assert.areSame( 1, fired, 'event was fired once' ); | ||
assert.isNotNull( describedBy, 'editable has aria-describedby attribute' ); | ||
var label = editor.ui.space( 'top' ).findOne( '#' + describedBy ); | ||
assert.isNotNull( label, 'label element exists within top space' ); | ||
assert.areSame( 'foo', label.getHtml(), 'label\'s content' ); | ||
} ); | ||
}, | ||
|
||
'test editor#ariaEditorHelpLabel event - unhandled': function() { | ||
var fired = 0; | ||
|
||
bender.editorBot.create( { | ||
name: 'editor2', | ||
creator: 'inline', | ||
config: { | ||
removePlugins: 'a11yhelp', | ||
on: { | ||
pluginsLoaded: function() { | ||
this.on( 'ariaEditorHelpLabel', function( evt ) { | ||
fired += 1; | ||
} ); | ||
} | ||
} | ||
} | ||
}, function( bot ) { | ||
var editor = bot.editor, | ||
describedBy = editor.editable().getAttribute( 'aria-describedby' ); | ||
|
||
assert.areSame( 1, fired, 'event was fired once' ); | ||
assert.isNull( describedBy, 'editable does not have has aria-describedby attribute' ); | ||
} ); | ||
} | ||
} ); | ||
} )(); |
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,50 @@ | ||
/* bender-tags: editor,unit,a11yhelp */ | ||
/* bender-ckeditor-plugins: toolbar */ | ||
|
||
( function() { | ||
'use strict'; | ||
|
||
bender.test( { | ||
'async:init': function() { | ||
var that = this; | ||
|
||
bender.tools.setUpEditors( { | ||
withA11y: { | ||
name: 'editor1', | ||
creator: 'inline', | ||
config: { | ||
extraPlugins: 'a11yhelp' | ||
} | ||
}, | ||
withoutA11y: { | ||
name: 'editor2', | ||
creator: 'inline', | ||
config: { | ||
removePlugins: 'a11yhelp' | ||
} | ||
} | ||
}, function( editors, bots ) { | ||
that.editorBots = bots; | ||
that.editors = editors; | ||
that.callback(); | ||
} ); | ||
}, | ||
|
||
'test editor with a11y plugin has aria-describedby': function() { | ||
var editor = this.editors.withA11y, | ||
describedBy = editor.editable().getAttribute( 'aria-describedby' ); | ||
|
||
assert.isNotNull( describedBy, 'editable has aria-describedby attribute' ); | ||
var label = CKEDITOR.document.getById( describedBy ); | ||
assert.isNotNull( label, 'label element exists' ); | ||
assert.areSame( editor.lang.common.editorHelp, label.getHtml(), 'label\'s content' ); | ||
}, | ||
|
||
'test editor without a11y plugin has aria-describedby': function() { | ||
var editor = this.editors.withoutA11y, | ||
describedBy = editor.editable().getAttribute( 'aria-describedby' ); | ||
|
||
assert.isNull( describedBy, 'editable does not have aria-describedby attribute' ); | ||
} | ||
} ); | ||
} )(); |
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,63 @@ | ||
/* bender-tags: editor,unit */ | ||
/* bender-ckeditor-plugins: toolbar */ | ||
|
||
( function() { | ||
'use strict'; | ||
|
||
bender.test( { | ||
'test editor#ariaEditorHelpLabel event - handled': function() { | ||
var fired = 0; | ||
|
||
bender.editorBot.create( { | ||
name: 'editor1', | ||
config: { | ||
removePlugins: 'a11yhelp', | ||
on: { | ||
pluginsLoaded: function() { | ||
this.on( 'ariaEditorHelpLabel', function( evt ) { | ||
evt.data.label = 'foo'; | ||
fired += 1; | ||
} ); | ||
} | ||
} | ||
} | ||
}, function( bot ) { | ||
var editor = bot.editor, | ||
iframe = editor.window.getFrame(), | ||
describedBy = iframe.getAttribute( 'aria-describedby' ); | ||
|
||
assert.areSame( 1, fired, 'event was fired once' ); | ||
assert.isNotNull( describedBy, 'iframe has aria-describedby attribute' ); | ||
var label = editor.ui.space( 'contents' ).findOne( '#' + describedBy ); | ||
assert.isNotNull( label, 'label element exists within top space' ); | ||
assert.areSame( 'foo', label.getHtml(), 'label\'s content' ); | ||
if ( CKEDITOR.env.ie ) | ||
assert.areSame( editor.title + ', foo', iframe.getAttribute( 'title' ), 'on IE title contains label' ); | ||
} ); | ||
}, | ||
|
||
'test editor#ariaEditorHelpLabel event - not handled': function() { | ||
var fired = 0; | ||
|
||
bender.editorBot.create( { | ||
name: 'editor2', | ||
config: { | ||
removePlugins: 'a11yhelp', | ||
on: { | ||
pluginsLoaded: function() { | ||
this.on( 'ariaEditorHelpLabel', function( evt ) { | ||
fired += 1; | ||
} ); | ||
} | ||
} | ||
} | ||
}, function( bot ) { | ||
var editor = bot.editor, | ||
describedBy = editor.window.getFrame().getAttribute( 'aria-describedby' ); | ||
|
||
assert.areSame( 1, fired, 'event was fired once' ); | ||
assert.isNull( describedBy, 'iframe does not have aria-describedby attribute' ); | ||
} ); | ||
} | ||
} ); | ||
} )(); |