Index: trunk/parsers/wikidom/tests/annotations/test.js |
— | — | @@ -55,10 +55,9 @@ |
56 | 56 | |
57 | 57 | /* Tests */ |
58 | 58 | |
59 | | -test( 'Content modification', 18, function() { |
| 59 | +test( 'Content modification', 17, function() { |
60 | 60 | |
61 | | - deepEqual( content.getLines(), lines, "Content.getLines returns correct array of all lines" ); |
62 | | - |
| 61 | + |
63 | 62 | content.on( 'change', function( args ) { |
64 | 63 | ok( true, 'Change events get triggered after ' + args.type + ' events' ); |
65 | 64 | } ); |
— | — | @@ -98,7 +97,67 @@ |
99 | 98 | content.remove( 5, 8 ); |
100 | 99 | } ); |
101 | 100 | |
| 101 | +test( 'Content export', 2, function() { |
| 102 | + |
| 103 | + deepEqual( |
| 104 | + content.getLines(), |
| 105 | + lines, |
| 106 | + 'Content.getLines returns correct array of all lines' |
| 107 | + ); |
| 108 | + |
| 109 | + var lines1 = [ |
| 110 | + { |
| 111 | + "text": "test1", |
| 112 | + "annotations": [ |
| 113 | + { |
| 114 | + "type": "bold", |
| 115 | + "range": { |
| 116 | + "start": 0, |
| 117 | + "end": 4 |
| 118 | + } |
| 119 | + }, |
| 120 | + { |
| 121 | + "type": "italic", |
| 122 | + "range": { |
| 123 | + "start": 2, |
| 124 | + "end": 4 |
| 125 | + } |
| 126 | + } |
| 127 | + ] |
| 128 | + }, |
| 129 | + { |
| 130 | + "text": "test2", |
| 131 | + "annotations": [ |
| 132 | + { |
| 133 | + "type": "bold", |
| 134 | + "range": { |
| 135 | + "start": 0, |
| 136 | + "end": 4 |
| 137 | + } |
| 138 | + }, |
| 139 | + { |
| 140 | + "type": "italic", |
| 141 | + "range": { |
| 142 | + "start": 0, |
| 143 | + "end": 2 |
| 144 | + } |
| 145 | + } |
| 146 | + |
| 147 | + ] |
| 148 | + } |
| 149 | + ]; |
| 150 | + |
| 151 | + deepEqual( |
| 152 | + Content.newFromLines( lines1 ).getLines(), |
| 153 | + lines1, |
| 154 | + 'Content.getLines returns correct array of all lines for annotations overlapping between lines' |
| 155 | + ); |
| 156 | + |
| 157 | + |
| 158 | +} ); |
| 159 | + |
102 | 160 | test( 'Content access', 8, function() { |
| 161 | + |
103 | 162 | equal( |
104 | 163 | content.substring( 3, 39 ), |
105 | 164 | 's is a test paragraph!\nParagraphs ca', |