/
githubmirror
/
preact
Обзор
Документация
Войти
/
githubmirror
/
preact
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
compat/test/browser/unmountComponentAtNode.test.jsx
28 строк
723 B
Ryan Christian
test: Switch tests to use `.jsx` file extension (#4925)
29 сен 2025, 16:58
Не верифицирован
29 сен 2025, 16:58
8e3e4ce
Код
Авторство
О чём код?
import React, { createElement, unmountComponentAtNode } from 'preact/compat'; import { setupScratch, teardown } from '../../../test/_util/helpers'; describe('unmountComponentAtNode', () => { /** @type {HTMLDivElement} */ let scratch; beforeEach(() => { scratch = setupScratch(); }); afterEach(() => { teardown(scratch); }); it('should unmount a root node', () => { const App = () => <div>foo</div>; React.render(<App />, scratch); expect(unmountComponentAtNode(scratch)).to.equal(true); expect(scratch.innerHTML).to.equal(''); }); it('should do nothing if root is not mounted', () => { expect(unmountComponentAtNode(scratch)).to.equal(false); expect(scratch.innerHTML).to.equal(''); }); });