diff --git a/src/internal/utils/__tests__/node-belongs.test.ts b/src/internal/utils/__tests__/node-belongs.test.ts index 31f8f99e99..24969d02c0 100644 --- a/src/internal/utils/__tests__/node-belongs.test.ts +++ b/src/internal/utils/__tests__/node-belongs.test.ts @@ -3,8 +3,16 @@ import { nodeBelongs } from '../../../../lib/components/internal/utils/node-belongs'; describe('nodeBelongs', () => { + let div: HTMLDivElement; + + beforeEach(() => { + div = document.createElement('div'); + document.documentElement.appendChild(div); + }); + + afterEach(() => document.documentElement.removeChild(div)); + test('returns "true", when the node and the container are the same element', () => { - const div = document.createElement('div'); div.innerHTML = `
`; @@ -12,7 +20,6 @@ describe('nodeBelongs', () => { }); test('returns "true", when the node is descendant from the container', () => { - const div = document.createElement('div'); div.innerHTML = `