Class: Applitools::Base::MouseTrigger

Inherits:
Object
  • Object
show all
Defined in:
lib/applitools/base/mouse_trigger.rb

Constant Summary collapse

MOUSE_ACTION =
{
  click: 'Click',
  right_click: 'RightClick',
  double_click: 'DoubleClick',
  move: 'Move',
  down: 'Down',
  up: 'Up'
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mouse_action, control, location) ⇒ MouseTrigger

Returns a new instance of MouseTrigger.



14
15
16
17
18
# File 'lib/applitools/base/mouse_trigger.rb', line 14

def initialize(mouse_action, control, location)
  @mouse_action = mouse_action
  @control = control
  @location = location
end

Instance Attribute Details

#controlObject (readonly)

Returns the value of attribute control.



12
13
14
# File 'lib/applitools/base/mouse_trigger.rb', line 12

def control
  @control
end

#locationObject (readonly)

Returns the value of attribute location.



12
13
14
# File 'lib/applitools/base/mouse_trigger.rb', line 12

def location
  @location
end

#mouse_actionObject (readonly)

Returns the value of attribute mouse_action.



12
13
14
# File 'lib/applitools/base/mouse_trigger.rb', line 12

def mouse_action
  @mouse_action
end

Instance Method Details

#to_hashObject



20
21
22
23
24
25
26
27
# File 'lib/applitools/base/mouse_trigger.rb', line 20

def to_hash
  {
    trigget_type: 'Mouse',
    mouse_action: MOUSE_ACTION[mouse_action],
    control: control.to_hash,
    location: location.to_hash
  }
end

#to_sObject



29
30
31
# File 'lib/applitools/base/mouse_trigger.rb', line 29

def to_s
  "#{mouse_action} [#{control}] #{location.x}, #{location.y}"
end