Index: trunk/parsers/wikidom/tests/hype/es.DocumentModel.test.js |
— | — | @@ -177,8 +177,31 @@ |
178 | 178 | { 'type': '/paragraph' } |
179 | 179 | ]; |
180 | 180 | |
| 181 | +/** |
| 182 | + * Sample content data index. |
| 183 | + * |
| 184 | + * This is a node tree that describes each partition within the document's content data. |
| 185 | + */ |
| 186 | +var tree = [ |
| 187 | + new es.ParagraphModel( 3 ), |
| 188 | + new es.TableModel( [ |
| 189 | + new es.TableRowModel( [ |
| 190 | + new es.TableCellModel( [ |
| 191 | + new es.ParagraphModel( 1 ), |
| 192 | + new es.ListModel( [ |
| 193 | + new es.ListItemModel( 1 ), |
| 194 | + new es.ListItemModel( 1 ), |
| 195 | + new es.ListItemModel( 1 ) |
| 196 | + ] ) |
| 197 | + ] ) |
| 198 | + ] ) |
| 199 | + ] ), |
| 200 | + new es.ParagraphModel( 1 ) |
| 201 | +]; |
| 202 | + |
181 | 203 | test( 'es.DocumentModel', function() { |
182 | 204 | var documentModel = es.DocumentModel.newFromPlainObject( obj ); |
183 | 205 | |
184 | 206 | deepEqual( documentModel.getData(), data, 'Flattening plain objects results in correct data' ); |
| 207 | + deepEqual( documentModel.slice( 0 ), tree, 'Nodes contain correct lengths' ); |
185 | 208 | } ); |
Index: trunk/parsers/wikidom/lib/hype/models/es.DocumentModel.js |
— | — | @@ -224,6 +224,7 @@ |
225 | 225 | i++; |
226 | 226 | } |
227 | 227 | currentNode.setContentLength( i - start ); |
| 228 | + i--; |
228 | 229 | } |
229 | 230 | } |
230 | 231 | }; |