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
167 additions
and
34 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,36 @@ | ||
var lineutilsTestsTools = ( function() { | ||
'use strict'; | ||
|
||
return { | ||
/** | ||
* Asserts relations created by CKEDITOR.plugins.lineutils#finder method. | ||
* | ||
* @param {CKEDITOR.editor} editor Editor instance. | ||
* @param {CKEDITOR.plugins.lineutils.finder} finder Finder instance after search (when finder#relations is present). | ||
* @param {String} expected Expected HTML with relations marked by "|". | ||
*/ | ||
assertRelations: function( editor, finder, expected ) { | ||
var current, range, | ||
ranges = [], | ||
relations = finder.relations; | ||
|
||
for ( var r in relations ) { | ||
current = relations[ r ]; | ||
|
||
if ( current.type & CKEDITOR.LINEUTILS_BEFORE ) | ||
ranges.push( finder.getRange( { uid: r, type: CKEDITOR.LINEUTILS_BEFORE } ) ); | ||
|
||
if ( current.type & CKEDITOR.LINEUTILS_AFTER ) | ||
ranges.push( finder.getRange( { uid: r, type: CKEDITOR.LINEUTILS_AFTER } ) ); | ||
|
||
if ( current.type & CKEDITOR.LINEUTILS_INSIDE ) | ||
ranges.push( finder.getRange( { uid: r, type: CKEDITOR.LINEUTILS_INSIDE } ) ); | ||
|
||
while ( ( range = ranges.pop() ) ) | ||
range.insertNode( new CKEDITOR.dom.comment( 'R' ) ); | ||
} | ||
|
||
assert.areSame( expected, editor.getData().replace( /<!--R-->/gi, '|' ), 'Relations discovered, collected and normalized correctly.' ); | ||
} | ||
}; | ||
} )(); |
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,6 @@ | ||
<head> | ||
<script src="_helpers/tools.js"></script> | ||
</head> | ||
<body> | ||
|
||
</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
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