Class: Applitools::MouseTrigger
- Defined in:
- lib/applitools/core/mouse_trigger.rb
Constant Summary collapse
- TRIGGER_TYPE =
:Mouse
- MOUSE_ACTION =
A hash contains available mouse actions:
:click
,:right_click
,:double_click
,:move
,:down
,:up
{ click: 'Click', right_click: 'RightClick', double_click: 'DoubleClick', move: 'Move', down: 'Down', up: 'Up' }.freeze
Instance Attribute Summary collapse
-
#control ⇒ Object
readonly
Returns the value of attribute control.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#mouse_action ⇒ Object
readonly
Returns the value of attribute mouse_action.
Instance Method Summary collapse
-
#initialize(mouse_action, control, location) ⇒ MouseTrigger
constructor
A new instance of MouseTrigger.
- #to_hash ⇒ Object
- #to_s ⇒ Object
Methods inherited from Trigger
Constructor Details
#initialize(mouse_action, control, location) ⇒ MouseTrigger
Returns a new instance of MouseTrigger.
22 23 24 25 26 |
# File 'lib/applitools/core/mouse_trigger.rb', line 22 def initialize(mouse_action, control, location) @mouse_action = mouse_action @control = control @location = location end |
Instance Attribute Details
#control ⇒ Object (readonly)
Returns the value of attribute control.
20 21 22 |
# File 'lib/applitools/core/mouse_trigger.rb', line 20 def control @control end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
20 21 22 |
# File 'lib/applitools/core/mouse_trigger.rb', line 20 def location @location end |
#mouse_action ⇒ Object (readonly)
Returns the value of attribute mouse_action.
20 21 22 |
# File 'lib/applitools/core/mouse_trigger.rb', line 20 def mouse_action @mouse_action end |
Instance Method Details
#to_hash ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/applitools/core/mouse_trigger.rb', line 28 def to_hash { triggerType: trigger_type, mouseAction: MOUSE_ACTION[mouse_action], control: control.to_hash, location: location.to_hash } end |
#to_s ⇒ Object
37 38 39 |
# File 'lib/applitools/core/mouse_trigger.rb', line 37 def to_s "#{mouse_action} [#{control}] #{location.x}, #{location.y}" end |