| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -56,6 +56,21 @@ let asyncTest = Promise.resolve(); | |||
| 56 | 56 | ev.preventDefault(); | |
| 57 | 57 | strictEqual(ev.defaultPrevented, false); | |
| 58 | 58 | } | |
| 59 | + { | ||
| 60 | + [ | ||
| 61 | + 'foo', | ||
| 62 | + 1, | ||
| 63 | + false, | ||
| 64 | + function() {}, | ||
| 65 | + ].forEach((i) => ( | ||
| 66 | + throws(() => new Event('foo', i), { | ||
| 67 | + code: 'ERR_INVALID_ARG_TYPE', | ||
| 68 | + name: 'TypeError', | ||
| 69 | + message: 'The "options" argument must be of type object.' + | ||
| 70 | + common.invalidArgTypeHelper(i) | ||
| 71 | + }) | ||
| 72 | + )); | ||
| 73 | + } | ||
| 59 | 74 | { | |
| 60 | 75 | const ev = new Event('foo'); | |
| 61 | 76 | strictEqual(ev.cancelBubble, false); | |
@@ -221,31 +236,33 @@ let asyncTest = Promise.resolve(); | |||
| 221 | 236 | false | |
| 222 | 237 | ].forEach((i) => { | |
| 223 | 238 | throws(() => target.dispatchEvent(i), { | |
| 224 | - code: 'ERR_INVALID_ARG_TYPE' | ||
| 239 | + code: 'ERR_INVALID_ARG_TYPE', | ||
| 240 | + name: 'TypeError', | ||
| 241 | + message: 'The "event" argument must be an instance of Event.' + | ||
| 242 | + common.invalidArgTypeHelper(i) | ||
| 225 | 243 | }); | |
| 226 | 244 | }); | |
| 227 | 245 | ||
| 246 | + const err = (arg) => ({ | ||
| 247 | + code: 'ERR_INVALID_ARG_TYPE', | ||
| 248 | + name: 'TypeError', | ||
| 249 | + message: 'The "listener" argument must be an instance of EventListener.' + | ||
| 250 | + common.invalidArgTypeHelper(arg) | ||
| 251 | + }); | ||
| 252 | + | ||
| 228 | 253 | [ | |
| 229 | 254 | 'foo', | |
| 230 | 255 | 1, | |
| 231 | 256 | {}, // No handleEvent function | |
| 232 | - false, | ||
| 233 | - ].forEach((i) => { | ||
| 234 | - throws(() => target.addEventListener('foo', i), { | ||
| 235 | - code: 'ERR_INVALID_ARG_TYPE' | ||
| 236 | - }); | ||
| 237 | - }); | ||
| 257 | + false | ||
| 258 | + ].forEach((i) => throws(() => target.addEventListener('foo', i), err(i))); | ||
| 238 | 259 | ||
| 239 | 260 | [ | |
| 240 | 261 | 'foo', | |
| 241 | 262 | 1, | |
| 242 | 263 | {}, // No handleEvent function | |
| 243 | 264 | false | |
| 244 | - ].forEach((i) => { | ||
| 245 | - throws(() => target.removeEventListener('foo', i), { | ||
| 246 | - code: 'ERR_INVALID_ARG_TYPE' | ||
| 247 | - }); | ||
| 248 | - }); | ||
| 265 | + ].forEach((i) => throws(() => target.addEventListener('foo', i), err(i))); | ||
| 249 | 266 | } | |
| 250 | 267 | ||
| 251 | 268 | { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments