From 7521a861e69ae8cdf1efc6e81194e13f80482235 Mon Sep 17 00:00:00 2001 From: Aire-One Date: Sun, 22 Apr 2018 15:33:04 +0200 Subject: [PATCH 1/2] add documentation for signal "property::value" --- lib/wibox/widget/slider.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/wibox/widget/slider.lua b/lib/wibox/widget/slider.lua index c3c74bd7..3c133562 100644 --- a/lib/wibox/widget/slider.lua +++ b/lib/wibox/widget/slider.lua @@ -114,6 +114,8 @@ local slider = {mt={}} --- The slider value. -- +-- **Signal:** *property::value* notify the value is changed. +-- --@DOC_wibox_widget_slider_value_EXAMPLE@ -- -- @property value From c58e7d4fc87f183ca96b2652fde4d30fd900c00f Mon Sep 17 00:00:00 2001 From: Aire-One Date: Sun, 22 Apr 2018 16:32:25 +0200 Subject: [PATCH 2/2] add busted tests for signal "property::value" --- spec/wibox/widget/slider_spec.lua | 44 +++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 spec/wibox/widget/slider_spec.lua diff --git a/spec/wibox/widget/slider_spec.lua b/spec/wibox/widget/slider_spec.lua new file mode 100644 index 00000000..2098b86d --- /dev/null +++ b/spec/wibox/widget/slider_spec.lua @@ -0,0 +1,44 @@ +--------------------------------------------------------------------------- +-- @author Aire-One +-- @copyright 2018 Aire-One +--------------------------------------------------------------------------- + +local slider = require("wibox.widget.slider") + +describe("wibox.widget.slider", function() + local widget = nil + + before_each(function() + widget = slider() + end) + + describe("signal property::value", function() + local property_value = nil + before_each(function() + widget:connect_signal("property::value", function() + property_value = property_value + 1 + end) + + property_value = 0 + end) + + it("signal property::value", function() + -- initial stats + assert.is.equal(property_value, 0) + assert.is.equal(widget.value, 0) + + -- test to direct change the value + -- it should call the automated "property changed" signal + widget.value = 50 + assert.is.equal(property_value, 1) + assert.is.equal(widget.value, 50) + + -- test with the setter + widget:set_value(100) + assert.is.equal(property_value, 2) + assert.is.equal(widget.value, 100) + end) + end) +end) + +-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80