Allow setting badge to undefined
This commit is contained in:
Родитель
4e7e4017fb
Коммит
f160c2867a
|
@ -48,7 +48,7 @@ Notification.prototype = {
|
|||
return this._badge;
|
||||
},
|
||||
set badge(value) {
|
||||
if (typeof value === "number") {
|
||||
if (typeof value === "number" || value === undefined) {
|
||||
this._badge = value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,6 +56,12 @@ describe("Notification", function() {
|
|||
expect(typeof note.badge).to.equal("number");
|
||||
});
|
||||
|
||||
it("can be set to undefined", function() {
|
||||
note.badge = 5;
|
||||
note.badge = undefined;
|
||||
expect(note.badge).to.be.undefined;
|
||||
});
|
||||
|
||||
it("cannot be set to a string", function() {
|
||||
note.badge = "hello";
|
||||
expect(note.badge).to.be.undefined;
|
||||
|
|
Загрузка…
Ссылка в новой задаче