mediawiki-extensions-Visual.../tests/ve/ce/ve.ce.NodeFactory.test.js
Catrope 748b34cc49 ve2 -> ve in the tests directory too
Change-Id: I30b56b1c43202d8cb6af397d2813b19b1a71d30e
2012-06-19 18:36:34 -07:00

35 lines
845 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.canNodeBeSplit( 'node-factory-node-stub' );
},
/^Unknown node type: node-factory-node-stub$/,
'throws an exception when getting split rules for 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.nodeFactory instanceof ve.ce.NodeFactory, 'factory is initialized at ve.ce.nodeFactory' );
} );