mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
* Mangle stupid defaults test so that it compares tables, and not a non-deterministic string representation of one. It's still extremely dumb and annoying to update. (i.e., feel free to kill it with fire in a subsequent PR, I think everybody would cheer). * Rewrite DepGraph to be deterministic i.e., fully array based, no more hashes, which means no more pairs randomly re-ordering stuff. Insertion order is now preserved. Pretty sure a couple of bugs have been fixed and/or added along the way ;p. * Resync frontend/apps/filemanager/lib/md.lua w/ upstream And use orderedPairs in the attribute parsing code, just to make that stupid test happy.
39 lines
1.1 KiB
Lua
39 lines
1.1 KiB
Lua
describe("Menu widget", function()
|
|
local Menu
|
|
setup(function()
|
|
require("commonrequire")
|
|
Menu = require("ui/widget/menu")
|
|
end)
|
|
|
|
it("should convert item table from touch menu properly", function()
|
|
local cb1 = function() end
|
|
local cb2 = function() end
|
|
local re = Menu.itemTableFromTouchMenu({
|
|
navi = {
|
|
icon = 'foo/bar.png',
|
|
{ text = 'foo', callback = cb1 },
|
|
{ text = 'bar', callback = cb2 },
|
|
},
|
|
exit = {
|
|
icon = 'foo/bar2.png',
|
|
callback = cb2
|
|
},
|
|
})
|
|
--- @fixme: Currently broken because pairs (c.f., https://github.com/koreader/koreader/pull/6371#issuecomment-657251302)
|
|
assert.are.same(re, {
|
|
{
|
|
text = 'navi',
|
|
sub_item_table = {
|
|
icon = 'foo/bar.png',
|
|
{ text = 'foo', callback = cb1 },
|
|
{ text = 'bar', callback = cb2 },
|
|
}
|
|
},
|
|
{
|
|
text = 'exit',
|
|
callback = cb2,
|
|
}
|
|
})
|
|
end)
|
|
end)
|