%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 : /proc/thread-self/root/var/www/html/ppaobm/vendor/bower-asset/sweetalert2/test/qunit/api/ |
Upload File : |
const { Swal, initialSwalPropNames } = require('../helpers') QUnit.test('properties of `Swal` class are consistent', (assert) => { const done = assert.async() const assertConsistent = postfix => { const currentSwalPropNames = Object.keys(Swal) const extraPropNames = currentSwalPropNames.filter(key => !initialSwalPropNames.includes(key)) assert.deepEqual(extraPropNames.length, 0, `# of extra properties ${postfix}`) assert.deepEqual(extraPropNames.join(','), '', `extra property names ${postfix}`) const missingProps = currentSwalPropNames.filter(key => !currentSwalPropNames.includes(key)) assert.deepEqual(missingProps.length, 0, `# of missing properties ${postfix}`) assert.deepEqual(missingProps.join(','), '', `missing property names ${postfix}`) } assertConsistent('before first swal') Swal({ title: 'test', onOpen: () => { assertConsistent('after opening first swal') Swal.clickConfirm() } }).then(() => { assertConsistent('after closing first swal') done() }) }) QUnit.test('defaults are applied to undefined arguments in shorthand calls', (assert) => { const done = assert.async() Swal.setDefaults({ html: 'foo', onOpen: () => { assert.equal(Swal.getTitle().textContent, 'bar') assert.equal(Swal.getContent().textContent, 'foo') Swal.resetDefaults() done() } }) Swal('bar') }) QUnit.test('ways to instantiate', (assert) => { assert.ok((new Swal('foo')) instanceof Swal) assert.ok(Swal.fire('foo') instanceof Swal) assert.ok(Swal('foo') instanceof Swal) }) QUnit.test('instance properties and methods', (assert) => { const params = { input: 'text', inputValue: 'foo' } const swal = Swal(params) assert.deepEqual(Object.keys(swal), ['params']) assert.deepEqual(swal.params, params) assert.equal(swal.getInput().value, 'foo') }) QUnit.test('extending swal', (assert) => { const done = assert.async() const MySwal = class extends Swal { static argsToParams (args) { assert.deepEqual(args, ['arg']) return { title: 'title' } } _main (params) { assert.deepEqual(params, { title: 'title' }) return super._main({ input: 'text', inputValue: 'inputValue', onOpen: () => MySwal.clickConfirm() }).then(result => { assert.deepEqual(result, { value: 'inputValue' }) return 'result' }) } } MySwal.fire('arg').then(result => { assert.equal(result, 'result') done() }) })