mediawiki-extensions-Visual.../modules/ve-mw/tests/ce/ve.ce.Document.test.js
Bartosz Dziewoński 0689e9247f Minor test tweaks
Change-Id: Ib20f9665534873bd1d5963664399459d3f5b4234
2023-01-21 19:15:51 +01:00

31 lines
901 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 ] ),
model = ve.test.utils.getModelFromTestCase( caseItem ),
view = new ve.ce.Document( model ),
$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
);
}
}
} );