Try/finally
Dan Abramov committed
Sep 4, 2018 at 14:21 UTC
52633c84e2af140466a9771e8cfa024d6bc1a8a7
1 file changed
+17
-11
packages/react-dom/src/__tests__/ReactServerRenderingHydration.js
+17
-11
@@ -283,19 +283,25 @@ describe('ReactDOMServerHydration', () => {
283
284
it('should not warn when the style property differs on whitespace or order in IE', () => {
285
document.documentMode = 11;
286
- const element = document.createElement('div');
286
+ try {
287
+ const element = document.createElement('div');
288
288
- // Simulate IE normalizing the style attribute. IE makes it equal to
289
- // what's available under `node.style.cssText`.
290
- element.innerHTML =
291
- '<div style="height: 10px; color: black; text-decoration: none;" data-reactroot=""></div>';
289
+ // Simulate IE normalizing the style attribute. IE makes it equal to
290
+ // what's available under `node.style.cssText`.
291
+ element.innerHTML =
292
+ '<div style="height: 10px; color: black; text-decoration: none;" data-reactroot=""></div>';
293
293
- ReactDOM.hydrate(
294
- <div style={{textDecoration: 'none', color: 'black', height: '10px'}} />,
295
- element,
296
- );
297
-
298
- delete document.documentMode;
294
+ // We don't expect to see false positive warnings.
295
+ // https://github.com/facebook/react/issues/11807
296
+ ReactDOM.hydrate(
297
+ <div
298
+ style={{textDecoration: 'none', color: 'black', height: '10px'}}
299
+ />,
300
+ element,
301
+ );
302
+ } finally {
303
+ delete document.documentMode;
304
+ }
305
});
306
307
it('should warn when the style property differs on whitespace in non-IE browsers', () => {