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
5 changed files
with
110 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,17 @@ | ||
<body> | ||
<div> | ||
<textarea></textarea> | ||
</div> | ||
<div id="classic"> | ||
<p>Example text</p> | ||
</div> | ||
|
||
<div id="inline"> | ||
<p>Example text</p> | ||
</div> | ||
|
||
<script> | ||
CKEDITOR.replace( 'classic', { readOnly: true } ); | ||
CKEDITOR.inline( 'inline', { readOnly: true } ); | ||
</script> | ||
</body> |
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,23 @@ | ||
@bender-tags: tc, 4.5.5, 13782, editor | ||
@bender-ui: collapsed | ||
@bender-ckeditor-plugins: wysiwygarea, clipboard, toolbar, floatingspace | ||
|
||
---- | ||
|
||
1. Select some text in the first editor. | ||
2. Press `CTRL + X`. | ||
3. Try to paste into the textarea above the editors. | ||
|
||
**Expected:** | ||
* Text shouldn't be removed from editor. | ||
* Text selected in the editor shouldn't be pasted into the textarea. | ||
|
||
---- | ||
|
||
1. Select some text in the second editor. | ||
2. Press `CTRL + X`. | ||
3. Try to paste into the textarea above the editors. | ||
|
||
**Expected:** | ||
* Text shouldn't be removed from editor. | ||
* Text selected in the editor shouldn't be pasted into the textarea. |
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,61 @@ | ||
/* bender-tags: editor, clipboard, 13872 */ | ||
/* bender-ckeditor-plugins: toolbar, clipboard */ | ||
|
||
'use strict'; | ||
|
||
bender.editors = { | ||
classic: { | ||
config: { | ||
readOnly: true | ||
} | ||
}, | ||
classic_editable: {}, | ||
inline: { | ||
creator: 'inline', | ||
config: { | ||
readOnly: true | ||
} | ||
}, | ||
inline_editable: { | ||
creator: 'inline' | ||
} | ||
}; | ||
|
||
var tests = { | ||
setUp: function() { | ||
// The native handling of copy/cut doesn't have such problems. | ||
if ( !CKEDITOR.plugins.clipboard.isCustomCopyCutSupported ) { | ||
assert.ignore(); | ||
} | ||
|
||
this.initPasteSpy = sinon.spy( CKEDITOR.plugins.clipboard, 'initPasteDataTransfer' ); | ||
}, | ||
|
||
tearDown: function() { | ||
this.initPasteSpy.restore(); | ||
}, | ||
|
||
'test if cut is prevented depending on read-only mode': function( editor, bot ) { | ||
var content = '<p>[Some] text</p>', | ||
expected = editor.readOnly ? content : '<p>^ text</p>'; | ||
|
||
bot.setHtmlWithSelection( content ); | ||
|
||
editor.editable().fire( 'cut', new CKEDITOR.dom.event( {} ) ); | ||
|
||
assert.areSame( expected, bot.htmlWithSelection() ); | ||
assert.areSame( !editor.readOnly, CKEDITOR.plugins.clipboard.initPasteDataTransfer.called, 'initPasteDataTransfer call' ); | ||
}, | ||
|
||
'test copy depending on read-only mode': function( editor, bot ) { | ||
bot.setHtmlWithSelection( '<p>[Some] text</p>' ); | ||
|
||
editor.editable().fire( 'copy', new CKEDITOR.dom.event( {} ) ); | ||
|
||
assert.areSame( true, CKEDITOR.plugins.clipboard.initPasteDataTransfer.called, 'initPasteDataTransfer call' ); | ||
} | ||
}; | ||
|
||
tests = bender.tools.createTestsForEditors( CKEDITOR.tools.objectKeys( bender.editors ), tests ); | ||
|
||
bender.test( tests ); |