mirror of
https://github.com/go-gitea/gitea
synced 2024-08-26 17:23:57 +02:00
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>');
|
|
});
|