-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(screenshots): prevent infinite blocking (#3)
Global functions alert and confirm block and never return without user action which won't happen in headless mode. This fix makes these functions return immediately. This also improves tests to catch more issues with screenshots (like timing out or not generating one per example).
- Loading branch information
Showing
9 changed files
with
111 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* global window: false */ | ||
|
||
/** | ||
* Simulates confirmation usind window.confirm and window.alert otherwise the | ||
* screenshot generator would just hang forever. | ||
*/ | ||
(function() { | ||
window.alert = function() {}; | ||
window.confirm = function() { | ||
return true; | ||
}; | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Test | Alert</title> | ||
|
||
<script type="text/javascript" src="../dist/test.min.js"></script> | ||
|
||
<script type="text/javascript"> | ||
alert("This is just a test."); | ||
</script> | ||
</head> | ||
|
||
<body> | ||
<div id="test-element"></div> | ||
</body> | ||
</html> |
16 changes: 16 additions & 0 deletions
16
test/generate-examples-index/examples/example-confirm.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Test | Confirm</title> | ||
|
||
<script type="text/javascript" src="../dist/test.min.js"></script> | ||
|
||
<script type="text/javascript"> | ||
Confirm("This is just a test."); | ||
</script> | ||
</head> | ||
|
||
<body> | ||
<div id="test-element"></div> | ||
</body> | ||
</html> |