blessing-skin-server/resources/assets/tests/js/notify.test.ts

22 lines
513 B
TypeScript
Raw Normal View History

2019-03-15 11:42:41 +08:00
import $ from 'jquery'
import * as notify from '@/js/notify'
2018-09-07 23:58:00 +08:00
test('show AJAX error', () => {
2019-03-17 21:09:46 +08:00
// @ts-ignore
2019-03-15 11:42:41 +08:00
$.fn.modal = function () {
document.body.innerHTML = this.html()
}
notify.showAjaxError(new Error('an-error'))
expect(document.body.innerHTML).toContain('an-error')
})
2019-03-17 10:21:18 +08:00
2018-09-07 23:58:00 +08:00
test('show modal', () => {
2019-03-15 11:42:41 +08:00
notify.showModal('message')
expect($('.modal-title').html()).toBe('Message')
notify.showModal('message', '', 'default', {
callback: () => undefined,
destroyOnClose: false,
})
})