-
Notifications
You must be signed in to change notification settings - Fork 40
Added Schema#limits and integrated it with data controller's modifySelection #825
Conversation
Please close together with ckeditor/ckeditor5-enter#39. |
…ly extended in the first test.
Also, one important thing to notice is that you check only the immediate parent of the selection (whether it's a block or not). We don't have yet a case for that but you may have: <caption><paragraph>^</paragraph></caption> And the selection must not be extended to the left in this case. |
More things:
|
I'm going to take over the PR from here, @szymonkups. |
Warning for the future (and fun fact too :P). The added test(
'should not extend to outside of inline limit element',
'<inlineLimit>foo[]</inlineLimit>',
'<inlineLimit>foo[]</inlineLimit>'
); (it was meant to test that the selection won't leave a "limit" element) It passed. At the same time, the CC dropped below 100%. So what's wrong here? Two things actually. First – if the test was written before the code was modified (TDD!) you'd know that it passes without any changes in the code. Why? Because the test is too limited. It tests the behaviour in too narrow context. Namely – the selection has no place to go wrong – there's no text outside the When writing such tests I'm very often adding some additional elements or text nodes at the both ends of the content. I also try many variations and one or two more complicated scenarios where more things could go wrong. This, even though might be a bit exaggerated at the beginning (because you can have 100% CC a lot earlier), makes sure the algorithm stays stable in the future, when some inevitable refactoring touches it. |
…positions where text can be placed. Covers most of #710 too.
Okey dokey, I added a lot of tests for all 3 functions – Based on my manual tests, all works fine now :). |
Suggested merge commit message (convention)
Feature: Added
Schema#limits
and integrated it with data controller's modifySelection. Closes ckeditor/ckeditor5#3983.