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
|
|
|
*
|
2015-01-08 23:54:03 +00:00
|
|
|
* @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt
|
2013-06-26 21:18:39 +00:00
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
2014-06-11 16:19:53 +00:00
|
|
|
QUnit.module( 've.dm.Converter', QUnit.newMwEnvironment() );
|
2014-01-15 03:15:37 +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 ) {
|
|
|
|
caseItem = ve.copy( cases[msg] );
|
|
|
|
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;
|
|
|
|
|
2014-02-20 21:30:29 +00:00
|
|
|
QUnit.expect( 2 * ve.getObjectKeys( cases ).length );
|
2014-01-15 03:15:37 +00:00
|
|
|
|
|
|
|
for ( msg in cases ) {
|
|
|
|
caseItem = ve.copy( cases[msg] );
|
|
|
|
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
|
|
|
} );
|