Skip to content

Commit 61f4949

Browse files
committed
Improve readme, refactor spec for position
1 parent f0cec32 commit 61f4949

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,23 @@ browser.go_to("https://github.com/")
234234
browser.stop
235235
```
236236

237-
#### position
237+
#### position = \*\*options
238238

239-
Set the position for the browser window bounds
239+
Set the position for the browser window
240+
241+
* options `Hash`
242+
* :left `Integer`
243+
* :top `Integer`
240244

241245
```ruby
242246
browser.position = { left: 10, top: 20 }
247+
```
248+
249+
#### position : `Array<Integer>`
250+
251+
Get the position for the browser window
252+
253+
```ruby
243254
browser.position # => [10, 20]
244255
```
245256

spec/browser_spec.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,11 @@ module Ferrum
126126
end
127127

128128
it "allows the window to be positioned" do
129-
expect(browser.position).to eq([0, 0])
130-
expect { browser.position = { left: 10, top: 20 } }.
131-
to change { browser.position }
132-
expect(browser.position).to eq([10, 20])
129+
expect {
130+
browser.position = { left: 10, top: 20 }
131+
}.to change {
132+
browser.position
133+
}.from([0, 0]).to([10, 20])
133134
end
134135

135136
it "allows the page to be scrolled" do

0 commit comments

Comments
 (0)