mirror of
https://github.com/go-gitea/gitea.git
synced 2024-11-28 22:33:32 +01:00
e3678356e1
The "false" value was not handled correctly, it would cause bugs in the future (fortunately, this behavior is not used in code yet).
19 lines
603 B
TypeScript
19 lines
603 B
TypeScript
import {createElementFromAttrs, createElementFromHTML} from './dom.ts';
|
|
|
|
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,
|
|
checked: false,
|
|
required: null,
|
|
tabindex: 0,
|
|
});
|
|
expect(el.outerHTML).toEqual('<button id="the-id" class="cls-1 cls-2" data-foo="the-data" disabled="" tabindex="0"></button>');
|
|
});
|