mediawiki-extensions-Visual.../modules/ve-mw/test/dm/ve.dm.Converter.test.js
Roan Kattouw 0072aeb9a1 Update VE core submodule to master (8c017ae)
Also update VE-MW for the comment changes in VE core

New changes:
4ad6a3d Add text direction to SA demo
89503e8 ve.ce.Node: Emphasise slug transition with increasing outline offset
864046e Update oojs to v1.0.8
65d1338 Localisation updates from https://translatewiki.net.
b66d482 Stop special-casing comments and recognize them as tagName='#comment' instead
09dda12 ve.ce.getDomText: Document node types and use .data instead of .nodeValue
b0a3b2a Make ve.dm.Converter assertions actually display message
ef791cc Make 'comment' its own metaitem type
d5ef0d7 ve.dm.Converter: Refer to nodes instead of elements where appropiate
c22c8af Fix JS error when pressing Enter with selection across multiple paragraphs
a26a708 Add ve.dm.Transaction.newFromReplacement
a9e136e Don't cause needless surface refreshes on overwriting.
6fd35ee Split part of getOpeningHtmlTag out to getHtmlAttributes
2c31f67 ve.ce.Surface: Document version number in focus workaround for Opera
e069e74 Add some more characters to the special character inserter

Change-Id: I859805fb261468e8fae9454c4992115369066b49
2014-03-12 16:15:54 -07:00

66 lines
1.4 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' );
/* Tests */
function setMwConfig( newConfig ) {
var key, oldConfig = {};
for ( key in newConfig ) {
// Store orignal value
oldConfig[key] = mw.config.get( key );
// Override config setting
mw.config.set( key, newConfig[key] );
}
return oldConfig;
}
QUnit.test( 'getModelFromDom', function ( assert ) {
var msg, caseItem,
originalConfig,
cases = ve.dm.mwExample.domToDataCases;
QUnit.expect( ve.test.utils.countGetModelFromDomTests( cases ) );
for ( msg in cases ) {
caseItem = ve.copy( cases[msg] );
if ( caseItem.mwConfig ) {
originalConfig = setMwConfig( caseItem.mwConfig );
}
ve.test.utils.runGetModelFromDomTest( assert, caseItem, msg );
if ( caseItem.mwConfig ) {
setMwConfig( originalConfig );
}
}
} );
QUnit.test( 'getDomFromModel', function ( assert ) {
var msg, caseItem,
originalConfig,
cases = ve.dm.mwExample.domToDataCases;
QUnit.expect( 2 * ve.getObjectKeys( cases ).length );
for ( msg in cases ) {
caseItem = ve.copy( cases[msg] );
if ( caseItem.mwConfig ) {
originalConfig = setMwConfig( caseItem.mwConfig );
}
ve.test.utils.runGetDomFromModelTest( assert, caseItem, msg );
if ( caseItem.mwConfig ) {
setMwConfig( originalConfig );
}
}
} );