Implement Manager#update_properties

This commit is contained in:
Thibault Jouan 2015-04-22 03:29:36 +00:00
parent 933bcdfcd8
commit b1a601918e
2 changed files with 30 additions and 0 deletions

View File

@ -78,6 +78,12 @@ module Uh
@events.emit :unmanage, args: client
end
def update_properties window
return unless client = client_for(window)
client.update_window_properties
@events.emit :change, args: client
end
def handle_next_event
handle @display.next_event
end

View File

@ -248,6 +248,30 @@ module Uh
end
end
describe '#update_properties' do
context 'with known window' do
before { manager.clients << client }
it 'tells the client to update its window properties' do
expect(client).to receive :update_window_properties
manager.update_properties window
end
it 'emits :change event with the client' do
events.on :change, &block
expect(block).to receive(:call).with client
manager.update_properties window
end
end
context 'with unknown window' do
it 'does not emit any event' do
expect(events).not_to receive :emit
manager.update_properties window
end
end
end
describe '#handle_next_event' do
it 'handles the next available event on display' do
event = double 'event'