mediawiki-extensions-Visual.../tests/ve2/dm/ve.dm.Document.test.js
Trevor Parscal 93390847bc Added getOuterLength tests for text and document nodes
Neither of these nodes have elements around them, so they must override the default behavior of ve.dm.Node

Change-Id: I19c02c210bfc04b6e2ee1a37b8890e84a236eee3
2012-04-30 13:48:20 -07:00

21 lines
629 B
JavaScript

module( 've.dm.Document' );
/* Tests */
test( 'getOuterLength', 1, function() {
var fragment = new ve.dm.DocumentFragment( ve.dm.example.data );
strictEqual(
fragment.getDocumentNode().getOuterLength(),
ve.dm.example.data.length,
'document does not have elements around it'
);
} );
test( 'rebuildNodes', 88, function() {
var doc = new ve.dm.Document( ve.dm.example.data ),
documentNode = doc.getDocumentNode();
doc.rebuildNodes( documentNode, 1, 1, 5, 30 );
// Test count: ( ( 4 tests x 16 branch nodes ) + ( 3 tests x 8 leaf nodes ) ) = 88
ve.dm.example.nodeTreeEqual( documentNode, ve.dm.example.tree );
} );