import $, {VeamsQueryObject} from '../src'; test('append() - append element (HTML String)', () => { document.body.innerHTML = `

text content 2

text content 2
text content 3
`; const $targetEls: VeamsQueryObject = $('.target-el'); $targetEls.append('inserted element'); expect(document.querySelectorAll('strong')).toHaveLength(2); expect($targetEls[0].lastChild.tagName).toBe('STRONG'); expect($targetEls[1].lastChild.tagName).toBe('STRONG'); }); test('append() - append element (VeamsQueryObject)', () => { document.body.innerHTML = `

text content 2

text content 2
text content 3
`; const $targetEls: VeamsQueryObject = $('.target-el'); const $insertEl: VeamsQueryObject = $('inserted element'); $targetEls.append($insertEl); expect(document.querySelectorAll('strong')).toHaveLength(1); expect($targetEls[1].lastChild.tagName).toBe('STRONG'); }); test('append() - append element (HTMLElement)', () => { document.body.innerHTML = `

text content 2

text content 2
text content 3
`; const $targetEls: VeamsQueryObject = $('.target-el'); const insertEl: HTMLElement = document.createElement('strong'); insertEl.textContent = 'inserted element'; $targetEls.append(insertEl); expect(document.querySelectorAll('strong')).toHaveLength(1); expect($targetEls[1].lastChild.tagName).toBe('STRONG'); });