Rename `awful.popup` `hide_on_right_click` property to `hide_on_click`
I stepped on this lately, the implementation of the hide_fct doesn't match the name since there is no check on what button is actually pressed.
It sounds more reasonable to me to rename the hide_on_right_click property to hide_on_click, because I feel the current behavior is more natural.
It was either: break the current behavior, or change the property name. Note that the latter can also preserve the API backwards compatibility by keeping the old property with an additional deprecation message.
I have also write some tests to make sure everything is working the as expected now.
Codecov Report
Merging #3665 (8ad78c7) into master (b16f628) will increase coverage by
0.02%. The diff coverage is100.00%.
@@ Coverage Diff @@
## master #3665 +/- ##
==========================================
+ Coverage 90.91% 90.94% +0.02%
==========================================
Files 896 897 +1
Lines 56633 56689 +56
==========================================
+ Hits 51489 51553 +64
+ Misses 5144 5136 -8
| Flag | Coverage Δ | |
|---|---|---|
| gcov | 90.94% <100.00%> (+0.02%) |
:arrow_up: |
| luacov | 93.68% <100.00%> (+<0.01%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Impacted Files | Coverage Δ | |
|---|---|---|
| lib/awful/popup.lua | 94.17% <100.00%> (+1.03%) |
:arrow_up: |
| lib/gears/object.lua | 88.63% <100.00%> (+0.54%) |
:arrow_up: |
| spec/gears/object_spec.lua | 92.17% <100.00%> (+0.74%) |
:arrow_up: |
| tests/test-awful-popup-hide-on-click.lua | 100.00% <100.00%> (ø) |
|
| lib/wibox/widget/imagebox.lua | 95.53% <0.00%> (-0.90%) |
:arrow_down: |
| lib/awful/widget/layoutlist.lua | 89.88% <0.00%> (+0.59%) |
:arrow_up: |
| spawn.c | 86.16% <0.00%> (+3.64%) |
:arrow_up: |
I took an hour or two this morning to work a little more on this unit testing thing...
I ended up with something like :
it(
"Call set_hide_on_click with `true` should connect the hide_fct",
function()
local p = popup { widget = utils.widget_stub() }
local spy_connect = spy.on(p, "connect_signal")
local spy_disconnect = spy.on(p, "disconnect_signal")
p:set_hide_on_click(true)
assert.spy(spy_connect).was_called()
assert.spy(spy_disconnect).was_not_called()
end
)
It seems cleaner since we now spy on the connect/disconnect signals. But I couldn't find a way to make the spies to work with the constructor, so I think the test is incomplete.
I decided to drop the unit-test for now. Since I couldn't find something that make me happy with it. I'll probably put some more time on it latter~~~.
On another note, I have added commit 687e5f86142a2cfba9573dfdad6899025afc9dfc. It implements the appropriate getter, so p.hide_on_click is now a valid property where the user can write and read for real.