From 03a6c323ac02301ea827017ff2fae2acd1a0f84b Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Wed, 22 Apr 2015 03:18:19 +0000 Subject: [PATCH] Implement Client#update_window_properties --- lib/uh/wm/client.rb | 5 +++++ spec/uh/wm/client_spec.rb | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/lib/uh/wm/client.rb b/lib/uh/wm/client.rb index 1eea9b9..464d637 100644 --- a/lib/uh/wm/client.rb +++ b/lib/uh/wm/client.rb @@ -31,6 +31,11 @@ module Uh @wclass ||= @window.wclass end + def update_window_properties + @wname = @window.name + @wclass = @window.wclass + end + def configure @window.configure @geo self diff --git a/spec/uh/wm/client_spec.rb b/spec/uh/wm/client_spec.rb index d246842..d074646 100644 --- a/spec/uh/wm/client_spec.rb +++ b/spec/uh/wm/client_spec.rb @@ -47,6 +47,24 @@ module Uh end end + describe '#update_window_properties' do + it 'updates the cached window name' do + client.name + allow(window).to receive(:name) { 'new name' } + expect { client.update_window_properties } + .to change { client.name } + .from('wname').to 'new name' + end + + it 'updates the cached window class' do + client.wclass + allow(window).to receive(:wclass) { 'new class' } + expect { client.update_window_properties } + .to change { client.wclass } + .from('wclass').to 'new class' + end + end + describe '#configure' do it 'configures the window with client geo' do expect(window).to receive(:configure).with geo