diff options
Diffstat (limited to 'web_src/js/utils/dom.test.js')
-rw-r--r-- | web_src/js/utils/dom.test.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/web_src/js/utils/dom.test.js b/web_src/js/utils/dom.test.js index fd7d97cad5..b9212ec284 100644 --- a/web_src/js/utils/dom.test.js +++ b/web_src/js/utils/dom.test.js @@ -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>'); +}); |