mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-04 18:58:37 +00:00
5c0344aeda
* Make ve.ce.MWBlockImageNode autofocus=false, remove unused transition property * Remove ignoreChildren from ve.dm.MWBlockImageNode based on new definition * Remove tests which assert that deleting in a list next to a block image always de-indents. If this is desired behaviour it should be fixed without reference to ignoreChildren. Bug: T295905 Depends-On: Idc0cccbe73d1b49d07b60c14a192a40f47d64608 Change-Id: Ib79a070f5d36dbe7742fa0760f8cdf55fe3046ed
53 lines
2.2 KiB
JavaScript
53 lines
2.2 KiB
JavaScript
/*!
|
|
* VisualEditor MediaWiki-specific ContentEditable Surface tests.
|
|
*
|
|
* @copyright 2011-2020 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( 'beforePaste/afterPaste', ( assert ) => {
|
|
const cases = [
|
|
{
|
|
documentHtml: '<p></p>',
|
|
rangeOrSelection: new ve.Range( 1 ),
|
|
pasteHtml: '<span typeof="mw:Entity" id="mwAB">-</span><span typeof="mw:Entity" id="mw-reference-cite">-</span>',
|
|
fromVe: true,
|
|
expectedRangeOrSelection: new ve.Range( 5 ),
|
|
expectedHtml: '<p><span typeof="mw:Entity">-</span><span typeof="mw:Entity" id="mw-reference-cite">-</span></p>',
|
|
msg: 'RESTBase IDs stripped'
|
|
},
|
|
{
|
|
documentHtml: '<p></p>',
|
|
rangeOrSelection: new ve.Range( 1 ),
|
|
pasteHtml: '<span typeof="mw:Entity" id="mwAB">-</span><span typeof="mw:Entity" id="mw-reference-cite">-</span>',
|
|
pasteTargetHtml: '<span>-</span><span>-</span>',
|
|
fromVe: true,
|
|
expectedRangeOrSelection: new ve.Range( 5 ),
|
|
expectedHtml: '<p><span typeof="mw:Entity">-</span><span typeof="mw:Entity" id="mw-reference-cite">-</span></p>',
|
|
msg: 'RESTBase IDs still stripped if used when important attributes dropped'
|
|
},
|
|
{
|
|
documentHtml: '<p></p>',
|
|
rangeOrSelection: new ve.Range( 1 ),
|
|
pasteHtml: 'a<sup id="cite_ref-1" class="reference"><a href="./Article#cite_note-1">[1]</a></sup>b',
|
|
expectedRangeOrSelection: new ve.Range( 3 ),
|
|
expectedHtml: '<p>ab</p>',
|
|
msg: 'Read mode references stripped'
|
|
},
|
|
{
|
|
documentHtml: '<p></p>',
|
|
rangeOrSelection: new ve.Range( 1 ),
|
|
pasteHtml: 'a<sup typeof="mw:Extension/ref" data-mw="{}" class="mw-ref reference" about="#mwt1" id="cite_ref-foo-0" rel="dc:references"><a href="./Article#cite_note-foo-0"><span class="mw-reflink-text ve-pasteProtect">[1]</span></a></sup>b',
|
|
expectedRangeOrSelection: new ve.Range( 5 ),
|
|
expectedHtml: '<p>a<sup typeof="mw:Extension/ref" data-mw="{"name":"ref"}" class="mw-ref reference"><a style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>b</p>',
|
|
msg: 'VE references not stripped'
|
|
}
|
|
];
|
|
|
|
cases.forEach( ve.test.utils.runSurfacePasteTest.bind( this, assert ) );
|
|
} );
|