r93672 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93671‎ | r93672 | r93673 >
Date:23:08, 1 August 2011
Author:inez
Status:deferred
Tags:
Comment:
Fix "Content modification" tests
Modified paths:
  • /trunk/parsers/wikidom/tests/annotations/index.html (modified) (history)
  • /trunk/parsers/wikidom/tests/annotations/test.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/tests/annotations/index.html
@@ -13,6 +13,7 @@
1414 <script src="../../lib/es/es.js" type="text/javascript"></script>
1515 <script src="../../lib/es/es.EventEmitter.js" type="text/javascript"></script>
1616 <script src="../../lib/es/es.Content.js" type="text/javascript"></script>
 17+ <script src="../../lib/es/es.Range.js" type="text/javascript"></script>
1718 <script src="../../lib/jquery.js" type="text/javascript"></script>
1819 <script src="../../lib/qunit.js" type="text/javascript"></script>
1920 <script src="test.js" type="text/javascript"></script>
Index: trunk/parsers/wikidom/tests/annotations/test.js
@@ -51,16 +51,16 @@
5252 }
5353 ];
5454
55 -var content = es.Content.newFromLines( lines );
 55+var content = es.Content.newFromWikiDomLines( lines );
5656
5757 /* Tests */
5858
59 -test( 'Content modification', 17, function() {
 59+test( 'Content modification', 13, function() {
6060
61 -
6261 content.on( 'change', function( args ) {
6362 ok( true, 'Change events get triggered after ' + args.type + ' events' );
6463 } );
 64+
6565 content.on( 'insert', function( args ) {
6666 ok( true, 'Insert events get triggered' );
6767 equal( args.offset, 5, 'Insert events have correct offsets' );
@@ -68,12 +68,11 @@
6969 deepEqual( content.data.slice( 5, 8 ), ['a', 'b', 'c'], 'Content is inserted correctly' );
7070 // +1 change event
7171 } );
 72+
7273 content.on( 'annotate', function( args ) {
7374 ok( true, 'Annotate events get triggered' );
7475 equal( args.method, 'add', 'Annotate events have correct method' );
7576 deepEqual( args.annotation, { 'type': 'italic' }, 'Annotate events have correct annotation' );
76 - equal( args.start, 5, 'Annotate events have correct start points' );
77 - equal( args.end, 6, 'Annotate events have correct end points' );
7877 deepEqual(
7978 content.data.slice( 4, 8 ),
8079 [' ', ['a', { 'type': 'italic' }], 'b', 'c'],
@@ -81,10 +80,9 @@
8281 );
8382 // +1 change event
8483 } );
 84+
8585 content.on( 'remove', function( args ) {
8686 ok( true, 'Remove events get triggered' );
87 - equal( args.start, 5, 'Remove events have correct start points' );
88 - equal( args.end, 8, 'Remove events have correct end points' );
8987 deepEqual(
9088 content.data.slice( 4, 8 ),
9189 [' ', 'i', 's', ' '],
@@ -92,11 +90,15 @@
9391 );
9492 // +1 change event
9593 } );
 94+
9695 content.insert( 5, ['a', 'b', 'c'] );
97 - content.annotate( 'add', { 'type': 'italic' }, 5, 6 );
98 - content.remove( 5, 8 );
 96+ content.annotate( 'add', { 'type': 'italic' }, new es.Range( 5, 6 ) );
 97+ content.remove( new es.Range( 5, 8 ) );
9998 } );
10099
 100+
 101+/*
 102+
101103 test( 'Content export', 2, function() {
102104
103105 deepEqual(
@@ -269,3 +271,4 @@
270272 'Content.slice returns correct range of data when called with start and end arguments'
271273 );
272274 } );
 275+*/
\ No newline at end of file

Status & tagging log