/*! * VisualEditor MediaWiki-specific ContentEditable Surface tests. * * @copyright 2011-2018 VisualEditor Team and others; see AUTHORS.txt * @license The MIT License (MIT); see LICENSE.txt */ QUnit.module( 've.ce.Surface (MW)', ve.test.utils.mwEnvironment ); /* Tests */ QUnit.test( 'handleLinearDelete', function ( assert ) { var done = assert.async(), promise = Promise.resolve(), blocklength = ve.dm.mwExample.MWBlockImage.data.length, cases = [ // This asserts that getRelativeRange (via getRelativeOffset) doesn't try to // enter a handleOwnChildren node { htmlOrDoc: ve.dm.mwExample.MWBlockImage.html + '
Foo
Bar
--
', msg: 'RESTBase IDs stripped' }, { documentHtml: '', rangeOrSelection: new ve.Range( 1 ), pasteHtml: '--', pasteTargetHtml: '--', fromVe: true, expectedRangeOrSelection: new ve.Range( 5 ), expectedHtml: '--
', msg: 'RESTBase IDs still stripped if used when important attributes dropped' } ]; for ( i = 0; i < cases.length; i++ ) { ve.test.utils.runSurfacePasteTest( /* assert */ assert, /* htmlOrView */ cases[ i ].documentHtml, /* pasteData */ { 'text/html': cases[ i ].pasteHtml, 'text/plain': cases[ i ].pasteText }, /* internalSourceRangeOrSelection */ cases[ i ].internalSourceRangeOrSelection, /* noClipboardData */ cases[ i ].noClipboardData, /* fromVe */ cases[ i ].fromVe, /* useClipboardData */ cases[ i ].useClipboardData, /* pasteTargetHtml */ cases[ i ].pasteTargetHtml, /* rangeOrSelection */ cases[ i ].rangeOrSelection, /* pasteSpecial */ cases[ i ].pasteSpecial, /* expectedOps */ cases[ i ].expectedOps, /* expectedRangeOrSelection */ cases[ i ].expectedRangeOrSelection, /* expectedHtml */ cases[ i ].expectedHtml, /* expectedDefaultPrevented */ cases[ i ].expectedDefaultPrevented, /* store */ cases[ i ].store, /* msg */ cases[ i ].msg ); } } );