%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
| Server IP : 14.207.165.8 / Your IP : 216.73.216.26 Web Server : Apache/2.4.18 (Ubuntu) System : Linux 246 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : root ( 0) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/ppaobm/vendor/bower-asset/sweetalert2/test/qunit/ |
Upload File : |
const { $, Swal, SwalWithoutAnimation } = require('./helpers')
const sinon = require('sinon/pkg/sinon')
QUnit.test('.swal2-toast-shown', (assert) => {
Swal({ toast: true })
assert.ok(document.body.classList.contains('swal2-toast-shown'))
assert.ok(document.documentElement.classList.contains('swal2-toast-shown'))
Swal({ toast: false })
assert.notOk(document.body.classList.contains('swal2-toast-shown'))
assert.notOk(document.documentElement.classList.contains('swal2-toast-shown'))
})
QUnit.test('should throw console warnings for incompatible parameters', (assert) => {
const _consoleWarn = console.warn
const spy = sinon.spy(console, 'warn')
SwalWithoutAnimation({
allowOutsideClick: true,
toast: true
})
assert.ok(spy.calledWith('SweetAlert2: The parameter "allowOutsideClick" is incompatible with toasts'))
console.warn = _consoleWarn
})
QUnit.test('.swal2-toast-column if input', (assert) => {
const inputs = ['text', 'email', 'password', 'number', 'tel', 'range', 'textarea', 'select', 'radio', 'checkbox', 'file', 'url']
inputs.forEach((input) => {
SwalWithoutAnimation({ toast: true, input: input })
assert.ok(document.body.classList.contains('swal2-toast-column'))
SwalWithoutAnimation({ input: input })
assert.notOk(document.body.classList.contains('swal2-toast-column'))
})
})
QUnit.test('.swal2-toast-column if footer', (assert) => {
SwalWithoutAnimation({ toast: true, footer: 'footer' })
assert.ok(document.body.classList.contains('swal2-toast-column'))
SwalWithoutAnimation({ footer: 'footer' })
assert.notOk(document.body.classList.contains('swal2-toast-column'))
})
QUnit.test('.swal2-toast-column if close button', (assert) => {
SwalWithoutAnimation({ toast: true, showCloseButton: true })
assert.ok(document.body.classList.contains('swal2-toast-column'))
SwalWithoutAnimation({ showCloseButton: true })
assert.notOk(document.body.classList.contains('swal2-toast-column'))
})
QUnit.test('toast click closes when no buttons or input are specified', (assert) => {
const done = assert.async()
SwalWithoutAnimation({
title: 'toast click close',
toast: true,
showConfirmButton: false
}).then((result) => {
assert.deepEqual(result, { dismiss: Swal.DismissReason.close })
done()
})
$('.swal2-popup').click()
})
QUnit.test('toast click does not close if cancel button is present', (assert) => {
const done = assert.async()
SwalWithoutAnimation({
title: 'toast no close with button present',
toast: true,
showConfirmButton: false,
showCancelButton: true
})
$('.swal2-popup').click()
setTimeout(() => {
assert.ok(Swal.isVisible())
done()
})
})
QUnit.test('toast click does not close if input option is specified', (assert) => {
const done = assert.async()
SwalWithoutAnimation({
title: 'toast no close with input present',
toast: true,
showConfirmButton: false,
showCancelButton: false,
input: 'text'
})
$('.swal2-popup').click()
setTimeout(() => {
assert.ok(Swal.isVisible())
done()
})
})