mediawiki-extensions-Cite/tests/qunit/ve-cite/ve.dm.Converter.test.js
thiemowmde b02028b671 Move ve-cite QUnit tests to top-level tests/ directory
It's just hard to find and confusing when hidden in that
sub-directory.

Bug: T358851
Change-Id: I19ffe73b79fa9add52af12f477afe7abbc6db836
2024-04-03 12:03:33 +02:00

49 lines
1.3 KiB
JavaScript

'use strict';
/*!
* VisualEditor DataModel Cite-specific Converter tests.
*
* @copyright 2011-2018 VisualEditor Team's Cite sub-team and others; see AUTHORS.txt
* @license MIT
*/
QUnit.module( 've.dm.Converter (Cite)', ve.test.utils.newMwEnvironment() );
QUnit.test( 'getModelFromDom', function ( assert ) {
const cases = ve.dm.citeExample.domToDataCases;
for ( const msg in cases ) {
const caseItem = ve.copy( cases[ msg ] );
caseItem.base = ve.dm.citeExample.baseUri;
caseItem.mwConfig = {
wgArticlePath: '/wiki/$1'
};
// TODO: Cite tests contain unescaped < in attrs, handle this upstream somehow
caseItem.ignoreXmlWarnings = true;
if ( caseItem.mwConfig ) {
mw.config.set( caseItem.mwConfig );
}
ve.test.utils.runGetModelFromDomTest( assert, caseItem, msg );
}
} );
QUnit.test( 'getDomFromModel', function ( assert ) {
const cases = ve.dm.citeExample.domToDataCases;
for ( const msg in cases ) {
const caseItem = ve.copy( cases[ msg ] );
caseItem.base = ve.dm.citeExample.baseUri;
caseItem.mwConfig = {
wgArticlePath: '/wiki/$1'
};
// TODO: Cite tests contain unescaped < in attrs, handle this upstream somehow
caseItem.ignoreXmlWarnings = true;
if ( caseItem.mwConfig ) {
mw.config.set( caseItem.mwConfig );
}
ve.test.utils.runGetDomFromModelTest( assert, caseItem, msg );
}
} );