File tree Expand file tree Collapse file tree 3 files changed +48
-13
lines changed Expand file tree Collapse file tree 3 files changed +48
-13
lines changed Original file line number Diff line number Diff line change @@ -87,11 +87,25 @@ module Ferrum
87
87
expect ( browser . viewport_size ) . to eq ( [ 200 , 400 ] )
88
88
end
89
89
90
- it "allows the viewport to be resized by fullscreen" do
91
- browser . go_to ( "/ferrum/custom_html_size" )
92
- expect ( browser . viewport_size ) . to eq ( [ 1024 , 768 ] )
93
- browser . resize ( fullscreen : true )
94
- expect ( browser . viewport_size ) . to eq ( [ 1280 , 1024 ] )
90
+ context 'fullscreen' do
91
+ shared_examples 'resize viewport by fullscreen' do
92
+ it "allows the viewport to be resized by fullscreen" do
93
+ expect ( browser . viewport_size ) . to eq ( [ 1024 , 768 ] )
94
+ browser . go_to ( path )
95
+ browser . resize ( fullscreen : true )
96
+ expect ( browser . viewport_size ) . to eq ( viewport_size )
97
+ end
98
+ end
99
+
100
+ include_examples 'resize viewport by fullscreen' do
101
+ let ( :path ) { "/ferrum/custom_html_size" }
102
+ let ( :viewport_size ) { [ 1280 , 1024 ] }
103
+ end
104
+
105
+ include_examples 'resize viewport by fullscreen' do
106
+ let ( :path ) { "/ferrum/custom_html_size_100%" }
107
+ let ( :viewport_size ) { [ 1272 , 1008 ] }
108
+ end
95
109
end
96
110
97
111
it "allows the page to be scrolled" do
Original file line number Diff line number Diff line change 3
3
< title > custom_size</ title >
4
4
< style >
5
5
html {
6
- width : 100% ;
7
- height : 100% ;
8
- }
9
-
10
- .spacer {
11
- width : 1272px ; /* using scrollWidth adds 8px */
12
- height : 1008px ; /* using scrollHeight adds 16px */
6
+ width : 1280px ;
7
+ height : 1024px ;
13
8
}
14
9
</ style >
15
10
</ head >
16
11
< body >
17
- < div class ="spacer "> </ div >
18
12
</ body >
19
13
</ html >
Original file line number Diff line number Diff line change
1
+ < html >
2
+ < head >
3
+ < title > custom_size</ title >
4
+ < style >
5
+ html {
6
+ width : 100% ;
7
+ height : 100% ;
8
+ }
9
+
10
+ body {
11
+ /*
12
+ deal with the default Chrome margins
13
+ https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/core/html/resources/html.css;
14
+ */
15
+ margin : 0 ;
16
+ }
17
+
18
+ .spacer {
19
+ width : 1272px ;
20
+ height : 1008px ;
21
+ }
22
+ </ style >
23
+ </ head >
24
+ < body >
25
+ < div class ="spacer "> </ div >
26
+ </ body >
27
+ </ html >
You can’t perform that action at this time.
0 commit comments