r104102 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104101‎ | r104102 | r104103 >
Date:23:24, 23 November 2011
Author:tparscal
Status:ok
Tags:
Comment:
Added test that exposes bugs in prepareContentAnnotation
Modified paths:
  • /trunk/extensions/VisualEditor/tests/es/es.DocumentModel.test.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/tests/es/es.DocumentModel.test.js
@@ -258,7 +258,7 @@
259259 }
260260 } );
261261
262 -test( 'es.DocumentModel.prepareContentAnnotation', 1, function() {
 262+test( 'es.DocumentModel.prepareContentAnnotation', 2, function() {
263263 var documentModel = es.DocumentModel.newFromPlainObject( esTest.obj );
264264
265265 // Test 1
@@ -299,6 +299,45 @@
300300 ],
301301 'prepareContentAnnotation skips over content that is already set or cleared'
302302 );
 303+
 304+ // Test 2
 305+ deepEqual(
 306+ documentModel.prepareContentAnnotation(
 307+ new es.Range( 3, 10 ), 'set', { 'type': 'textStyle/bold' }
 308+ ).getOperations(),
 309+ [
 310+ { 'type': 'retain', 'length': 3 },
 311+ {
 312+ 'type': 'annotate',
 313+ 'method': 'set',
 314+ 'bias': 'start',
 315+ 'annotation': { 'type': 'textStyle/bold', 'hash': '{"type":"textStyle/bold"}' }
 316+ },
 317+ { 'type': 'retain', 'length': 1 },
 318+ {
 319+ 'type': 'annotate',
 320+ 'method': 'set',
 321+ 'bias': 'stop',
 322+ 'annotation': { 'type': 'textStyle/bold', 'hash': '{"type":"textStyle/bold"}' }
 323+ },
 324+ { 'type': 'retain', 'length': 5 },
 325+ {
 326+ 'type': 'annotate',
 327+ 'method': 'set',
 328+ 'bias': 'start',
 329+ 'annotation': { 'type': 'textStyle/bold', 'hash': '{"type":"textStyle/bold"}' }
 330+ },
 331+ { 'type': 'retain', 'length': 1 },
 332+ {
 333+ 'type': 'annotate',
 334+ 'method': 'set',
 335+ 'bias': 'stop',
 336+ 'annotation': { 'type': 'textStyle/bold', 'hash': '{"type":"textStyle/bold"}' }
 337+ },
 338+ { 'type': 'retain', 'length': 24 }
 339+ ],
 340+ 'prepareContentAnnotation works across element boundaries'
 341+ );
303342 } );
304343
305344 test( 'es.DocumentModel.prepareRemoval', 11, function() {

Follow-up revisions

RevisionCommit summaryAuthorDate
r104177Fix the prepareContentAnnotation test cases added in r104102catrope16:13, 24 November 2011

Status & tagging log