You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
koreader/spec/unit/inputtext_spec.lua

28 lines
940 B
Lua

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

describe("InputText widget module", function()
local InputText
local equals
setup(function()
require("commonrequire")
InputText = require("ui/widget/inputtext"):new{}
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)