mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-27 15:50:29 +00:00
Merge "SurfaceFragment tests: Put isolateAndUnwrap tests in a loop"
This commit is contained in:
commit
053ef03c8c
|
@ -10,22 +10,36 @@ QUnit.module( 've.dm.SurfaceFragment (MW)', ve.test.utils.newMwEnvironment() );
|
|||
/* Tests */
|
||||
|
||||
QUnit.test( 'isolateAndUnwrap (MWheading)', ( assert ) => {
|
||||
ve.test.utils.runIsolateTest( assert, 'mwHeading', new ve.Range( 12, 20 ), ( data ) => {
|
||||
data.splice( 11, 0, { type: '/list' } );
|
||||
data.splice( 12, 1 );
|
||||
data.splice( 20, 1, { type: 'list', attributes: { style: 'bullet' } } );
|
||||
}, ve.dm.mwExample.baseUri, 'isolating paragraph in list item "Item 2" for MWheading' );
|
||||
|
||||
ve.test.utils.runIsolateTest( assert, 'mwHeading', new ve.Range( 202, 212 ), ( data ) => {
|
||||
data.splice( 201, 1,
|
||||
{ type: '/list' }, { type: '/listItem' }, { type: '/list' }
|
||||
);
|
||||
data.splice( 214, 1,
|
||||
{ type: 'list', attributes: { style: 'bullet' } },
|
||||
{ type: 'listItem' },
|
||||
{ type: 'list', attributes: { style: 'number' } }
|
||||
);
|
||||
}, ve.dm.mwExample.baseUri, 'isolating paragraph in list item "Nested 2" for MWheading' );
|
||||
const cases = [
|
||||
{
|
||||
type: 'mwHeading',
|
||||
range: new ve.Range( 12, 20 ),
|
||||
expected: ( data ) => {
|
||||
data.splice( 11, 0, { type: '/list' } );
|
||||
data.splice( 12, 1 );
|
||||
data.splice( 20, 1, { type: 'list', attributes: { style: 'bullet' } } );
|
||||
},
|
||||
base: ve.dm.mwExample.baseUri,
|
||||
msg: 'isolating paragraph in list item "Item 2" for MWheading'
|
||||
},
|
||||
{
|
||||
type: 'mwHeading',
|
||||
range: new ve.Range( 202, 212 ),
|
||||
expected: ( data ) => {
|
||||
data.splice( 201, 1,
|
||||
{ type: '/list' }, { type: '/listItem' }, { type: '/list' }
|
||||
);
|
||||
data.splice( 214, 1,
|
||||
{ type: 'list', attributes: { style: 'bullet' } },
|
||||
{ type: 'listItem' },
|
||||
{ type: 'list', attributes: { style: 'number' } }
|
||||
);
|
||||
},
|
||||
base: ve.dm.mwExample.baseUri,
|
||||
msg: 'isolating paragraph in list item "Nested 2" for MWheading'
|
||||
}
|
||||
];
|
||||
cases.forEach( ( caseItem ) => ve.test.utils.runIsolateTest( assert, caseItem ) );
|
||||
} );
|
||||
|
||||
QUnit.test( 'insertContent (MWheading)', ( assert ) => {
|
||||
|
|
Loading…
Reference in a new issue