canvas-native
Advanced tools
Comparing version 1.2.2 to 1.2.3
@@ -45,3 +45,4 @@ 'use strict'; | ||
currentNode = nodeStack.pop() || json; | ||
nodeStack.pop(); | ||
currentNode = nodeStack[nodeStack.length - 1] || json; | ||
} | ||
@@ -48,0 +49,0 @@ |
@@ -31,3 +31,4 @@ export function convert(native) { | ||
currentNode = nodeStack.pop() || json; | ||
nodeStack.pop(); | ||
currentNode = nodeStack[nodeStack.length - 1] || json; | ||
} | ||
@@ -34,0 +35,0 @@ |
{ | ||
"name": "canvas-native", | ||
"description": "Utilities for working with the native Canvas format", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"author": "Jonathan Clem <jonathan@usecanvas.com>", | ||
@@ -6,0 +6,0 @@ "bugs": "https://github.com/usecanvas/canvas-native/issues", |
@@ -99,2 +99,58 @@ import { convert } from '../../../lib/converters/json'; | ||
it('does not create consecutive equally-nested lists', () => { | ||
const doc = parse([ | ||
`${wrap('unordered-list-0')}- UL-0-0`, | ||
`${wrap('unordered-list-1')}- UL-1-0`, | ||
`${wrap('unordered-list-0')}- UL-0-1`, | ||
`${wrap('unordered-list-1')}- UL-1-0`, | ||
`${wrap('unordered-list-0')}- UL-0-2`, | ||
].join('\n')); | ||
expect(convert(doc).content).to.eql([ | ||
{ | ||
type : 'unordered-list', | ||
meta : { level: 0 }, | ||
content: [ | ||
{ | ||
type : 'unordered-list-item', | ||
meta : { level: 0 }, | ||
content: '- UL-0-0', | ||
}, | ||
{ | ||
type : 'unordered-list', | ||
meta : { level: 1 }, | ||
content: [ | ||
{ | ||
type : 'unordered-list-item', | ||
meta : { level: 1 }, | ||
content: '- UL-1-0' | ||
} | ||
] | ||
}, | ||
{ | ||
type : 'unordered-list-item', | ||
meta : { level: 0 }, | ||
content: '- UL-0-1', | ||
}, | ||
{ | ||
type : 'unordered-list', | ||
meta : { level: 1 }, | ||
content: [ | ||
{ | ||
type : 'unordered-list-item', | ||
meta : { level: 1 }, | ||
content: '- UL-1-0' | ||
} | ||
] | ||
}, | ||
{ | ||
type : 'unordered-list-item', | ||
meta : { level: 0 }, | ||
content: '- UL-0-2', | ||
}, | ||
] | ||
} | ||
]); | ||
}); | ||
it('handles nested lists', () => { | ||
@@ -101,0 +157,0 @@ const doc = parse([ |
83420
2186