diff --git a/core/settings_spec.lua b/core/settings_spec.lua index 57d7e1a6b..0b5bd5df9 100644 --- a/core/settings_spec.lua +++ b/core/settings_spec.lua @@ -17,4 +17,26 @@ describe("The settings handler", function() assert.is.equal("baz hooked", private) end) + it("should trigger callbacks on push/pop events", function() + local mystate = "foo" + local function callback2 (value) + mystate = value .. " stack" + end + SILE.settings:declare({ + parameter = "test.callback2", + type = "string", + default = "bar", + hook = callback2 + }) + SILE.settings:pushState() + SILE.settings:set("test.callback2", "baz1") + SILE.settings:pushState() + SILE.settings:set("test.callback2", "baz2") + assert.is.equal("baz2 stack", mystate) + SILE.settings:popState() + assert.is.equal("baz1 stack", mystate) + SILE.settings:popState() + assert.is.equal("bar stack", mystate) + end) + end)