mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-28 12:46:45 +00:00
fd49e8df32
In this commit several methods (child node add/remove and parent/root modification) were also moved to ve.dm.BranchNode ve.dm.Node respectively. ve.Node and ve.BranchNode are immutable. ve.dm.Node and ve.dm.BranchNode are mutable. Other subclasses of ve.Node and ve.BranchNode should implement functionality to mimic changes made to a data model. Change-Id: Ia9ff78764f8f50f99fc8f9f9593657c0a0bf287e
34 lines
788 B
JavaScript
34 lines
788 B
JavaScript
module( 've.Node' );
|
|
|
|
/* Stubs */
|
|
|
|
ve.NodeStub = function() {
|
|
// Inheritance
|
|
ve.Node.call( this, 'stub' );
|
|
};
|
|
|
|
ve.extendClass( ve.NodeStub, ve.Node );
|
|
|
|
/* Tests */
|
|
|
|
test( 'prototype.canHaveChildren', 1, function() {
|
|
raises( function() {
|
|
var node = new ve.NodeStub();
|
|
// Abstract method, must be overridden, throws exception when called
|
|
node.canHaveChildren();
|
|
}, 'throws exception when called' );
|
|
} );
|
|
|
|
test( 'prototype.canHaveGrandchildren', 1, function() {
|
|
raises( function() {
|
|
var node = new ve.NodeStub();
|
|
// Abstract method, must be overridden, throws exception when called
|
|
node.canHaveGrandchildren();
|
|
}, 'throws exception when called' );
|
|
} );
|
|
|
|
test( 'prototype.getType', 1, function() {
|
|
var node = new ve.NodeStub();
|
|
strictEqual( node.getType(), 'stub' );
|
|
} );
|