MCPcopy
hub / github.com/react/react / assertNamespacesMatch

Function assertNamespacesMatch

packages/react-dom/src/__tests__/ReactDOMFiber-test.js:191–213  ·  view source on GitHub ↗
(tree)

Source from the content-addressed store, hash-verified

189 };
190
191 const assertNamespacesMatch = async function (tree) {
192 const testContainer = document.createElement('div');
193 svgEls = [];
194 htmlEls = [];
195 mathEls = [];
196
197 const testRoot = ReactDOMClient.createRoot(testContainer);
198 await act(async () => {
199 testRoot.render(tree);
200 });
201 svgEls.forEach(el => {
202 expect(el.namespaceURI).toBe('http://www.w3.org/2000/svg');
203 });
204 htmlEls.forEach(el => {
205 expect(el.namespaceURI).toBe('http://www.w3.org/1999/xhtml');
206 });
207 mathEls.forEach(el => {
208 expect(el.namespaceURI).toBe('http://www.w3.org/1998/Math/MathML');
209 });
210
211 testRoot.unmount();
212 expect(testContainer.innerHTML).toBe('');
213 };
214
215 it('should render one portal', async () => {
216 const portalContainer = document.createElement('div');

Callers 2

Calls 4

actFunction · 0.70
renderMethod · 0.65
forEachMethod · 0.65
toBeMethod · 0.65

Tested by

no test coverage detected