Fixed action menu of root node not working

This commit is contained in:
jos 2016-10-17 20:38:35 +02:00
parent dc8bb9349c
commit f6dfe874db
2 changed files with 6 additions and 0 deletions

View File

@ -619,6 +619,10 @@ export function findPropertyIndex (object, prop) {
* @return {Array} * @return {Array}
*/ */
export function parseJSONPointer (pointer) { export function parseJSONPointer (pointer) {
if (pointer === '/') {
return []
}
const path = pointer.split('/') const path = pointer.split('/')
path.shift() // remove the first empty entry path.shift() // remove the first empty entry

View File

@ -285,6 +285,8 @@ test('parseJSONPointer', t => {
t.deepEqual(parseJSONPointer('/obj/a'), ['obj', 'a']) t.deepEqual(parseJSONPointer('/obj/a'), ['obj', 'a'])
t.deepEqual(parseJSONPointer('/arr/-'), ['arr', '-']) t.deepEqual(parseJSONPointer('/arr/-'), ['arr', '-'])
t.deepEqual(parseJSONPointer('/foo/~1~0 ~0~1'), ['foo', '/~ ~/']) t.deepEqual(parseJSONPointer('/foo/~1~0 ~0~1'), ['foo', '/~ ~/'])
t.deepEqual(parseJSONPointer('/obj'), ['obj'])
t.deepEqual(parseJSONPointer('/'), [])
}) })
test('compileJSONPointer', t => { test('compileJSONPointer', t => {