%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 49.231.201.246 / Your IP : 216.73.216.41 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') QUnit.test('default focus', (assert) => { const done = assert.async() SwalWithoutAnimation('Modal with the Confirm button only') assert.equal(document.activeElement, document.querySelector('.swal2-confirm')) SwalWithoutAnimation({ text: 'Modal with two buttons', showCancelButton: true }) assert.equal(document.activeElement, document.querySelector('.swal2-confirm')) SwalWithoutAnimation({ text: 'Modal with no focusable elements in it', showConfirmButton: false }) assert.equal(document.activeElement, document.querySelector('.swal2-modal')) SwalWithoutAnimation({ text: 'Modal with an input', input: 'text', onOpen: () => { assert.equal(document.activeElement, document.querySelector('.swal2-input')) done() } }) }) QUnit.test('focusConfirm', (assert) => { Swal({ showCancelButton: true }) assert.equal(document.activeElement, $('.swal2-confirm')) const anchor = document.createElement('a') anchor.innerText = 'link' anchor.href = '' Swal({ html: anchor, showCancelButton: true, focusConfirm: false }) assert.equal(document.activeElement.outerHTML, anchor.outerHTML) }) QUnit.test('focusCancel', (assert) => { Swal({ text: 'Modal with Cancel button focused', showCancelButton: true, focusCancel: true }) assert.equal(document.activeElement, $('.swal2-cancel')) }) // TODO(@limonte): this test needs to be revisited // is passes even runs (2nd, 4th, 6th) and fails odd runs (1st, 3rd, 5th) // I suspect something is wrong with the testing environment as the same // code passes always outside it // QUnit.test('previousActiveElement', (assert) => { // const done = assert.async() // const buttonToast = document.createElement('button') // buttonToast.innerText = 'Show toast' // document.body.appendChild(buttonToast) // const buttonModal = document.createElement('button') // buttonModal.innerText = 'Show modal' // document.body.appendChild(buttonModal) // buttonToast.addEventListener('click', () => { // SwalWithoutAnimation({ // text: 'I should not touch previousActiveElement', // toast: true, // timer: 1, // onAfterClose: () => { // buttonModal.focus() // buttonModal.click() // } // }) // }) // buttonModal.addEventListener('click', () => { // SwalWithoutAnimation({ // text: 'I should trap focus inside myself and restore previousActiveElement when I\'m closed', // timer: 1, // onAfterClose: () => { // assert.equal(document.activeElement, buttonModal) // done() // } // }) // }) // buttonToast.click() // })