|
|
|
@ -47,4 +47,58 @@ describe("A cursor", function() {
|
|
|
|
|
expect(this.cursor.get()).toBe(3)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
describe("with a store with current closed", function () {
|
|
|
|
|
beforeEach(function () {
|
|
|
|
|
this.store = createStore([
|
|
|
|
|
{indented:0, fold: 'open'},
|
|
|
|
|
{indented:1, fold: 'open'},
|
|
|
|
|
{indented:2, fold: 'open'},
|
|
|
|
|
{indented:3, fold: 'open'},
|
|
|
|
|
{indented:1, fold: 'closed', hidden: true},
|
|
|
|
|
])
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it("moveUp moves up by one", function() {
|
|
|
|
|
this.cursor.set(4)
|
|
|
|
|
this.cursor.moveUp(this.store)
|
|
|
|
|
expect(this.cursor.get()).toBe(3)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
describe("with a store with above closed", function () {
|
|
|
|
|
beforeEach(function () {
|
|
|
|
|
this.store = createStore([
|
|
|
|
|
{indented:0, fold: 'open'},
|
|
|
|
|
{indented:1, fold: 'open'},
|
|
|
|
|
{indented:2, fold: 'open'},
|
|
|
|
|
{indented:3, fold: 'closed', hidden: true},
|
|
|
|
|
{indented:1, fold: 'open'},
|
|
|
|
|
])
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it("moveUp moves up by one", function() {
|
|
|
|
|
this.cursor.set(4)
|
|
|
|
|
this.cursor.moveUp(this.store)
|
|
|
|
|
expect(this.cursor.get()).toBe(2)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
describe("with a store with multiple above closed", function () {
|
|
|
|
|
beforeEach(function () {
|
|
|
|
|
this.store = createStore([
|
|
|
|
|
{indented:0, fold: 'open'},
|
|
|
|
|
{indented:1, fold: 'open'},
|
|
|
|
|
{indented:2, fold: 'closed', hidden: true},
|
|
|
|
|
{indented:3, fold: 'closed', hidden: true},
|
|
|
|
|
{indented:1, fold: 'open'},
|
|
|
|
|
])
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it("moveUp moves up by one", function() {
|
|
|
|
|
this.cursor.set(4)
|
|
|
|
|
this.cursor.moveUp(this.store)
|
|
|
|
|
expect(this.cursor.get()).toBe(1)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|