-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fixed: fake selection allows for removing in a readonly mode #1525
Conversation
tests/core/selection/selection.js
Outdated
|
||
editor.setReadOnly( true ); | ||
|
||
bot.setData( '<p>[[placeholder]]</p>', function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please restore editor readOnly state back to false
as any subsequent TCs would be fired on readonly instance (which is unexpected).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that the only existing issue is the one already mentioned by @mlewand.
tests/core/selection/selection.js
Outdated
} ); | ||
|
||
// Teardown | ||
editor.setReadOnly( false ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If test fails, the editor will remain read only. I'd rather move it to tearDown
function.
What's more, due to the fact that bot.setData
is async and how YUITest works, this line won't be ever executed (async in YUITest is based on throwing exceptions and handling them).
tests/core/selection/selection.js
Outdated
@@ -785,5 +786,25 @@ bender.test( { | |||
bender.tools.setHtmlWithSelection( editor, '<p>T^es^t</p>' ); | |||
|
|||
assert.isFalse( editor.getSelection().isCollapsed() ); | |||
}, | |||
|
|||
'test delete/backspace keys are not removing readonly selection': function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this test should be moved to fake.js
file (as it's connected with fake – not real – selection).
Also please add ticket reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test does not work in IE8 – error is thrown instead.
CHANGES.md
Outdated
@@ -24,6 +24,7 @@ Fixed Issues: | |||
* [#1356](https://github.com/ckeditor/ckeditor-dev/issues/1356): Fixed: [Border parse function](https://docs.ckeditor.com/ckeditor4/docs/#!/api/CKEDITOR.tools.style.parse-method-border) should allow spaces in the color value. | |||
* [#1426](https://github.com/ckeditor/ckeditor-dev/issues/1426): [IE8-9] Fixed: Missing balloon toolbar background in Kama skin. Thanks to [Christian Elmer](https://github.com/keinkurt)! | |||
* [#1010](https://github.com/ckeditor/ckeditor-dev/issues/1010): Fixed: CSS `border` shorthand property was incorrectly expanded ignoring `border-color` style. | |||
* [#1516](https://github.com/ckeditor/ckeditor-dev/issues/1516): Fixed: Selection allows for removing in a readonly mode using `backspace/delete` keys. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add info that it's a fake selection.
core/selection.js
Outdated
@@ -526,6 +526,10 @@ | |||
range = editor.createRange(), | |||
found; | |||
|
|||
if ( editor.readOnly ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add reference to the issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One, super small tweak and it's ready!
@@ -0,0 +1,16 @@ | |||
@bender-tags: selection, fake, widget, 4.9.0, bug, 1516 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please ignore also this test as it also does not work at all in IE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
What is the purpose of this pull request?
Bug fix.
Does your PR contain necessary tests?
All patches which change the editor code must include tests. You can always read more
on PR testing,
how to set the testing environment and
how to create tests
in the official CKEditor documentation.
This PR contains
What changes did you make?
Disabled deleting selection in a readonly mode for fake selection.
Closes #1516