/
githubmr
/
facebook-react
Обзор
Документация
Войти
/
githubmr
/
facebook-react
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
packages/react-dom/src/client/__tests__/dangerouslySetInnerHTML-test.js
30 строк
851 B
Ricky
Remove disableIEWorkarounds (#31756)
13 дек 2024, 20:26
Не верифицирован
13 дек 2024, 20:26
fb12845
Код
Авторство
О чём код?
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @emails react-core */ 'use strict'; const React = require('react'); const ReactDOMClient = require('react-dom/client'); const act = require('internal-test-utils').act; describe('dangerouslySetInnerHTML', () => { describe('when the node has innerHTML property', () => { it('sets innerHTML on it', async () => { const container = document.createElement('div'); const root = ReactDOMClient.createRoot(container); await act(() => { root.render( <div dangerouslySetInnerHTML={{__html: '<h1>Hello</h1>'}} />, ); }); expect(container.firstChild.innerHTML).toBe('<h1>Hello</h1>'); }); }); });