From 870e11a7026488416db66256cf7ab081fa351f2f Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Thu, 16 Apr 2015 18:32:22 +0000 Subject: [PATCH] Implement Client#show --- lib/uh/wm/client.rb | 6 ++++++ spec/uh/wm/client_spec.rb | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/lib/uh/wm/client.rb b/lib/uh/wm/client.rb index ec08d3e..0d80e63 100644 --- a/lib/uh/wm/client.rb +++ b/lib/uh/wm/client.rb @@ -34,6 +34,12 @@ module Uh @window.moveresize @geo self end + + def show + @window.map + @visible = true + self + end end end end diff --git a/spec/uh/wm/client_spec.rb b/spec/uh/wm/client_spec.rb index 06a81bb..da133d4 100644 --- a/spec/uh/wm/client_spec.rb +++ b/spec/uh/wm/client_spec.rb @@ -56,6 +56,23 @@ module Uh expect(client.moveresize).to be client end end + + describe '#show' do + it 'maps the window' do + expect(window).to receive :map + client.show + end + + it 'toggles the client as visible' do + expect { client.show } + .to change { client.visible? } + .from(false).to true + end + + it 'returns self' do + expect(client.show).to be client + end + end end end end