mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
add collapsable TOC menu
This commit is contained in:
@@ -24,7 +24,7 @@ describe("Readertoc module", function()
|
||||
local ticks_level_0 = nil
|
||||
it("should get ticks of level 0", function()
|
||||
ticks_level_0 = toc:getTocTicks(0)
|
||||
DEBUG("ticks", ticks_level_0)
|
||||
--DEBUG("ticks", ticks_level_0)
|
||||
assert.are.same(28, #ticks_level_0)
|
||||
end)
|
||||
local ticks_level_1 = nil
|
||||
@@ -68,4 +68,26 @@ describe("Readertoc module", function()
|
||||
assert.are.same(0, toc:getChapterPagesDone(100, 0))
|
||||
assert.are.same(10, toc:getChapterPagesDone(200, 0))
|
||||
end)
|
||||
describe("collasible TOC", function()
|
||||
it("should collapse the secondary toc nodes by default", function()
|
||||
toc:onShowToc()
|
||||
assert.are.same(7, #toc.collapsed_toc)
|
||||
end)
|
||||
it("should not expand toc nodes that have no child nodes", function()
|
||||
toc:expandToc(2)
|
||||
assert.are.same(7, #toc.collapsed_toc)
|
||||
end)
|
||||
it("should expand toc nodes that have child nodes", function()
|
||||
toc:expandToc(3)
|
||||
assert.are.same(13, #toc.collapsed_toc)
|
||||
toc:expandToc(18)
|
||||
assert.are.same(18, #toc.collapsed_toc)
|
||||
end)
|
||||
it("should collapse toc nodes that have been expanded", function()
|
||||
toc:collapseToc(3)
|
||||
assert.are.same(12, #toc.collapsed_toc)
|
||||
toc:collapseToc(18)
|
||||
assert.are.same(7, #toc.collapsed_toc)
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user