File tree Expand file tree Collapse file tree 3 files changed +57
-0
lines changed
test/sanity/issue4993-window-resize-event-height Expand file tree Collapse file tree 3 files changed +57
-0
lines changed Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html >
3
+ < head >
4
+ < meta charset ="utf-8 ">
5
+ < meta http-equiv ="X-UA-Compatible " content ="IE=edge ">
6
+ < title > 4993</ title >
7
+ </ head >
8
+ < body >
9
+ < button id ="resize-window " onclick ="resizeWindow() "> Resize to 777x555</ button >
10
+ < script >
11
+ function out ( id , msg ) {
12
+ var h1 = document . createElement ( 'h1' ) ;
13
+ h1 . setAttribute ( 'id' , id ) ;
14
+ h1 . innerHTML = msg ;
15
+ document . body . appendChild ( h1 ) ;
16
+ }
17
+ function resizeWindow ( ) {
18
+ nw . Window . get ( ) . resizeTo ( 777 , 555 ) ;
19
+ }
20
+
21
+ var res ;
22
+ nw . Window . get ( ) . on ( 'resize' , ( width , height ) => {
23
+ if ( res ) { clearTimeout ( res ) } ;
24
+ res = setTimeout ( function ( ) {
25
+ out ( 'resize' , 'width:' + width + ', height: ' + height ) ;
26
+ } , 100 ) ;
27
+ } ) ;
28
+ </ script >
29
+ </ body >
30
+ </ html >
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " 4993" ,
3
+ "main" : " index.html"
4
+ }
Original file line number Diff line number Diff line change
1
+ import os
2
+ import sys
3
+ sys .path .append (os .path .dirname (os .path .dirname (os .path .abspath (__file__ ))))
4
+ from nw_util import *
5
+
6
+ from selenium import webdriver
7
+ from selenium .webdriver .chrome .options import Options
8
+ from selenium .webdriver .common .action_chains import ActionChains
9
+
10
+ chrome_options = Options ()
11
+ chrome_options .add_argument ("nwapp=" + os .path .dirname (os .path .abspath (__file__ )))
12
+
13
+ driver = webdriver .Chrome (executable_path = os .environ ['CHROMEDRIVER' ], chrome_options = chrome_options )
14
+ driver .implicitly_wait (2 )
15
+ try :
16
+ print driver .current_url
17
+ element = driver .find_element_by_id ('resize-window' )
18
+ ActionChains (driver ).click (element ).perform ()
19
+ res = wait_for_element_id (driver , "resize" )
20
+ print res
21
+ assert ("width: 777, height: 555" in res )
22
+ finally :
23
+ driver .quit ()
You can’t perform that action at this time.
0 commit comments