Index: trunk/parsers/wikidom/tests/hype/es.DocumentModel.test.js |
— | — | @@ -433,7 +433,7 @@ |
434 | 434 | ); |
435 | 435 | } ); |
436 | 436 | |
437 | | -test( 'es.DocumentModel.prepareInsertion', 4, function() { |
| 437 | +test( 'es.DocumentModel.prepareInsertion', 6, function() { |
438 | 438 | var documentModel = es.DocumentModel.newFromPlainObject( obj ); |
439 | 439 | |
440 | 440 | // Test 1 |
— | — | @@ -497,6 +497,40 @@ |
498 | 498 | ], |
499 | 499 | 'prepareInsertion completes opening elements in inserted content' |
500 | 500 | ); |
| 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 | + ); |
501 | 535 | } ); |
502 | 536 | |
503 | 537 | test( 'es.DocumentModel.commit, es.DocumentModel.rollback', 10, function() { |