[go: nahoru, domu]

Skip to content

Commit

Permalink
Notifications: test that silent defaults to null
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoscaceres committed May 23, 2023
1 parent 91061d0 commit ac2c441
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions notifications/constructor-basic.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,34 @@
notification.close()
}
}, "Called the notification constructor with one argument.")

test(() => {
assert_equals(
new Notification("a").silent,
null,
"Expected null by default"
);
}, "Constructing a notification without a NotificationOptions defaults to null.");

test(() => {
for (const silent of [null, undefined]) {
assert_equals(
new Notification("a", { silent }).silent,
null,
`Expected silent to be null when initialized with ${silent}.`
);
}
for (const silent of [true, 1, 100, {}, [], "a string"]) {
assert_true(
new Notification("a", { silent }).silent,
`Expected silent to be true when initialized with ${silent}.`
);
}
for (const silent of [false, 0, "", NaN]) {
assert_false(
new Notification("a", { silent }).silent,
`Expected silent to be false when initialized with ${silent}.`
);
}
}, "constructing a notification with a NotificationOptions dictionary correctly sets and reflects the silent attribute.");
</script>

0 comments on commit ac2c441

Please sign in to comment.