-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR-URL: #44703 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
- Loading branch information
1 parent
780144c
commit 67eaa30
Showing
2 changed files
with
57 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
const { strictEqual, deepStrictEqual } = require('assert'); | ||
|
||
{ | ||
const domException = new DOMException('no cause', 'abc'); | ||
strictEqual(domException.name, 'abc'); | ||
strictEqual('cause' in domException, false); | ||
strictEqual(domException.cause, undefined); | ||
} | ||
|
||
{ | ||
const domException = new DOMException('with undefined cause', { name: 'abc', cause: undefined }); | ||
strictEqual(domException.name, 'abc'); | ||
strictEqual('cause' in domException, true); | ||
strictEqual(domException.cause, undefined); | ||
} | ||
|
||
{ | ||
const domException = new DOMException('with string cause', { name: 'abc', cause: 'foo' }); | ||
strictEqual(domException.name, 'abc'); | ||
strictEqual('cause' in domException, true); | ||
strictEqual(domException.cause, 'foo'); | ||
} | ||
|
||
{ | ||
const object = { reason: 'foo' }; | ||
const domException = new DOMException('with object cause', { name: 'abc', cause: object }); | ||
strictEqual(domException.name, 'abc'); | ||
strictEqual('cause' in domException, true); | ||
deepStrictEqual(domException.cause, object); | ||
} |