Fixed action menu of root node not working
This commit is contained in:
parent
dc8bb9349c
commit
f6dfe874db
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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 => {
|
||||||
|
|
Loading…
Reference in New Issue