2013-06-26 21:18:39 +00:00
|
|
|
/*!
|
2014-03-03 14:10:06 +00:00
|
|
|
* VisualEditor DataModel MediaWiki-specific Converter tests.
|
2013-06-26 21:18:39 +00:00
|
|
|
*
|
2020-01-08 17:13:04 +00:00
|
|
|
* @copyright 2011-2020 VisualEditor Team and others; see AUTHORS.txt
|
2013-06-26 21:18:39 +00:00
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
2022-03-04 13:48:14 +00:00
|
|
|
QUnit.module( 've.dm.Converter (MW)', ve.test.utils.newMwEnvironment() );
|
2015-02-17 13:03:59 +00:00
|
|
|
|
2021-04-30 09:33:22 +00:00
|
|
|
QUnit.test( 'getModelFromDom', ( assert ) => {
|
2021-04-29 14:42:18 +00:00
|
|
|
const cases = ve.dm.mwExample.domToDataCases;
|
2014-01-15 03:15:37 +00:00
|
|
|
|
2021-04-29 14:42:18 +00:00
|
|
|
for ( const msg in cases ) {
|
|
|
|
const caseItem = ve.copy( cases[ msg ] );
|
2014-01-15 03:15:37 +00:00
|
|
|
if ( caseItem.mwConfig ) {
|
2014-06-11 16:19:53 +00:00
|
|
|
mw.config.set( caseItem.mwConfig );
|
2014-01-15 03:15:37 +00:00
|
|
|
}
|
2023-01-21 17:00:26 +00:00
|
|
|
caseItem.base = caseItem.base || ve.dm.mwExample.baseUri;
|
2014-01-15 03:15:37 +00:00
|
|
|
|
2014-03-12 23:02:41 +00:00
|
|
|
ve.test.utils.runGetModelFromDomTest( assert, caseItem, msg );
|
2014-01-15 03:15:37 +00:00
|
|
|
}
|
2013-06-26 21:18:39 +00:00
|
|
|
} );
|
|
|
|
|
2021-04-30 09:33:22 +00:00
|
|
|
QUnit.test( 'getDomFromModel', ( assert ) => {
|
2021-04-29 14:42:18 +00:00
|
|
|
const cases = ve.dm.mwExample.domToDataCases;
|
2014-01-15 03:15:37 +00:00
|
|
|
|
2021-04-29 14:42:18 +00:00
|
|
|
for ( const msg in cases ) {
|
|
|
|
const caseItem = ve.copy( cases[ msg ] );
|
2014-01-15 03:15:37 +00:00
|
|
|
if ( caseItem.mwConfig ) {
|
2014-06-11 16:19:53 +00:00
|
|
|
mw.config.set( caseItem.mwConfig );
|
2014-01-15 03:15:37 +00:00
|
|
|
}
|
2023-01-21 17:00:26 +00:00
|
|
|
caseItem.base = caseItem.base || ve.dm.mwExample.baseUri;
|
2014-01-15 03:15:37 +00:00
|
|
|
|
2014-03-12 23:02:41 +00:00
|
|
|
ve.test.utils.runGetDomFromModelTest( assert, caseItem, msg );
|
2014-01-15 03:15:37 +00:00
|
|
|
}
|
2013-06-26 21:18:39 +00:00
|
|
|
} );
|