2023-08-21 08:08:23 +00:00
|
|
|
'use strict';
|
|
|
|
|
2016-02-05 20:54:55 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor DataModel Cite-specific Converter tests.
|
|
|
|
*
|
2018-01-03 01:05:45 +00:00
|
|
|
* @copyright 2011-2018 VisualEditor Team's Cite sub-team and others; see AUTHORS.txt
|
2017-12-29 12:12:35 +00:00
|
|
|
* @license MIT
|
2016-02-05 20:54:55 +00:00
|
|
|
*/
|
|
|
|
|
2022-03-04 13:49:50 +00:00
|
|
|
QUnit.module( 've.dm.Converter (Cite)', ve.test.utils.newMwEnvironment() );
|
2016-02-05 20:54:55 +00:00
|
|
|
|
|
|
|
QUnit.test( 'getModelFromDom', function ( assert ) {
|
2023-08-21 08:08:23 +00:00
|
|
|
const cases = ve.dm.citeExample.domToDataCases;
|
2016-02-05 20:54:55 +00:00
|
|
|
|
2023-08-21 08:08:23 +00:00
|
|
|
for ( const msg in cases ) {
|
|
|
|
const caseItem = ve.copy( cases[ msg ] );
|
2023-01-21 17:00:56 +00:00
|
|
|
caseItem.base = ve.dm.citeExample.baseUri;
|
|
|
|
caseItem.mwConfig = {
|
|
|
|
wgArticlePath: '/wiki/$1'
|
|
|
|
};
|
|
|
|
// TODO: Cite tests contain unescaped < in attrs, handle this upstream somehow
|
2022-01-10 14:21:44 +00:00
|
|
|
caseItem.ignoreXmlWarnings = true;
|
2016-02-05 20:54:55 +00:00
|
|
|
if ( caseItem.mwConfig ) {
|
|
|
|
mw.config.set( caseItem.mwConfig );
|
|
|
|
}
|
|
|
|
|
|
|
|
ve.test.utils.runGetModelFromDomTest( assert, caseItem, msg );
|
|
|
|
}
|
|
|
|
} );
|
|
|
|
|
|
|
|
QUnit.test( 'getDomFromModel', function ( assert ) {
|
2023-08-21 08:08:23 +00:00
|
|
|
const cases = ve.dm.citeExample.domToDataCases;
|
2016-02-05 20:54:55 +00:00
|
|
|
|
2023-08-21 08:08:23 +00:00
|
|
|
for ( const msg in cases ) {
|
|
|
|
const caseItem = ve.copy( cases[ msg ] );
|
2023-01-21 17:00:56 +00:00
|
|
|
caseItem.base = ve.dm.citeExample.baseUri;
|
|
|
|
caseItem.mwConfig = {
|
|
|
|
wgArticlePath: '/wiki/$1'
|
|
|
|
};
|
|
|
|
// TODO: Cite tests contain unescaped < in attrs, handle this upstream somehow
|
2022-01-10 14:21:44 +00:00
|
|
|
caseItem.ignoreXmlWarnings = true;
|
2016-02-05 20:54:55 +00:00
|
|
|
if ( caseItem.mwConfig ) {
|
|
|
|
mw.config.set( caseItem.mwConfig );
|
|
|
|
}
|
|
|
|
|
|
|
|
ve.test.utils.runGetDomFromModelTest( assert, caseItem, msg );
|
|
|
|
}
|
|
|
|
} );
|