From 521c4251f604f13222f9e84f5a027d83b43351f4 Mon Sep 17 00:00:00 2001 From: Frans de Jonge Date: Sun, 6 Oct 2019 21:33:48 +0200 Subject: [PATCH] [spec] Add ToggleSwitch spec stub (#5450) To protect against issues like #5448. --- spec/unit/toggleswitch_spec.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 spec/unit/toggleswitch_spec.lua diff --git a/spec/unit/toggleswitch_spec.lua b/spec/unit/toggleswitch_spec.lua new file mode 100644 index 000000000..504aa6fa4 --- /dev/null +++ b/spec/unit/toggleswitch_spec.lua @@ -0,0 +1,26 @@ +describe("ToggleSwitch module", function() + local ToggleSwitch + setup(function() + require("commonrequire") + ToggleSwitch = require("ui/widget/toggleswitch") + end) + + it("should toggle without args", function() + local config = { + onConfigChoose = function() end, + } + + local switch = ToggleSwitch:new{ + event = "ChangeSpec", + default_value = 2, + toggle = { "Finished", "Reading", "On hold" }, + values = { 1, 2, 3 }, + name = "spec_status", + alternate = false, + enabled = true, + config = config, + } + switch:togglePosition(1, true) + switch:onTapSelect(3) + end) +end)