Index: trunk/parsers/wikidom/tests/annotations/index.html |
— | — | @@ -13,6 +13,7 @@ |
14 | 14 | <script src="../../lib/es/es.js" type="text/javascript"></script> |
15 | 15 | <script src="../../lib/es/es.EventEmitter.js" type="text/javascript"></script> |
16 | 16 | <script src="../../lib/es/es.Content.js" type="text/javascript"></script> |
| 17 | + <script src="../../lib/es/es.Range.js" type="text/javascript"></script> |
17 | 18 | <script src="../../lib/jquery.js" type="text/javascript"></script> |
18 | 19 | <script src="../../lib/qunit.js" type="text/javascript"></script> |
19 | 20 | <script src="test.js" type="text/javascript"></script> |
Index: trunk/parsers/wikidom/tests/annotations/test.js |
— | — | @@ -51,16 +51,16 @@ |
52 | 52 | } |
53 | 53 | ]; |
54 | 54 | |
55 | | -var content = es.Content.newFromLines( lines ); |
| 55 | +var content = es.Content.newFromWikiDomLines( lines ); |
56 | 56 | |
57 | 57 | /* Tests */ |
58 | 58 | |
59 | | -test( 'Content modification', 17, function() { |
| 59 | +test( 'Content modification', 13, function() { |
60 | 60 | |
61 | | - |
62 | 61 | content.on( 'change', function( args ) { |
63 | 62 | ok( true, 'Change events get triggered after ' + args.type + ' events' ); |
64 | 63 | } ); |
| 64 | + |
65 | 65 | content.on( 'insert', function( args ) { |
66 | 66 | ok( true, 'Insert events get triggered' ); |
67 | 67 | equal( args.offset, 5, 'Insert events have correct offsets' ); |
— | — | @@ -68,12 +68,11 @@ |
69 | 69 | deepEqual( content.data.slice( 5, 8 ), ['a', 'b', 'c'], 'Content is inserted correctly' ); |
70 | 70 | // +1 change event |
71 | 71 | } ); |
| 72 | + |
72 | 73 | content.on( 'annotate', function( args ) { |
73 | 74 | ok( true, 'Annotate events get triggered' ); |
74 | 75 | equal( args.method, 'add', 'Annotate events have correct method' ); |
75 | 76 | 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' ); |
78 | 77 | deepEqual( |
79 | 78 | content.data.slice( 4, 8 ), |
80 | 79 | [' ', ['a', { 'type': 'italic' }], 'b', 'c'], |
— | — | @@ -81,10 +80,9 @@ |
82 | 81 | ); |
83 | 82 | // +1 change event |
84 | 83 | } ); |
| 84 | + |
85 | 85 | content.on( 'remove', function( args ) { |
86 | 86 | 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' ); |
89 | 87 | deepEqual( |
90 | 88 | content.data.slice( 4, 8 ), |
91 | 89 | [' ', 'i', 's', ' '], |
— | — | @@ -92,11 +90,15 @@ |
93 | 91 | ); |
94 | 92 | // +1 change event |
95 | 93 | } ); |
| 94 | + |
96 | 95 | 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 ) ); |
99 | 98 | } ); |
100 | 99 | |
| 100 | + |
| 101 | +/* |
| 102 | + |
101 | 103 | test( 'Content export', 2, function() { |
102 | 104 | |
103 | 105 | deepEqual( |
— | — | @@ -269,3 +271,4 @@ |
270 | 272 | 'Content.slice returns correct range of data when called with start and end arguments' |
271 | 273 | ); |
272 | 274 | } ); |
| 275 | +*/ |
\ No newline at end of file |