File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,23 +71,26 @@ public function testResizeWindow(): void
7171 {
7272 $ this ->getSession ()->visit ($ this ->pathTo ('/index.html ' ));
7373 $ session = $ this ->getSession ();
74+ $ testWidth = 640 ;
75+ $ testHeight = 480 ;
7476
75- $ session ->resizeWindow (400 , 300 );
77+ $ session ->resizeWindow ($ testWidth , $ testHeight );
7678 $ session ->wait (1000 , 'false ' );
77- $ jsWindowSizeScript = <<<'JS'
78- (function(){
79- var boolSizeCheck = Math.abs(window.outerHeight - 300) <= 100 && Math.abs(window.outerWidth - 400) <= 100;
80- if (boolSizeCheck){
81- return true;
82- }
83- var w = window,
84- d = document,
85- e = d.documentElement,
86- g = d.getElementsByTagName('body')[0],
87- x = w.innerWidth || e.clientWidth || g.clientWidth,
88- y = w.innerHeight|| e.clientHeight|| g.clientHeight;
89- boolSizeCheck = Math.abs(y - 300) <= 100 && Math.abs(x - 400) <= 100;
90- return boolSizeCheck;
79+ $ jsWindowSizeScript = <<<"JS"
80+ (function () {
81+ var check =
82+ function(w, h){
83+ return Math.abs(w - $ testWidth) <= 100
84+ && Math.abs(h - $ testHeight) <= 100;
85+ },
86+ htmlElem = document.documentElement,
87+ bodyElem = document.getElementsByTagName('body')[0];
88+
89+ return check(window.outerWidth, window.outerHeight)
90+ || check(
91+ window.innerWidth || htmlElem.clientWidth || bodyElem.clientWidth,
92+ window.innerHeight || htmlElem.clientHeight || bodyElem.clientHeight
93+ );
9194 })();
9295JS ;
9396
You can’t perform that action at this time.
0 commit comments