0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-12-04 20:58:36 +01:00
gitea/web_src/js/utils/dom.test.js
wxiaoguang a88f718c10
Refactor dropzone (#31482)
Refactor the legacy code and remove some jQuery calls.
2024-06-27 01:01:20 +08:00

16 lines
553 B
JavaScript

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>');
});