mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-22 02:53:04 +00:00
346216c050
This patch is mostly about the arrow syntax. Some places can not be updated because the arrow syntax also changes the meaning of `this.…`, but some code relies on that. Change-Id: Ida3ab0e0950a428fbd1a85f281013778ee879df4
31 lines
948 B
JavaScript
31 lines
948 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>' ).append( ve.createDocumentFromHtml( caseItem.ceHtml ).body.childNodes )[ 0 ],
|
|
msg
|
|
);
|
|
}
|
|
}
|
|
} );
|