2017-06-22 19:55:28 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor MediaWiki-specific ContentEditable Document tests.
|
|
|
|
*
|
2020-01-08 17:13:04 +00:00
|
|
|
* @copyright 2011-2020 VisualEditor Team and others; see http://ve.mit-license.org
|
2017-06-22 19:55:28 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
QUnit.module( 've.ce.Document (MW)' );
|
|
|
|
|
|
|
|
/* Tests */
|
|
|
|
|
2021-04-30 09:33:22 +00:00
|
|
|
QUnit.test( 'Converter tests', ( assert ) => {
|
2021-04-29 14:42:18 +00:00
|
|
|
const cases = ve.dm.mwExample.domToDataCases;
|
2017-06-22 19:55:28 +00:00
|
|
|
|
2021-04-29 14:42:18 +00:00
|
|
|
for ( const msg in cases ) {
|
2017-06-22 19:55:28 +00:00
|
|
|
if ( cases[ msg ].ceHtml ) {
|
2021-04-29 14:42:18 +00:00
|
|
|
const caseItem = ve.copy( cases[ msg ] ),
|
|
|
|
model = ve.test.utils.getModelFromTestCase( caseItem ),
|
|
|
|
view = new ve.ce.Document( model ),
|
|
|
|
$documentElement = view.getDocumentNode().$element;
|
2017-06-22 19:55:28 +00:00
|
|
|
// 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 ],
|
2023-01-21 16:30:47 +00:00
|
|
|
$( '<div>' ).html( caseItem.ceHtml )[ 0 ],
|
2017-06-22 19:55:28 +00:00
|
|
|
msg
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} );
|