mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-01 17:36:35 +00:00
792e7db351
Follows-up I90273786ac186d. QUnit.newMwEnvironment() is a utility provided by MediaWiki core that returns an object with 'setup' and 'teardown' that automatically provides a new sandboxed mw.config before each test and restores the original after each test. Change-Id: I24ac5d8be278df7070093fb84bcbe3720be18791
43 lines
1 KiB
JavaScript
43 lines
1 KiB
JavaScript
/*!
|
|
* VisualEditor DataModel MediaWiki-specific Converter tests.
|
|
*
|
|
* @copyright 2011-2014 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/*global mw */
|
|
|
|
QUnit.module( 've.dm.Converter', QUnit.newMwEnvironment() );
|
|
|
|
QUnit.test( 'getModelFromDom', function ( assert ) {
|
|
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 ) {
|
|
mw.config.set( caseItem.mwConfig );
|
|
}
|
|
|
|
ve.test.utils.runGetModelFromDomTest( assert, caseItem, msg );
|
|
}
|
|
} );
|
|
|
|
QUnit.test( 'getDomFromModel', function ( assert ) {
|
|
var msg, caseItem,
|
|
cases = ve.dm.mwExample.domToDataCases;
|
|
|
|
QUnit.expect( 2 * ve.getObjectKeys( cases ).length );
|
|
|
|
for ( msg in cases ) {
|
|
caseItem = ve.copy( cases[msg] );
|
|
if ( caseItem.mwConfig ) {
|
|
mw.config.set( caseItem.mwConfig );
|
|
}
|
|
|
|
ve.test.utils.runGetDomFromModelTest( assert, caseItem, msg );
|
|
}
|
|
} );
|