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
|
|
|
*
|
2016-01-03 22:56:59 +00:00
|
|
|
* @copyright 2011-2016 VisualEditor Team and others; see AUTHORS.txt
|
2013-06-26 21:18:39 +00:00
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
2015-05-17 09:37:34 +00:00
|
|
|
QUnit.module( 've.dm.Converter (MW)', ve.test.utils.mwEnvironment );
|
2015-02-17 13:03:59 +00:00
|
|
|
|
2013-12-04 17:37:50 +00:00
|
|
|
QUnit.test( 'getModelFromDom', function ( assert ) {
|
2014-01-15 03:15:37 +00:00
|
|
|
var msg, caseItem,
|
|
|
|
cases = ve.dm.mwExample.domToDataCases;
|
|
|
|
|
|
|
|
QUnit.expect( ve.test.utils.countGetModelFromDomTests( cases ) );
|
|
|
|
|
|
|
|
for ( msg in cases ) {
|
2015-08-19 17:33:02 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
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
|
|
|
} );
|
|
|
|
|
2013-11-25 15:10:49 +00:00
|
|
|
QUnit.test( 'getDomFromModel', function ( assert ) {
|
2014-01-15 03:15:37 +00:00
|
|
|
var msg, caseItem,
|
|
|
|
cases = ve.dm.mwExample.domToDataCases;
|
|
|
|
|
2015-03-10 12:50:42 +00:00
|
|
|
QUnit.expect( 3 * Object.keys( cases ).length );
|
2014-01-15 03:15:37 +00:00
|
|
|
|
|
|
|
for ( msg in cases ) {
|
2015-08-19 17:33:02 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
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
|
|
|
} );
|