2013-10-05 10:27:39 +00:00
|
|
|
/*!
|
2014-07-21 18:02:12 +00:00
|
|
|
* VisualEditor ContentEditable MediaWiki-specific Surface tests.
|
2013-10-05 10:27:39 +00:00
|
|
|
*
|
2014-01-05 12:05:05 +00:00
|
|
|
* @copyright 2011-2014 VisualEditor Team and others; see AUTHORS.txt
|
2013-10-05 10:27:39 +00:00
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
QUnit.module( 've.ce.Surface' );
|
|
|
|
|
|
|
|
/* Tests */
|
|
|
|
|
2014-10-10 09:20:35 +00:00
|
|
|
QUnit.test( 'handleLinearDelete', function ( assert ) {
|
2013-10-05 10:27:39 +00:00
|
|
|
var i,
|
|
|
|
cases = [
|
2014-09-18 20:15:24 +00:00
|
|
|
// This asserts that getRelativeRange (via getRelativeOffset) doesn't try to
|
|
|
|
// enter a handleOwnChildren node
|
2013-12-03 17:28:04 +00:00
|
|
|
{
|
2014-08-22 20:50:48 +00:00
|
|
|
html:
|
2013-12-03 17:28:04 +00:00
|
|
|
ve.dm.mwExample.MWBlockImage.html +
|
|
|
|
'<ul><li><p>Foo</p></li><li><p>Bar</p></li></ul>',
|
2014-08-22 20:50:48 +00:00
|
|
|
range: new ve.Range( 12 ),
|
|
|
|
operations: ['backspace'],
|
2013-12-03 17:28:04 +00:00
|
|
|
// TODO: This action should probably unwrap the list item as
|
2014-08-22 20:50:48 +00:00
|
|
|
expectedData: function () {},
|
|
|
|
expectedRange: new ve.Range( 12 ),
|
|
|
|
msg: 'Backspace in a list next to a block image doesn\'t merge into the caption'
|
2013-10-05 10:27:39 +00:00
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
QUnit.expect( cases.length * 2 );
|
|
|
|
|
|
|
|
for ( i = 0; i < cases.length; i++ ) {
|
2013-12-02 14:51:52 +00:00
|
|
|
ve.test.utils.runSurfaceHandleSpecialKeyTest(
|
2013-10-05 10:27:39 +00:00
|
|
|
assert, cases[i].html, cases[i].range, cases[i].operations,
|
|
|
|
cases[i].expectedData, cases[i].expectedRange, cases[i].msg
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} );
|