2
0
mirror of https://github.com/koreader/koreader synced 2024-11-13 19:11:25 +00:00
koreader/spec/unit/inputtext_spec.lua
Frans de Jonge 2c1178896c
[feat] Add ReaderBack (#3821)
This implements a reasonable facsimile of going back on Android.

The back button first goes back in a history of visited pages.
When there's no history left, it closes the app.

Fixes #3816.
2018-03-31 21:19:31 +02:00

28 lines
934 B
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

describe("InputText widget module", function()
local InputText
local equals
setup(function()
require("commonrequire")
InputText = require("ui/widget/inputtext")
equals = require("util").tableEquals
end)
describe("addChars()", function()
it("should add regular text", function()
InputText:initTextBox("")
InputText:addChars("a")
assert.is_true( equals({"a"}, InputText.charlist) )
InputText:addChars("aa")
assert.is_true( equals({"a", "a", "a"}, InputText.charlist) )
end)
it("should add unicode text", function()
InputText:initTextBox("")
InputText:addChars("Л")
assert.is_true( equals({"Л"}, InputText.charlist) )
InputText:addChars("Луа")
assert.is_true( equals({"Л", "Л", "у", "а"}, InputText.charlist) )
end)
end)
end)