Add spec for alert/confirm toString errors
This commit is contained in:
parent
c146f8a308
commit
a00d36fb07
1 changed files with 24 additions and 0 deletions
|
@ -880,4 +880,28 @@ describe('chromium feature', function () {
|
|||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('window.alert(message, title)', function () {
|
||||
it('throws an exception when the arguments cannot be converted to strings', function () {
|
||||
assert.throws(function () {
|
||||
window.alert({toString: null})
|
||||
}, /Cannot convert object to primitive value/)
|
||||
|
||||
assert.throws(function () {
|
||||
window.alert('message', {toString: 3})
|
||||
}, /Cannot convert object to primitive value/)
|
||||
})
|
||||
})
|
||||
|
||||
describe('window.confirm(message, title)', function () {
|
||||
it('throws an exception when the arguments cannot be converted to strings', function () {
|
||||
assert.throws(function () {
|
||||
window.confirm({toString: null}, 'title')
|
||||
}, /Cannot convert object to primitive value/)
|
||||
|
||||
assert.throws(function () {
|
||||
window.confirm('message', {toString: 3})
|
||||
}, /Cannot convert object to primitive value/)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue