forked from cypress-io/cypress-example-recipes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
21 lines (19 loc) · 710 Bytes
/
Copy pathapp.js
File metadata and controls
21 lines (19 loc) · 710 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* eslint-env browser */
/* eslint-disable no-console */
document.getElementById('error').addEventListener('click', () => {
console.log('application will throw an error in 1 second')
setTimeout(() => {
console.log('application is about to throw an error')
throw new Error('Things went bad')
}, 1000)
})
document.getElementById('promise').addEventListener('click', () => {
console.log('application with NOT handle a rejected promise in 1 second')
new Promise((resolve, reject) => {
setTimeout(() => {
console.log('application is about to reject a promise')
// important: reject with an Error object
reject(new Error('Did not handle this promise'))
}, 1000)
})
})