mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-29 08:34:54 +00:00
66aebc4fb0
New changes: 0bc7034 Fix unmodifiedness test in showSelection 6e27ea1 Test clipboard mode in converter 5481dc5 Localisation updates from https://translatewiki.net. f7623bd ve#resolveUrl: stop accepting string values for base bce9180 ve.ce.FocusableNode: Remove superfluous ve.ce.Surface#appendHighlights call Local changes: * Update test case counter for clipboard tests * Add clipboardBody to tests Change-Id: Ie0f149b74abf10e740be63e3759416ecc8bed656
57 lines
1.6 KiB
JavaScript
57 lines
1.6 KiB
JavaScript
/*!
|
|
* VisualEditor DataModel MediaWiki-specific Converter tests.
|
|
*
|
|
* @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
QUnit.module( 've.dm.Converter (MW)', QUnit.newMwEnvironment() );
|
|
|
|
ve.test.utils.modelRegistrySetup = function () {
|
|
ve.dm.modelRegistry.register( ve.dm.MWHeadingNode );
|
|
ve.dm.modelRegistry.register( ve.dm.MWPreformattedNode );
|
|
ve.dm.modelRegistry.register( ve.dm.MWTableNode );
|
|
};
|
|
|
|
ve.test.utils.modelRegistryTeardown = function () {
|
|
ve.dm.modelRegistry.register( ve.dm.HeadingNode );
|
|
ve.dm.modelRegistry.register( ve.dm.PreformattedNode );
|
|
ve.dm.modelRegistry.register( ve.dm.TableNode );
|
|
};
|
|
|
|
QUnit.test( 'getModelFromDom', function ( assert ) {
|
|
var msg, caseItem,
|
|
cases = ve.dm.mwExample.domToDataCases;
|
|
|
|
QUnit.expect( ve.test.utils.countGetModelFromDomTests( cases ) );
|
|
|
|
ve.test.utils.modelRegistrySetup();
|
|
for ( msg in cases ) {
|
|
caseItem = ve.copy( cases[msg] );
|
|
if ( caseItem.mwConfig ) {
|
|
mw.config.set( caseItem.mwConfig );
|
|
}
|
|
|
|
ve.test.utils.runGetModelFromDomTest( assert, caseItem, msg );
|
|
}
|
|
ve.test.utils.modelRegistryTeardown();
|
|
} );
|
|
|
|
QUnit.test( 'getDomFromModel', function ( assert ) {
|
|
var msg, caseItem,
|
|
cases = ve.dm.mwExample.domToDataCases;
|
|
|
|
QUnit.expect( 3 * ve.getObjectKeys( cases ).length );
|
|
|
|
ve.test.utils.modelRegistrySetup();
|
|
for ( msg in cases ) {
|
|
caseItem = ve.copy( cases[msg] );
|
|
if ( caseItem.mwConfig ) {
|
|
mw.config.set( caseItem.mwConfig );
|
|
}
|
|
|
|
ve.test.utils.runGetDomFromModelTest( assert, caseItem, msg );
|
|
}
|
|
ve.test.utils.modelRegistryTeardown();
|
|
} );
|