Compare commits
No commits in common. "8167f6d85d93adbf2b238963d19b1e80ea218864" and "38f3c58da9b5ede4205e83c1d9ea92476dfa2113" have entirely different histories.
8167f6d85d
...
38f3c58da9
|
|
@ -189,30 +189,4 @@ describe("A store", function () {
|
||||||
expect(store.debug().idList).toEqual(["_a", "_c", "_b", "_d"])
|
expect(store.debug().idList).toEqual(["_a", "_c", "_b", "_d"])
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("contains a moveBefore method which handles indentation", function () {
|
|
||||||
let store
|
|
||||||
|
|
||||||
beforeEach(function () {
|
|
||||||
store = createStore([
|
|
||||||
{text: "a", id: "_a", indented: 0},
|
|
||||||
{text: "b", id: "_b", indented: 1},
|
|
||||||
{text: "c", id: "_c", indented: 2},
|
|
||||||
{text: "d", id: "_d", indented: 3},
|
|
||||||
{text: "e", id: "_e", indented: 0},
|
|
||||||
])
|
|
||||||
})
|
|
||||||
it("moveBefore _e, _c", function () {
|
|
||||||
store.moveBefore("_e", "_c")
|
|
||||||
let debug = store.debug();
|
|
||||||
expect(debug.idList).toEqual(["_a", "_b", "_e", "_c", "_d"])
|
|
||||||
expect(debug.result[2]).toEqual({text: "e", id: "_e", indented: 2})
|
|
||||||
})
|
|
||||||
it("moveBefore _d, at-end", function () {
|
|
||||||
store.moveBefore("_d", "at-end")
|
|
||||||
let debug = store.debug();
|
|
||||||
expect(debug.idList).toEqual(["_a", "_b", "_c", "_e", "_d"])
|
|
||||||
expect(debug.result[4]).toEqual({text: "d", id: "_d", indented: 0})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -301,12 +301,6 @@ function Store(inputData) {
|
||||||
rotate(idList, toIndex, fromIndex + n, fromIndex - toIndex)
|
rotate(idList, toIndex, fromIndex + n, fromIndex - toIndex)
|
||||||
changed = true
|
changed = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy indent from the next item, or 0 when at the end
|
|
||||||
const v = value(to)
|
|
||||||
if (v) value(from).indented = v.indented
|
|
||||||
else value(from).indented = 0
|
|
||||||
|
|
||||||
return [index(from), n]
|
return [index(from), n]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user