UNPKG

siesta-lite

Version:

Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers

48 lines (27 loc) 1.02 kB
StartTest(function (t) { t.it('Should support alert() call', function (t) { alert('bar'); t.pass('alert should not freeze browser'); // Should be able to verify message t.expectAlertMessage('foo'); alert('foo'); alert('baz'); t.pass('alert should not freeze browser'); }); t.it('Should support confirm() call', function (t) { t.setNextConfirmReturnValue(false); t.expect(confirm('foo')).toBe(false); // Should revert back to default return value, which is true t.expect(confirm('bar')).toBe(true); t.setNextConfirmReturnValue(true); t.expect(confirm('baz')).toBe(true); }); t.it('Should support prompt() call', function (t) { // Should not freeze prompt('foo'); t.setNextPromptReturnValue('foobar'); t.expect(prompt('foo')).toBe('foobar'); t.setNextPromptReturnValue('bazfoo'); t.expect(prompt('foo')).toBe('bazfoo'); }); });