#11393 closed Bug (fixed)
Regression in link/link.html test
| Reported by: | Piotrek Koszuliński | Owned by: | Piotrek Koszuliński |
|---|---|---|---|
| Priority: | Normal | Milestone: | CKEditor 4.3.2 |
| Component: | General | Version: | 4.3.2 |
| Keywords: | Cc: |
Description (last modified by )
First bad commit git:f905c2d3.
Test named "test create link on a non-editable inline element" failed with error: "Unexpected error: Index or size was negative, or greater than the allowed value.".
The problem is caused by DOM being overwritten in the test (with editable.setHtml()). It does not trigger any selection change event, so editor._.hiddenSelectionContainer still exists, however, container is not present in DOM.
In this case it's more test issue than real bug. But making this bulletproof will not harm anything.
Change History (4)
comment:1 Changed 12 years ago by
| Owner: | set to Piotrek Koszuliński |
|---|---|
| Status: | new → assigned |
comment:2 Changed 12 years ago by
| Description: | modified (diff) |
|---|---|
| Status: | assigned → review |
comment:3 Changed 12 years ago by
| Status: | review → review_failed |
|---|
I rebased both branches on latest master and pushed a small fix to tests.
This change requires a word of comment since it's hard to figure out that hiddenSelectionContainer is no longer in DOM:
if ( range.endContainer.equals( root ) )
- range.endOffset = Math.min( range.endOffset, hiddenSelectionContainerIndex );
+ range.endOffset = Math.min( range.endOffset, root.getChildCount() );
}
Regarding tests
assert.isMatching( // getHtmlWithRanges processes selections anchored on blocks incorrectly. /^(<p>\[<\/p>)?<p>\[?abc\]?<\/p>(<p>\]<\/p>)?$/i, html, 'Selection contains entire editable contents' ); // Be sure the selection is really there - regexp doesn't check it. assert.isTrue( !!html.match( /\[/ ) && !!html.match( /\]/ ), 'Selection exists' );
Oh dude, come on :P
Use:
assert.isMatching( // getHtmlWithRanges processes selections anchored on blocks incorrectly. /(^<p>\[abc\]</p>$)|(^<p>\[</p><p>abc</p><p>\]</p>$)/i, html, 'Selection contains entire editable contents' );
comment:4 Changed 12 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | review_failed → closed |
Added comment and simplified comparisons in tests.
Fixed on master with git:40be3ec on dev and 0557518 on tests.

Pushed t/11393 on dev and tests.