Skip to content

Commit 70cb566

Browse files
committed
[rb] remove extra keyword from PointerMove
1 parent d5a708a commit 70cb566

4 files changed

Lines changed: 10 additions & 12 deletions

File tree

rb/lib/selenium/webdriver/common/interactions/pointer_actions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def move_to(element, right_by = nil, down_by = nil, device: nil)
111111
pointer.create_pointer_move(duration: default_move_duration,
112112
x: left,
113113
y: top,
114-
element: element)
114+
origin: element)
115115
tick(pointer)
116116
self
117117
end

rb/lib/selenium/webdriver/common/interactions/pointer_input.rb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ def assert_kind(pointer)
4848
KIND[pointer]
4949
end
5050

51-
def create_pointer_move(duration: 0, x: 0, y: 0, element: nil, origin: nil)
52-
add_action(PointerMove.new(self, duration, x, y, element: element, origin: origin))
51+
def create_pointer_move(duration: 0, x: 0, y: 0, origin: nil)
52+
add_action(PointerMove.new(self, duration, x, y, origin: origin))
5353
end
5454

5555
def create_pointer_down(button)
@@ -115,19 +115,17 @@ def initialize(source, duration, x, y, element: nil, origin: nil)
115115
@duration = duration * 1000
116116
@x_offset = x
117117
@y_offset = y
118-
@origin = element || origin
118+
@origin = element || origin || :viewport
119119
end
120120

121121
def type
122122
:pointerMove
123123
end
124124

125125
def encode
126-
output = {type: type, duration: @duration.to_i, x: @x_offset, y: @y_offset}
127-
output[:origin] = @origin
128-
output
126+
{type: type, duration: @duration.to_i, x: @x_offset, y: @y_offset, origin: @origin}
129127
end
130-
end # Move
128+
end # PointerMove
131129

132130
class PointerCancel < Interaction
133131
def type
@@ -137,7 +135,7 @@ def type
137135
def encode
138136
{type: type}
139137
end
140-
end # Cancel
138+
end # PointerCancel
141139
end # Interactions
142140
end # WebDriver
143141
end # Selenium

rb/spec/unit/selenium/webdriver/common/interactions/pointer_actions_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ module WebDriver
114114
expect(mouse).to have_received(:create_pointer_move).with(duration: duration,
115115
x: right_by - dimension / 2,
116116
y: down_by - dimension / 2,
117-
element: element)
117+
origin: element)
118118
end
119119

120120
it 'passes the pointer to the #tick method' do

rb/spec/unit/selenium/webdriver/common/interactions/pointer_input_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ module Interactions
6868

6969
describe '#create_pointer_move' do
7070
it 'executes #add_action with created interaction' do
71-
allow(PointerMove).to receive(:new).with(pointer, 50, 51, 52, element: nil, origin: nil)
71+
allow(PointerMove).to receive(:new).with(pointer, 50, 51, 52, origin: nil)
7272
.and_return(interaction)
7373
allow(pointer).to receive(:add_action).and_call_original
7474

@@ -171,7 +171,7 @@ module Interactions
171171
describe '#encode' do
172172
context 'with element' do
173173
it 'returns a Hash with source, duration, x and y' do
174-
move = PointerMove.new(source, duration, x, y, element: element)
174+
move = PointerMove.new(source, duration, x, y, origin: element)
175175

176176
ms = (duration * 1000).to_i
177177
expect(move.encode).to eq(type: move.type, origin: element, duration: ms, x: x, y: y)

0 commit comments

Comments
 (0)