mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-25 23:05:35 +00:00
82114467f1
199 files touched. Whee! Change-Id: Id82ce4a32f833406db4a1cc585674f2bdb39ba0d
42 lines
1 KiB
JavaScript
42 lines
1 KiB
JavaScript
/*!
|
|
* VisualEditor ContentEditable NodeFactory tests.
|
|
*
|
|
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
QUnit.module( 've.ce.NodeFactory' );
|
|
|
|
/* Stubs */
|
|
|
|
ve.ce.NodeFactoryNodeStub = function VeCeNodeFactoryNodeStub( a, b ) {
|
|
this.a = a;
|
|
this.b = b;
|
|
};
|
|
|
|
ve.inheritClass( ve.ce.NodeFactoryNodeStub, ve.ce.LeafNode );
|
|
|
|
/* Tests */
|
|
|
|
QUnit.test( 'canNodeBeSplit', 2, function ( assert ) {
|
|
var factory = new ve.ce.NodeFactory();
|
|
|
|
assert.throws( function () {
|
|
factory.canNodeBeSplit( 'node-factory-node-stub' );
|
|
},
|
|
Error,
|
|
'throws an exception when getting split rules for a node of an unregistered type'
|
|
);
|
|
factory.register( 'node-factory-node-stub', ve.ce.NodeFactoryNodeStub );
|
|
|
|
assert.strictEqual(
|
|
factory.canNodeBeSplit( 'node-factory-node-stub' ),
|
|
false,
|
|
'gets split rules for registered nodes'
|
|
);
|
|
} );
|
|
|
|
QUnit.test( 'initialization', 1, function ( assert ) {
|
|
assert.ok( ve.ce.nodeFactory instanceof ve.ce.NodeFactory, 'factory is initialized at ve.ce.nodeFactory' );
|
|
} );
|