Add specs for the beforeunload handler.
This commit is contained in:
parent
e423f601c0
commit
cfb957a603
5 changed files with 91 additions and 3 deletions
12
spec/fixtures/api/beforeunload-false.html
vendored
Normal file
12
spec/fixtures/api/beforeunload-false.html
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
<html>
|
||||
<body>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
window.onbeforeunload = function() {
|
||||
setImmediate(function() {
|
||||
require('remote').getCurrentWindow().emit('onbeforeunload');
|
||||
});
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
13
spec/fixtures/api/close-beforeunload-false.html
vendored
Normal file
13
spec/fixtures/api/close-beforeunload-false.html
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
<html>
|
||||
<body>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
window.onbeforeunload = function() {
|
||||
setImmediate(function() {
|
||||
require('remote').getCurrentWindow().emit('onbeforeunload');
|
||||
});
|
||||
return false;
|
||||
}
|
||||
window.close();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
13
spec/fixtures/api/close-beforeunload-string.html
vendored
Normal file
13
spec/fixtures/api/close-beforeunload-string.html
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
<html>
|
||||
<body>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
window.onbeforeunload = function() {
|
||||
setImmediate(function() {
|
||||
require('remote').getCurrentWindow().emit('onbeforeunload');
|
||||
});
|
||||
return 'string';
|
||||
}
|
||||
window.close();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
14
spec/fixtures/api/close-beforeunload-true.html
vendored
Normal file
14
spec/fixtures/api/close-beforeunload-true.html
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
<html>
|
||||
<body>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
window.onbeforeunload = function() {
|
||||
setImmediate(function() {
|
||||
require('remote').getCurrentWindow().emit('onbeforeunload');
|
||||
});
|
||||
return true;
|
||||
}
|
||||
window.close();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue