2012-07-19 00:11:26 +00:00
|
|
|
/**
|
|
|
|
* VisualEditor data model LeafNode tests.
|
2012-07-19 21:25:16 +00:00
|
|
|
*
|
2012-07-19 00:11:26 +00:00
|
|
|
* @copyright 2011-2012 VisualEditor Team and others; see AUTHORS.txt
|
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
2012-04-19 21:17:59 +00:00
|
|
|
module( 've.dm.LeafNode' );
|
2012-04-20 00:45:58 +00:00
|
|
|
|
|
|
|
/* Stubs */
|
|
|
|
|
|
|
|
ve.dm.LeafNodeStub = function() {
|
|
|
|
// Inheritance
|
2012-05-02 20:58:50 +00:00
|
|
|
ve.dm.LeafNode.call( this, 'leaf-stub' );
|
2012-04-20 00:45:58 +00:00
|
|
|
};
|
|
|
|
|
2012-05-03 18:52:17 +00:00
|
|
|
ve.dm.LeafNodeStub.rules = {
|
2012-05-22 00:39:03 +00:00
|
|
|
'isWrapped': true,
|
|
|
|
'isContent': true,
|
|
|
|
'canContainContent': false,
|
|
|
|
'childNodeTypes': []
|
2012-05-03 18:52:17 +00:00
|
|
|
};
|
|
|
|
|
2012-05-31 23:50:16 +00:00
|
|
|
ve.dm.LeafNodeStub.converters = null;
|
|
|
|
|
2012-04-20 00:45:58 +00:00
|
|
|
ve.extendClass( ve.dm.LeafNodeStub, ve.dm.LeafNode );
|
|
|
|
|
2012-05-31 22:20:58 +00:00
|
|
|
ve.dm.nodeFactory.register( 'leaf-stub', ve.dm.LeafNodeStub );
|
2012-05-03 18:52:17 +00:00
|
|
|
|
2012-04-20 00:45:58 +00:00
|
|
|
/* Tests */
|
2012-05-05 00:50:54 +00:00
|
|
|
|
2012-07-10 19:46:08 +00:00
|
|
|
test( 'canHaveChildren', 1, function( assert ) {
|
2012-05-05 00:50:54 +00:00
|
|
|
var node = new ve.dm.LeafNodeStub();
|
2012-07-10 19:46:08 +00:00
|
|
|
assert.equal( node.canHaveChildren(), false );
|
2012-05-05 00:50:54 +00:00
|
|
|
} );
|
|
|
|
|
2012-07-10 19:46:08 +00:00
|
|
|
test( 'canHaveGrandchildren', 1, function( assert ) {
|
2012-05-05 00:50:54 +00:00
|
|
|
var node = new ve.dm.LeafNodeStub();
|
2012-07-10 19:46:08 +00:00
|
|
|
assert.equal( node.canHaveGrandchildren(), false );
|
2012-05-05 00:50:54 +00:00
|
|
|
} );
|