r100978 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100977‎ | r100978 | r100979 >
Date:14:37, 27 October 2011
Author:catrope
Status:deferred
Tags:
Comment:
Add two more test cases for prepareInsertion(). Right now #5 fails because splitting is not implemented, and #6 passes by accident but will probably be broken once splitting is implemented
Modified paths:
  • /trunk/parsers/wikidom/tests/hype/es.DocumentModel.test.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/tests/hype/es.DocumentModel.test.js
@@ -433,7 +433,7 @@
434434 );
435435 } );
436436
437 -test( 'es.DocumentModel.prepareInsertion', 4, function() {
 437+test( 'es.DocumentModel.prepareInsertion', 6, function() {
438438 var documentModel = es.DocumentModel.newFromPlainObject( obj );
439439
440440 // Test 1
@@ -497,6 +497,40 @@
498498 ],
499499 'prepareInsertion completes opening elements in inserted content'
500500 );
 501+
 502+ // Test 5
 503+ deepEqual(
 504+ documentModel.prepareInsertion(
 505+ 2,
 506+ [ { 'type': 'table' }, { 'type': '/table' } ]
 507+ ),
 508+ [
 509+ { 'type': 'retain', 'length': 2 },
 510+ {
 511+ 'type': 'insert',
 512+ 'data': [ { 'type': '/paragraph' }, { 'type': 'table' }, { 'type': '/table' }, { 'type': 'paragraph' } ]
 513+ },
 514+ { 'type': 'retain', 'length': 26 }
 515+ ],
 516+ 'prepareInsertion splits up paragraph when inserting a table in the middle'
 517+ );
 518+
 519+ // Test 6
 520+ deepEqual(
 521+ documentModel.prepareInsertion(
 522+ 2,
 523+ [ 'f', 'o', 'o', { 'type': '/paragraph' }, { 'type': 'paragraph' }, 'b', 'a', 'r' ]
 524+ ),
 525+ [
 526+ { 'type': 'retain', 'length': 2 },
 527+ {
 528+ 'type': 'insert',
 529+ 'data': [ 'f', 'o', 'o', { 'type': '/paragraph' }, { 'type': 'paragraph' }, 'b', 'a', 'r' ]
 530+ },
 531+ { 'type': 'retain', 'length': 26 }
 532+ ],
 533+ 'prepareInsertion splits up paragraph when inserting a paragraph closing and opening into a paragraph'
 534+ );
501535 } );
502536
503537 test( 'es.DocumentModel.commit, es.DocumentModel.rollback', 10, function() {

Status & tagging log