mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 18:39:52 +00:00
8bd0d385eb
* Also fixed some naming typos in the units under test Change-Id: I17f753a122f94dd16f7783f60b5c0eb1c6d3e480
25 lines
778 B
JavaScript
25 lines
778 B
JavaScript
module( 've.ce' );
|
|
|
|
/* Tests */
|
|
|
|
test( 'whitespacePattern', 4, function() {
|
|
equal( 'a b'.match( ve.ce.whitespacePattern ), ' ', 'matches spaces' );
|
|
equal( 'a\u00A0b'.match( ve.ce.whitespacePattern ), '\u00A0', 'matches non-breaking spaces' );
|
|
equal( 'a\tb'.match( ve.ce.whitespacePattern ), null, 'does not match tab' );
|
|
equal( 'ab'.match( ve.ce.whitespacePattern ), null, 'does not match non-whitespace' );
|
|
} );
|
|
|
|
test( 'getDOMText', 1, function() {
|
|
equal( ve.ce.getDomText(
|
|
$( '<span>a<b><a href="#">b</a></b><span></span><i>c</i>d</span>' )[0] ),
|
|
'abcd'
|
|
);
|
|
} );
|
|
|
|
test( 'getDOMHash', 1, function() {
|
|
equal(
|
|
ve.ce.getDomHash( $( '<span>a<b><a href="#">b</a></b><span></span><i>c</i>d</span>' )[0] ),
|
|
'<SPAN>#<B><A>#</A></B><SPAN></SPAN><I>#</I>#</SPAN>'
|
|
);
|
|
} );
|