Rename :display, :* events as :*
This commit is contained in:
parent
325801a037
commit
59e9562279
@ -9,9 +9,9 @@ module Uh
|
||||
end
|
||||
|
||||
def connect
|
||||
@events.emit :display, :connecting, args: @display
|
||||
@events.emit :connecting, args: @display
|
||||
@display.open
|
||||
@events.emit :display, :connected, args: @display
|
||||
@events.emit :connected, args: @display
|
||||
end
|
||||
|
||||
def grab_key keysym
|
||||
|
@ -45,10 +45,10 @@ module Uh
|
||||
private
|
||||
|
||||
def register_manager_hooks
|
||||
@events.on(:display, :connecting) do |display|
|
||||
@events.on(:connecting) do |display|
|
||||
@env.log_debug "Connecting to X server on `#{display}'"
|
||||
end
|
||||
@events.on(:display, :connected) do |display|
|
||||
@events.on(:connected) do |display|
|
||||
@env.log "Connected to X server on `#{display}'"
|
||||
end
|
||||
end
|
||||
|
@ -19,16 +19,16 @@ module Uh
|
||||
manager.connect
|
||||
end
|
||||
|
||||
it 'emits :display, :connecting event with the display' do
|
||||
events.on :display, :connecting, &block
|
||||
it 'emits :connecting event with the display' do
|
||||
events.on :connecting, &block
|
||||
expect(block).to receive(:call) do |*args|
|
||||
expect(args).to eq [display]
|
||||
end
|
||||
manager.connect
|
||||
end
|
||||
|
||||
it 'emits :display, :connected event with the display' do
|
||||
events.on :display, :connected, &block
|
||||
it 'emits :connected event with the display' do
|
||||
events.on :connected, &block
|
||||
expect(block).to receive(:call) do |*args|
|
||||
expect(args).to eq [display]
|
||||
end
|
||||
@ -38,8 +38,8 @@ module Uh
|
||||
context 'when connection fails' do
|
||||
before { allow(display).to receive(:open) { fail } }
|
||||
|
||||
it 'does not emit :display, :connected event' do
|
||||
events.on :display, :connected, &block
|
||||
it 'does not emit :connected event' do
|
||||
events.on :connected, &block
|
||||
expect(block).not_to receive :call
|
||||
manager.connect rescue nil
|
||||
end
|
||||
|
@ -79,7 +79,7 @@ module Uh
|
||||
it 'registers manager event hooks for logging' do
|
||||
runner.register_event_hooks
|
||||
expect(env).to receive(:log)
|
||||
runner.events.emit :display, :connected
|
||||
runner.events.emit :connected
|
||||
end
|
||||
|
||||
it 'registers key bindings event hooks' do
|
||||
|
Loading…
x
Reference in New Issue
Block a user