import '@testing-library/jest-dom'; import $, {VeamsQueryObject} from '../src'; test('text() - get text', () => { document.body.innerHTML = `

text content 1

text content 2
text content 3
`; const $targetEls: VeamsQueryObject = $('.target-el'); const text1: string = $targetEls.text() as string; expect(text1).toBe('text content 1 text content 2 text content 3'); }); test('text() - set text', () => { document.body.innerHTML = `

text content 1

text content 2
text content 3
`; const $targetEls: VeamsQueryObject = $('.target-el'); expect($targetEls[0].children).toHaveLength(1); expect($targetEls[2].children).toHaveLength(1); $targetEls.text('new text content'); expect($targetEls[0]).toHaveTextContent('new text content'); expect($targetEls[0].children).toHaveLength(0); expect($targetEls[1]).toHaveTextContent('new text content'); expect($targetEls[2]).toHaveTextContent('new text content'); expect($targetEls[2].children).toHaveLength(0); });