r101008 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101007‎ | r101008 | r101009 >
Date:17:49, 27 October 2011
Author:catrope
Status:deferred
Tags:
Comment:
prepareInsertion: Add test for malformed input
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', 10, function() {
 437+test( 'es.DocumentModel.prepareInsertion', 11, function() {
438438 var documentModel = es.DocumentModel.newFromPlainObject( obj );
439439
440440 // Test 1
@@ -587,6 +587,18 @@
588588 /^Offset 29 out of bounds/,
589589 'prepareInsertion throws exception for offset past the end'
590590 );
 591+
 592+ // Test 11
 593+ raises(
 594+ function() {
 595+ documentModel.prepareInsertion(
 596+ 5,
 597+ [{ 'type': 'paragraph' }, 'a', { 'type': 'listItem' }, { 'type': '/paragraph' }]
 598+ );
 599+ },
 600+ /^Input is malformed: expected \/listItem but got \/paragraph at index 3$/,
 601+ 'prepareInsertion throws exception for malformed input'
 602+ );
591603 } );
592604
593605 test( 'es.DocumentModel.commit, es.DocumentModel.rollback', 10, function() {

Status & tagging log