2012-07-19 00:11:26 +00:00
|
|
|
/**
|
|
|
|
* VisualEditor content editable tests.
|
2012-07-19 21:25:16 +00:00
|
|
|
*
|
2012-07-19 00:11:26 +00:00
|
|
|
* @copyright 2011-2012 VisualEditor Team and others; see AUTHORS.txt
|
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
2012-05-02 19:54:42 +00:00
|
|
|
module( 've.ce' );
|
|
|
|
|
|
|
|
/* Tests */
|
|
|
|
|
2012-07-10 19:46:08 +00:00
|
|
|
test( 'whitespacePattern', 4, function( assert ) {
|
|
|
|
assert.equal( 'a b'.match( ve.ce.whitespacePattern ), ' ', 'matches spaces' );
|
|
|
|
assert.equal( 'a\u00A0b'.match( ve.ce.whitespacePattern ), '\u00A0', 'matches non-breaking spaces' );
|
|
|
|
assert.equal( 'a\tb'.match( ve.ce.whitespacePattern ), null, 'does not match tab' );
|
|
|
|
assert.equal( 'ab'.match( ve.ce.whitespacePattern ), null, 'does not match non-whitespace' );
|
2012-05-02 19:54:42 +00:00
|
|
|
} );
|
|
|
|
|
2012-07-10 19:46:08 +00:00
|
|
|
test( 'getDOMText', 1, function( assert ) {
|
|
|
|
assert.equal( ve.ce.getDomText(
|
2012-05-02 19:54:42 +00:00
|
|
|
$( '<span>a<b><a href="#">b</a></b><span></span><i>c</i>d</span>' )[0] ),
|
|
|
|
'abcd'
|
|
|
|
);
|
|
|
|
} );
|
|
|
|
|
2012-07-10 19:46:08 +00:00
|
|
|
test( 'getDOMHash', 1, function( assert ) {
|
|
|
|
assert.equal(
|
2012-05-02 19:54:42 +00:00
|
|
|
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>'
|
|
|
|
);
|
|
|
|
} );
|