Skip to content

Commit d694e15

Browse files
author
Jack Pope
committed
Clean up IE behavior test in trustedTypes-test
1 parent b77ecb1 commit d694e15

File tree

1 file changed

+0
-49
lines changed

1 file changed

+0
-49
lines changed

packages/react-dom/src/client/__tests__/trustedTypes-test.internal.js

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -206,55 +206,6 @@ describe('when Trusted Types are available in global object', () => {
206206
}
207207
});
208208

209-
describe('dangerouslySetInnerHTML in svg elements in Internet Explorer', () => {
210-
let innerHTMLDescriptor;
211-
212-
// simulate svg elements in Internet Explorer which don't have 'innerHTML' property
213-
beforeEach(() => {
214-
innerHTMLDescriptor = Object.getOwnPropertyDescriptor(
215-
Element.prototype,
216-
'innerHTML',
217-
);
218-
delete Element.prototype.innerHTML;
219-
Object.defineProperty(
220-
HTMLDivElement.prototype,
221-
'innerHTML',
222-
innerHTMLDescriptor,
223-
);
224-
});
225-
226-
afterEach(() => {
227-
delete HTMLDivElement.prototype.innerHTML;
228-
Object.defineProperty(
229-
Element.prototype,
230-
'innerHTML',
231-
innerHTMLDescriptor,
232-
);
233-
});
234-
235-
it('should log a warning', async () => {
236-
class Component extends React.Component {
237-
render() {
238-
return <svg dangerouslySetInnerHTML={{__html: 'unsafe html'}} />;
239-
}
240-
}
241-
const root = ReactDOMClient.createRoot(container);
242-
await expect(async () => {
243-
await act(() => {
244-
root.render(<Component />);
245-
});
246-
}).toErrorDev(
247-
"Using 'dangerouslySetInnerHTML' in an svg element with " +
248-
'Trusted Types enabled in an Internet Explorer will cause ' +
249-
'the trusted value to be converted to string. Assigning string ' +
250-
"to 'innerHTML' will throw an error if Trusted Types are enforced. " +
251-
"You can try to wrap your svg element inside a div and use 'dangerouslySetInnerHTML' " +
252-
'on the enclosing div instead.',
253-
);
254-
expect(container.innerHTML).toBe('<svg>unsafe html</svg>');
255-
});
256-
});
257-
258209
it('should warn once when rendering script tag in jsx on client', async () => {
259210
const root = ReactDOMClient.createRoot(container);
260211
await expect(async () => {

0 commit comments

Comments
 (0)