Index: trunk/extensions/VisualEditor/tests/es/es.DocumentNode.test.js |
— | — | @@ -195,7 +195,7 @@ |
196 | 196 | { |
197 | 197 | 'node': root2, |
198 | 198 | 'input': new es.Range( 0, 10 ), |
199 | | - 'output': [{ 'node': f } ], |
| 199 | + 'output': [{ 'node': f, 'globalRange': new es.Range( 0, 10 ) } ], |
200 | 200 | 'desc': 'Range starting before the beginning of a node and ending past the end' |
201 | 201 | }, |
202 | 202 | // Test 6 |
— | — | @@ -290,7 +290,7 @@ |
291 | 291 | 'node': root2, |
292 | 292 | 'input': new es.Range( 0, 11 ), |
293 | 293 | 'output': [ |
294 | | - { 'node': f }, |
| 294 | + { 'node': f, 'globalRange': new es.Range( 0, 10 ) }, |
295 | 295 | { 'node': g, 'range': new es.Range( 0, 0 ), 'globalRange': new es.Range( 11, 11 ) } |
296 | 296 | ], |
297 | 297 | 'desc': 'Range starting before the beginning of the first node and ending at the beginning of the second node' |
— | — | @@ -300,7 +300,7 @@ |
301 | 301 | 'node': root2, |
302 | 302 | 'input': new es.Range( 0, 14 ), |
303 | 303 | 'output': [ |
304 | | - { 'node': f }, |
| 304 | + { 'node': f, 'globalRange': new es.Range( 0, 10 ) }, |
305 | 305 | { 'node': g, 'range': new es.Range( 0, 3 ), 'globalRange': new es.Range( 11, 14 ) } |
306 | 306 | ], |
307 | 307 | 'desc': 'Range starting before the beginning of the first node and ending in the middle of the second node' |
— | — | @@ -310,7 +310,7 @@ |
311 | 311 | 'node': root2, |
312 | 312 | 'input': new es.Range( 0, 19 ), |
313 | 313 | 'output': [ |
314 | | - { 'node': f }, |
| 314 | + { 'node': f, 'globalRange': new es.Range( 0, 10 ) }, |
315 | 315 | { 'node': g, 'range': new es.Range( 0, 8 ), 'globalRange': new es.Range( 11, 19 ) } |
316 | 316 | ], |
317 | 317 | 'desc': 'Range starting before the beginning of the first node and ending at the end of the second node' |
— | — | @@ -320,8 +320,8 @@ |
321 | 321 | 'node': root2, |
322 | 322 | 'input': new es.Range( 0, 20 ), |
323 | 323 | 'output': [ |
324 | | - { 'node': f }, |
325 | | - { 'node': g } |
| 324 | + { 'node': f, 'globalRange': new es.Range( 0, 10 ) }, |
| 325 | + { 'node': g, 'globalRange': new es.Range( 10, 20 ) } |
326 | 326 | ], |
327 | 327 | 'desc': 'Range starting before the beginning of the first node and ending between the second and the third node' |
328 | 328 | }, |
— | — | @@ -330,8 +330,8 @@ |
331 | 331 | 'node': root2, |
332 | 332 | 'input': new es.Range( 0, 21 ), |
333 | 333 | 'output': [ |
334 | | - { 'node': f }, |
335 | | - { 'node': g }, |
| 334 | + { 'node': f, 'globalRange': new es.Range( 0, 10 ) }, |
| 335 | + { 'node': g, 'globalRange': new es.Range( 10, 20 ) }, |
336 | 336 | { 'node': h, 'range': new es.Range( 0, 0 ), 'globalRange': new es.Range( 21, 21 ) } |
337 | 337 | ], |
338 | 338 | 'desc': 'Range starting before the beginning of the first node and ending at the beginning of the third node' |
— | — | @@ -341,8 +341,8 @@ |
342 | 342 | 'node': root2, |
343 | 343 | 'input': new es.Range( 0, 27 ), |
344 | 344 | 'output': [ |
345 | | - { 'node': f }, |
346 | | - { 'node': g }, |
| 345 | + { 'node': f, 'globalRange': new es.Range( 0, 10 ) }, |
| 346 | + { 'node': g, 'globalRange': new es.Range( 10, 20 ) }, |
347 | 347 | { 'node': h, 'range': new es.Range( 0, 6 ), 'globalRange': new es.Range( 21, 27 ) } |
348 | 348 | ], |
349 | 349 | 'desc': 'Range starting before the beginning of the first node and ending in the middle of the third node' |
— | — | @@ -352,8 +352,8 @@ |
353 | 353 | 'node': root2, |
354 | 354 | 'input': new es.Range( 0, 29 ), |
355 | 355 | 'output': [ |
356 | | - { 'node': f }, |
357 | | - { 'node': g }, |
| 356 | + { 'node': f, 'globalRange': new es.Range( 0, 10 ) }, |
| 357 | + { 'node': g, 'globalRange': new es.Range( 10, 20 ) }, |
358 | 358 | { 'node': h, 'range': new es.Range( 0, 8 ), 'globalRange': new es.Range( 21, 29 ) } |
359 | 359 | ], |
360 | 360 | 'desc': 'Range starting before the beginning of the first node and ending at the end of the third node' |
— | — | @@ -363,9 +363,9 @@ |
364 | 364 | 'node': root2, |
365 | 365 | 'input': new es.Range( 0, 30 ), |
366 | 366 | 'output': [ |
367 | | - { 'node': f }, |
368 | | - { 'node': g }, |
369 | | - { 'node': h } |
| 367 | + { 'node': f, 'globalRange': new es.Range( 0, 10 ) }, |
| 368 | + { 'node': g, 'globalRange': new es.Range( 10, 20 ) }, |
| 369 | + { 'node': h, 'globalRange': new es.Range( 20, 30 ) } |
370 | 370 | ], |
371 | 371 | 'desc': 'Range starting before the beginning of the first node and ending past the end of the third node' |
372 | 372 | }, |
— | — | @@ -405,7 +405,7 @@ |
406 | 406 | 'input': new es.Range( 1, 20 ), |
407 | 407 | 'output': [ |
408 | 408 | { 'node': f, 'range': new es.Range( 0, 8 ), 'globalRange': new es.Range( 1, 9 ) }, |
409 | | - { 'node': g } |
| 409 | + { 'node': g, 'globalRange': new es.Range( 10, 20 ) } |
410 | 410 | ], |
411 | 411 | 'desc': 'Range starting at the beginning of the first node and ending between the second and the third node' |
412 | 412 | }, |
— | — | @@ -415,7 +415,7 @@ |
416 | 416 | 'input': new es.Range( 1, 21 ), |
417 | 417 | 'output': [ |
418 | 418 | { 'node': f, 'range': new es.Range( 0, 8 ), 'globalRange': new es.Range( 1, 9 ) }, |
419 | | - { 'node': g }, |
| 419 | + { 'node': g, 'globalRange': new es.Range( 10, 20 ) }, |
420 | 420 | { 'node': h, 'range': new es.Range( 0, 0 ), 'globalRange': new es.Range( 21, 21 ) } |
421 | 421 | ], |
422 | 422 | 'desc': 'Range starting at the beginning of the first node and ending at the beginning of the third node' |
— | — | @@ -426,7 +426,7 @@ |
427 | 427 | 'input': new es.Range( 1, 27 ), |
428 | 428 | 'output': [ |
429 | 429 | { 'node': f, 'range': new es.Range( 0, 8 ), 'globalRange': new es.Range( 1, 9 ) }, |
430 | | - { 'node': g }, |
| 430 | + { 'node': g, 'globalRange': new es.Range( 10, 20 ) }, |
431 | 431 | { 'node': h, 'range': new es.Range( 0, 6 ), 'globalRange': new es.Range( 21, 27 ) } |
432 | 432 | ], |
433 | 433 | 'desc': 'Range starting at the beginning of the first node and ending in the middle of the third node' |
— | — | @@ -437,7 +437,7 @@ |
438 | 438 | 'input': new es.Range( 1, 29 ), |
439 | 439 | 'output': [ |
440 | 440 | { 'node': f, 'range': new es.Range( 0, 8 ), 'globalRange': new es.Range( 1, 9 ) }, |
441 | | - { 'node': g }, |
| 441 | + { 'node': g, 'globalRange': new es.Range( 10, 20 ) }, |
442 | 442 | { 'node': h, 'range': new es.Range( 0, 8 ), 'globalRange': new es.Range( 21, 29 ) } |
443 | 443 | ], |
444 | 444 | 'desc': 'Range starting at the beginning of the first node and ending at the end of the third node' |
— | — | @@ -448,8 +448,8 @@ |
449 | 449 | 'input': new es.Range( 1, 30 ), |
450 | 450 | 'output': [ |
451 | 451 | { 'node': f, 'range': new es.Range( 0, 8 ), 'globalRange': new es.Range( 1, 9 ) }, |
452 | | - { 'node': g }, |
453 | | - { 'node': h } |
| 452 | + { 'node': g, 'globalRange': new es.Range( 10, 20 ) }, |
| 453 | + { 'node': h, 'globalRange': new es.Range( 20, 30 ) } |
454 | 454 | ], |
455 | 455 | 'desc': 'Range starting at the beginning of the first node and ending past the end of the third node' |
456 | 456 | }, |
— | — | @@ -489,7 +489,7 @@ |
490 | 490 | 'input': new es.Range( 5, 20 ), |
491 | 491 | 'output': [ |
492 | 492 | { 'node': f, 'range': new es.Range( 4, 8 ), 'globalRange': new es.Range( 5, 9 ) }, |
493 | | - { 'node': g } |
| 493 | + { 'node': g, 'globalRange': new es.Range( 10, 20 ) } |
494 | 494 | ], |
495 | 495 | 'desc': 'Range starting in the middle of the first node and ending between the second and the third node' |
496 | 496 | }, |
— | — | @@ -499,7 +499,7 @@ |
500 | 500 | 'input': new es.Range( 5, 21 ), |
501 | 501 | 'output': [ |
502 | 502 | { 'node': f, 'range': new es.Range( 4, 8 ), 'globalRange': new es.Range( 5, 9 ) }, |
503 | | - { 'node': g }, |
| 503 | + { 'node': g, 'globalRange': new es.Range( 10, 20 ) }, |
504 | 504 | { 'node': h, 'range': new es.Range( 0, 0 ), 'globalRange': new es.Range( 21, 21 ) } |
505 | 505 | ], |
506 | 506 | 'desc': 'Range starting in the middle of the first node and ending at the beginning of the third node' |
— | — | @@ -510,7 +510,7 @@ |
511 | 511 | 'input': new es.Range( 5, 27 ), |
512 | 512 | 'output': [ |
513 | 513 | { 'node': f, 'range': new es.Range( 4, 8 ), 'globalRange': new es.Range( 5, 9 ) }, |
514 | | - { 'node': g }, |
| 514 | + { 'node': g, 'globalRange': new es.Range( 10, 20 ) }, |
515 | 515 | { 'node': h, 'range': new es.Range( 0, 6 ), 'globalRange': new es.Range( 21, 27 ) } |
516 | 516 | ], |
517 | 517 | 'desc': 'Range starting in the middle of the first node and ending in the middle of the third node' |
— | — | @@ -521,7 +521,7 @@ |
522 | 522 | 'input': new es.Range( 5, 29 ), |
523 | 523 | 'output': [ |
524 | 524 | { 'node': f, 'range': new es.Range( 4, 8 ), 'globalRange': new es.Range( 5, 9 ) }, |
525 | | - { 'node': g }, |
| 525 | + { 'node': g, 'globalRange': new es.Range( 10, 20 ) }, |
526 | 526 | { 'node': h, 'range': new es.Range( 0, 8 ), 'globalRange': new es.Range( 21, 29 ) } |
527 | 527 | ], |
528 | 528 | 'desc': 'Range starting in the middle of the first node and ending at the end of the third node' |
— | — | @@ -532,8 +532,8 @@ |
533 | 533 | 'input': new es.Range( 5, 30 ), |
534 | 534 | 'output': [ |
535 | 535 | { 'node': f, 'range': new es.Range( 4, 8 ), 'globalRange': new es.Range( 5, 9 ) }, |
536 | | - { 'node': g }, |
537 | | - { 'node': h } |
| 536 | + { 'node': g, 'globalRange': new es.Range( 10, 20 ) }, |
| 537 | + { 'node': h, 'globalRange': new es.Range( 20, 30 ) } |
538 | 538 | ], |
539 | 539 | 'desc': 'Range starting in the middle of the first node and ending past the end of the third node' |
540 | 540 | }, |
— | — | @@ -573,7 +573,7 @@ |
574 | 574 | 'input': new es.Range( 9, 20 ), |
575 | 575 | 'output': [ |
576 | 576 | { 'node': f, 'range': new es.Range( 8, 8 ), 'globalRange': new es.Range( 9, 9 ) }, |
577 | | - { 'node': g } |
| 577 | + { 'node': g, 'globalRange': new es.Range( 10, 20 ) } |
578 | 578 | ], |
579 | 579 | 'desc': 'Range starting at the end of the first node and ending between the second and the third node' |
580 | 580 | }, |
— | — | @@ -583,7 +583,7 @@ |
584 | 584 | 'input': new es.Range( 9, 21 ), |
585 | 585 | 'output': [ |
586 | 586 | { 'node': f, 'range': new es.Range( 8, 8 ), 'globalRange': new es.Range( 9, 9 ) }, |
587 | | - { 'node': g }, |
| 587 | + { 'node': g, 'globalRange': new es.Range( 10, 20 ) }, |
588 | 588 | { 'node': h, 'range': new es.Range( 0, 0 ), 'globalRange': new es.Range( 21, 21 ) } |
589 | 589 | ], |
590 | 590 | 'desc': 'Range starting at the end of the first node and ending at the beginning of the third node' |
— | — | @@ -594,7 +594,7 @@ |
595 | 595 | 'input': new es.Range( 9, 27 ), |
596 | 596 | 'output': [ |
597 | 597 | { 'node': f, 'range': new es.Range( 8, 8 ), 'globalRange': new es.Range( 9, 9 ) }, |
598 | | - { 'node': g }, |
| 598 | + { 'node': g, 'globalRange': new es.Range( 10, 20 ) }, |
599 | 599 | { 'node': h, 'range': new es.Range( 0, 6 ), 'globalRange': new es.Range( 21, 27 ) } |
600 | 600 | ], |
601 | 601 | 'desc': 'Range starting at the end of the first node and ending in the middle of the third node' |
— | — | @@ -605,7 +605,7 @@ |
606 | 606 | 'input': new es.Range( 9, 29 ), |
607 | 607 | 'output': [ |
608 | 608 | { 'node': f, 'range': new es.Range( 8, 8 ), 'globalRange': new es.Range( 9, 9 ) }, |
609 | | - { 'node': g }, |
| 609 | + { 'node': g, 'globalRange': new es.Range( 10, 20 ) }, |
610 | 610 | { 'node': h, 'range': new es.Range( 0, 8 ), 'globalRange': new es.Range( 21, 29 ) } |
611 | 611 | ], |
612 | 612 | 'desc': 'Range starting at the end of the first node and ending at the end of the third node' |
— | — | @@ -616,8 +616,8 @@ |
617 | 617 | 'input': new es.Range( 9, 30 ), |
618 | 618 | 'output': [ |
619 | 619 | { 'node': f, 'range': new es.Range( 8, 8 ), 'globalRange': new es.Range( 9, 9 ) }, |
620 | | - { 'node': g }, |
621 | | - { 'node': h } |
| 620 | + { 'node': g, 'globalRange': new es.Range( 10, 20 ) }, |
| 621 | + { 'node': h, 'globalRange': new es.Range( 20, 30 ) } |
622 | 622 | ], |
623 | 623 | 'desc': 'Range starting at the end of the first node and ending past the end of the third node' |
624 | 624 | }, |
— | — | @@ -626,7 +626,7 @@ |
627 | 627 | 'node': root2, |
628 | 628 | 'input': new es.Range( 10, 21 ), |
629 | 629 | 'output': [ |
630 | | - { 'node': g }, |
| 630 | + { 'node': g, 'globalRange': new es.Range( 10, 20 ) }, |
631 | 631 | { 'node': h, 'range': new es.Range( 0, 0 ), 'globalRange': new es.Range( 21, 21 ) } |
632 | 632 | ], |
633 | 633 | 'desc': 'Range starting between the first and the second node and ending at the beginning of the third node' |
— | — | @@ -636,7 +636,7 @@ |
637 | 637 | 'node': root2, |
638 | 638 | 'input': new es.Range( 10, 27 ), |
639 | 639 | 'output': [ |
640 | | - { 'node': g }, |
| 640 | + { 'node': g, 'globalRange': new es.Range( 10, 20 ) }, |
641 | 641 | { 'node': h, 'range': new es.Range( 0, 6 ), 'globalRange': new es.Range( 21, 27 ) } |
642 | 642 | ], |
643 | 643 | 'desc': 'Range starting between the first and the second node and ending in the middle of the third node' |
— | — | @@ -646,7 +646,7 @@ |
647 | 647 | 'node': root2, |
648 | 648 | 'input': new es.Range( 10, 29 ), |
649 | 649 | 'output': [ |
650 | | - { 'node': g }, |
| 650 | + { 'node': g, 'globalRange': new es.Range( 10, 20 ) }, |
651 | 651 | { 'node': h, 'range': new es.Range( 0, 8 ), 'globalRange': new es.Range( 21, 29 ) } |
652 | 652 | ], |
653 | 653 | 'desc': 'Range starting between the first and the second node and ending at the end of the third node' |
— | — | @@ -656,8 +656,8 @@ |
657 | 657 | 'node': root2, |
658 | 658 | 'input': new es.Range( 10, 30 ), |
659 | 659 | 'output': [ |
660 | | - { 'node': g }, |
661 | | - { 'node': h } |
| 660 | + { 'node': g, 'globalRange': new es.Range( 10, 20 ) }, |
| 661 | + { 'node': h, 'globalRange': new es.Range( 20, 30 ) } |
662 | 662 | ], |
663 | 663 | 'desc': 'Range starting between the first and the second node and ending past the end of the third node' |
664 | 664 | }, |
— | — | @@ -697,7 +697,7 @@ |
698 | 698 | 'input': new es.Range( 11, 30 ), |
699 | 699 | 'output': [ |
700 | 700 | { 'node': g, 'range': new es.Range( 0, 8 ), 'globalRange': new es.Range( 11, 19 ) }, |
701 | | - { 'node': h } |
| 701 | + { 'node': h, 'globalRange': new es.Range( 20, 30 ) } |
702 | 702 | ], |
703 | 703 | 'desc': 'Range starting at the beginning of the second node and ending past the end of the third node' |
704 | 704 | }, |
— | — | @@ -737,7 +737,7 @@ |
738 | 738 | 'input': new es.Range( 14, 30 ), |
739 | 739 | 'output': [ |
740 | 740 | { 'node': g, 'range': new es.Range( 3, 8 ), 'globalRange': new es.Range( 14, 19 ) }, |
741 | | - { 'node': h } |
| 741 | + { 'node': h, 'globalRange': new es.Range( 20, 30 ) } |
742 | 742 | ], |
743 | 743 | 'desc': 'Range starting in the middle of the second node and ending past the end of the third node' |
744 | 744 | }, |
— | — | @@ -777,7 +777,7 @@ |
778 | 778 | 'input': new es.Range( 19, 30 ), |
779 | 779 | 'output': [ |
780 | 780 | { 'node': g, 'range': new es.Range( 8, 8 ), 'globalRange': new es.Range( 19, 19 ) }, |
781 | | - { 'node': h } |
| 781 | + { 'node': h, 'globalRange': new es.Range( 20, 30 ) } |
782 | 782 | ], |
783 | 783 | 'desc': 'Range starting at the end of the second node and ending past the end of the third node' |
784 | 784 | }, |
— | — | @@ -849,7 +849,7 @@ |
850 | 850 | 'input': new es.Range( 3, 33 ), |
851 | 851 | 'output': [ |
852 | 852 | { 'node': big.children[0], 'range': new es.Range( 2, 3 ), 'globalRange': new es.Range( 3, 4 ) }, |
853 | | - { 'node': big.children[1] }, |
| 853 | + { 'node': big.children[1], 'globalRange': new es.Range( 5, 31 ) }, |
854 | 854 | { 'node': big.children[2], 'range': new es.Range( 0, 1 ), 'globalRange': new es.Range( 32, 33 ) } |
855 | 855 | ], |
856 | 856 | 'desc': 'Select from before the c to after the h' |