725
);
726
expect(e.getAttribute('dangerouslySetInnerHTML')).toBe(null);
727
});
728
+
729
+ itRenders('no suppressContentEditableWarning attribute', async render => {
730
+ const e = await render(<div suppressContentEditableWarning={true} />);
731
+ expect(e.getAttribute('suppressContentEditableWarning')).toBe(null);
732
+ });
733
+
734
+ itRenders('no suppressHydrationWarning attribute', async render => {
735
+ const e = await render(<span suppressHydrationWarning={true} />);
736
+ expect(e.getAttribute('suppressHydrationWarning')).toBe(null);
737
+ });
738
});
739
740
describe('inline styles', function() {
2633
2634
it('should error reconnecting different attribute values', () =>
2635
expectMarkupMismatch(<div id="foo" />, <div id="bar" />));
2636
+
2637
+ it('can explicitly ignore errors reconnecting different element types of children', () =>
2638
+ expectMarkupMatch(
2639
+ <div><div /></div>,
2640
+ <div suppressHydrationWarning={true}><span /></div>,
2641
+ ));
2642
+
2643
+ it('can explicitly ignore errors reconnecting missing attributes', () =>
2644
+ expectMarkupMatch(
2645
+ <div id="foo" />,
2646
+ <div suppressHydrationWarning={true} />,
2647
+ ));
2648
+
2649
+ it('can explicitly ignore errors reconnecting added attributes', () =>
2650
+ expectMarkupMatch(
2651
+ <div />,
2652
+ <div id="foo" suppressHydrationWarning={true} />,
2653
+ ));
2654
+
2655
+ it('can explicitly ignore errors reconnecting different attribute values', () =>
2656
+ expectMarkupMatch(
2657
+ <div id="foo" />,
2658
+ <div id="bar" suppressHydrationWarning={true} />,
2659
+ ));
2660
+
2661
+ it('can not deeply ignore errors reconnecting different attribute values', () =>
2662
+ expectMarkupMismatch(
2663
+ <div><div id="foo" /></div>,
2664
+ <div suppressHydrationWarning={true}><div id="bar" /></div>,
2665
+ ));
2666
});
2667
2668
describe('inline styles', function() {
2701
<div style={{width: '1px', fontSize: '2px'}} />,
2702
<div style={{fontSize: '2px', width: '1px'}} />,
2703
));
2704
+
2705
+ it('can explicitly ignore errors reconnecting added style values', () =>
2706
+ expectMarkupMatch(
2707
+ <div style={{}} />,
2708
+ <div style={{width: '1px'}} suppressHydrationWarning={true} />,
2709
+ ));
2710
+
2711
+ it('can explicitly ignore reconnecting different style values', () =>
2712
+ expectMarkupMatch(
2713
+ <div style={{width: '1px'}} />,
2714
+ <div style={{width: '2px'}} suppressHydrationWarning={true} />,
2715
+ ));
2716
});
2717
2718
describe('text nodes', function() {
2733
<div>{'Text1'}{'Text2'}</div>,
2734
<div>{'Text1'}{'Text3'}</div>,
2735
));
2736
+
2737
+ it('can explicitly ignore reconnecting different text', () =>
2738
+ expectMarkupMatch(
2739
+ <div>Text</div>,
2740
+ <div suppressHydrationWarning={true}>Other Text</div>,
2741
+ ));
2742
+
2743
+ it('can explicitly ignore reconnecting different text in two code blocks', () =>
2744
+ expectMarkupMatch(
2745
+ <div suppressHydrationWarning={true}>{'Text1'}{'Text2'}</div>,
2746
+ <div suppressHydrationWarning={true}>{'Text1'}{'Text3'}</div>,
2747
+ ));
2748
});
2749
2750
describe('element trees and children', function() {
2795
2796
it('can distinguish an empty component from an empty text component', () =>
2797
expectMarkupMatch(<div><EmptyComponent /></div>, <div>{''}</div>));
2798
+
2799
+ it('can explicitly ignore reconnecting more children', () =>
2800
+ expectMarkupMatch(
2801
+ <div><div /></div>,
2802
+ <div suppressHydrationWarning={true}><div /><div /></div>,
2803
+ ));
2804
+
2805
+ it('can explicitly ignore reconnecting fewer children', () =>
2806
+ expectMarkupMatch(
2807
+ <div><div /><div /></div>,
2808
+ <div suppressHydrationWarning={true}><div /></div>,
2809
+ ));
2810
+
2811
+ it('can explicitly ignore reconnecting reordered children', () =>
2812
+ expectMarkupMatch(
2813
+ <div suppressHydrationWarning={true}><div /><span /></div>,
2814
+ <div suppressHydrationWarning={true}><span /><div /></div>,
2815
+ ));
2816
+
2817
+ it('can not deeply ignore reconnecting reordered children', () =>
2818
+ expectMarkupMismatch(
2819
+ <div suppressHydrationWarning={true}><div><div /><span /></div></div>,
2820
+ <div suppressHydrationWarning={true}><div><span /><div /></div></div>,
2821
+ ));
2822
});
2823
2824
// Markup Mismatches: misc
2827
<div dangerouslySetInnerHTML={{__html: "<span id='child1'/>"}} />,
2828
<div dangerouslySetInnerHTML={{__html: "<span id='child2'/>"}} />,
2829
));
2830
+
2831
+ it('can explicitly ignore reconnecting a div with different dangerouslySetInnerHTML', () =>
2832
+ expectMarkupMatch(
2833
+ <div dangerouslySetInnerHTML={{__html: "<span id='child1'/>"}} />,
2834
+ <div
2835
+ dangerouslySetInnerHTML={{__html: "<span id='child2'/>"}}
2836
+ suppressHydrationWarning={true}
2837
+ />,
2838
+ ));
2839
});
2840
});