Index: trunk/extensions/VisualEditor/tests/es/es.DocumentModel.test.js |
— | — | @@ -258,7 +258,7 @@ |
259 | 259 | } |
260 | 260 | } ); |
261 | 261 | |
262 | | -test( 'es.DocumentModel.prepareContentAnnotation', 1, function() { |
| 262 | +test( 'es.DocumentModel.prepareContentAnnotation', 2, function() { |
263 | 263 | var documentModel = es.DocumentModel.newFromPlainObject( esTest.obj ); |
264 | 264 | |
265 | 265 | // Test 1 |
— | — | @@ -299,6 +299,45 @@ |
300 | 300 | ], |
301 | 301 | 'prepareContentAnnotation skips over content that is already set or cleared' |
302 | 302 | ); |
| 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 | + ); |
303 | 342 | } ); |
304 | 343 | |
305 | 344 | test( 'es.DocumentModel.prepareRemoval', 11, function() { |