mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-20 10:11:12 +00:00
e40b73ef57
New changes: 2201b350c Localisation updates from https://translatewiki.net. da74736c1 Remove unused test code d1b016e90 Minor test tweaks 551de4f0c Specify document base URLs in more test cases Local changes: * Specify document base URLs in more test cases Change-Id: I0e301bef38d97fa2234aa901c787360d9fbde8a3
32 lines
977 B
JavaScript
32 lines
977 B
JavaScript
/*!
|
|
* VisualEditor MediaWiki-specific ContentEditable Document tests.
|
|
*
|
|
* @copyright 2011-2020 VisualEditor Team and others; see http://ve.mit-license.org
|
|
*/
|
|
|
|
QUnit.module( 've.ce.Document (MW)' );
|
|
|
|
/* Tests */
|
|
|
|
QUnit.test( 'Converter tests', ( assert ) => {
|
|
const cases = ve.dm.mwExample.domToDataCases;
|
|
|
|
for ( const msg in cases ) {
|
|
if ( cases[ msg ].ceHtml ) {
|
|
const caseItem = ve.copy( cases[ msg ] );
|
|
caseItem.base = caseItem.base || ve.dm.mwExample.baseUri;
|
|
const model = ve.test.utils.getModelFromTestCase( caseItem );
|
|
const view = new ve.ce.Document( model );
|
|
const $documentElement = view.getDocumentNode().$element;
|
|
// Simplify slugs
|
|
$documentElement.find( '.ve-ce-branchNode-slug' ).contents().remove();
|
|
assert.equalDomElement(
|
|
// Wrap both in plain DIVs as we are only comparing the child nodes
|
|
$( '<div>' ).append( $documentElement.contents() )[ 0 ],
|
|
$( '<div>' ).html( caseItem.ceHtml )[ 0 ],
|
|
msg
|
|
);
|
|
}
|
|
}
|
|
} );
|