Refactor dropzone (#31482)

Refactor the legacy code and remove some jQuery calls.
This commit is contained in:
wxiaoguang 2024-06-27 01:01:20 +08:00 committed by GitHub
parent 35ce7a5e0e
commit a88f718c10
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 183 additions and 183 deletions

View file

@ -1,5 +1,16 @@
import {createElementFromHTML} from './dom.js';
import {createElementFromAttrs, createElementFromHTML} from './dom.js';
test('createElementFromHTML', () => {
expect(createElementFromHTML('<a>foo<span>bar</span></a>').outerHTML).toEqual('<a>foo<span>bar</span></a>');
});
test('createElementFromAttrs', () => {
const el = createElementFromAttrs('button', {
id: 'the-id',
class: 'cls-1 cls-2',
'data-foo': 'the-data',
disabled: true,
required: null,
});
expect(el.outerHTML).toEqual('<button id="the-id" class="cls-1 cls-2" data-foo="the-data" disabled=""></button>');
});