mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-16 02:51:50 +00:00
86591e5325
Change-Id: I7023e1f334694d59767491f1010e7c4c59c0ce54
35 lines
858 B
JavaScript
35 lines
858 B
JavaScript
module( 've.ce.NodeFactory' );
|
|
|
|
/* Stubs */
|
|
|
|
ve.ce.NodeFactoryNodeStub = function( a, b ) {
|
|
this.a = a;
|
|
this.b = b;
|
|
};
|
|
|
|
ve.ce.NodeFactoryNodeStub.rules = {
|
|
'canBeSplit': false
|
|
};
|
|
|
|
/* Tests */
|
|
|
|
test( 'canNodeBeSplit', 2, function() {
|
|
var factory = new ve.ce.NodeFactory();
|
|
raises( function() {
|
|
factory.create( 'node-factory-node-stub', 23, { 'bar': 'baz' } );
|
|
},
|
|
/^Unknown node type: node-factory-node-stub$/,
|
|
'throws an exception when getting allowed child nodes of a node of an unregistered type'
|
|
);
|
|
factory.register( 'node-factory-node-stub', ve.ce.NodeFactoryNodeStub );
|
|
strictEqual(
|
|
factory.canNodeBeSplit( 'node-factory-node-stub' ),
|
|
false,
|
|
'gets split rules for registered nodes'
|
|
);
|
|
} );
|
|
|
|
test( 'initialization', 1, function() {
|
|
ok( ve.ce.factory instanceof ve.ce.NodeFactory, 'factory is initialized at ve.ce.factory' );
|
|
} );
|