Disable tests of recovering from node.normalize() (#9853)
According to #9836 we're intentionally chosing to not support this until we have better proof of this being a big need. E.g. to protect against extensions. In a way that it's not better to push extensions to be fixed.
Sebastian Markbåge committed
Jun 5, 2017 at 16:46 UTC
195aa65198ba9666c3d9fd6e26fb81d76ab7097e
2 files changed
+74
-54
scripts/fiber/tests-failing.txt
-6
@@ -3,9 +3,3 @@ src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js
3
* should not blow away user-entered text on successful reconnect to a controlled checkbox
4
* should not blow away user-selected value on successful reconnect to an uncontrolled select
5
* should not blow away user-selected value on successful reconnect to an controlled select
6
-
7
-src/renderers/dom/shared/__tests__/ReactDOMTextComponent-test.js
8
-* can reconcile text merged by Node.normalize() alongside other elements
9
-* can reconcile text merged by Node.normalize()
10
-* can reconcile text arbitrarily split into multiple nodes
11
-* can reconcile text arbitrarily split into multiple nodes on some substitutions only
src/renderers/dom/shared/__tests__/ReactDOMTextComponent-test.js
+74
-48
@@ -74,22 +74,33 @@ describe('ReactDOMTextComponent', () => {
74
expect(childNodes[2].data).toBe('bar');
75
});
76
77
- it('can reconcile text merged by Node.normalize() alongside other elements', () => {
78
- var el = document.createElement('div');
79
- var inst = ReactDOM.render(
80
- <div>{'foo'}{'bar'}{'baz'}<span />{'qux'}</div>,
81
- el,
82
- );
83
-
84
- var container = ReactDOM.findDOMNode(inst);
85
- container.normalize();
86
-
87
- inst = ReactDOM.render(<div>{'bar'}{'baz'}{'qux'}<span />{'foo'}</div>, el);
88
- container = ReactDOM.findDOMNode(inst);
89
- expect(container.textContent).toBe('barbazquxfoo');
90
- });
91
-
92
- it('can reconcile text merged by Node.normalize()', () => {
77
+ /**
78
+ * The following Node.normalize() tests are intentionally failing.
79
+ * See #9836 tracking whether we'll need to fix this or if it's unnecessary.
80
+ */
81
+
82
+ xit(
83
+ 'can reconcile text merged by Node.normalize() alongside other elements',
84
+ () => {
85
+ var el = document.createElement('div');
86
+ var inst = ReactDOM.render(
87
+ <div>{'foo'}{'bar'}{'baz'}<span />{'qux'}</div>,
88
+ el,
89
+ );
90
+
91
+ var container = ReactDOM.findDOMNode(inst);
92
+ container.normalize();
93
+
94
+ inst = ReactDOM.render(
95
+ <div>{'bar'}{'baz'}{'qux'}<span />{'foo'}</div>,
96
+ el,
97
+ );
98
+ container = ReactDOM.findDOMNode(inst);
99
+ expect(container.textContent).toBe('barbazquxfoo');
100
+ },
101
+ );
102
+
103
+ xit('can reconcile text merged by Node.normalize()', () => {
104
var el = document.createElement('div');
105
var inst = ReactDOM.render(<div>{'foo'}{'bar'}{'baz'}</div>, el);
106
@@ -116,7 +127,7 @@ describe('ReactDOMTextComponent', () => {
127
expect(el.textContent).toBe('');
128
});
129
119
- it('can reconcile text arbitrarily split into multiple nodes', () => {
130
+ xit('can reconcile text arbitrarily split into multiple nodes', () => {
131
var el = document.createElement('div');
132
var inst = ReactDOM.render(<div><span />{'foobarbaz'}</div>, el);
133
@@ -138,37 +149,52 @@ describe('ReactDOMTextComponent', () => {
149
expect(container.textContent).toBe('barbazqux');
150
});
151
141
- it('can reconcile text arbitrarily split into multiple nodes on some substitutions only', () => {
152
+ xit(
153
+ 'can reconcile text arbitrarily split into multiple nodes on some substitutions only',
154
+ () => {
155
+ var el = document.createElement('div');
156
+ var inst = ReactDOM.render(
157
+ <div>
158
+ <span />{'bar'}<span />{'foobarbaz'}{'foo'}{'barfoo'}<span />
159
+ </div>,
160
+ el,
161
+ );
162
+
163
+ var container = ReactDOM.findDOMNode(inst);
164
+ let childNodes = filterOutComments(ReactDOM.findDOMNode(inst).childNodes);
165
+ let textNode = childNodes[3];
166
+ textNode.textContent = 'foo';
167
+ container.insertBefore(
168
+ document.createTextNode('bar'),
169
+ childNodes[3].nextSibling,
170
+ );
171
+ container.insertBefore(
172
+ document.createTextNode('baz'),
173
+ childNodes[3].nextSibling,
174
+ );
175
+ let secondTextNode = childNodes[5];
176
+ secondTextNode.textContent = 'bar';
177
+ container.insertBefore(
178
+ document.createTextNode('foo'),
179
+ childNodes[5].nextSibling,
180
+ );
181
+
182
+ inst = ReactDOM.render(
183
+ <div>
184
+ <span />{'baz'}<span />{'barbazqux'}{'bar'}{'bazbar'}<span />
185
+ </div>,
186
+ el,
187
+ );
188
+ container = ReactDOM.findDOMNode(inst);
189
+ expect(container.textContent).toBe('bazbarbazquxbarbazbar');
190
+ },
191
+ );
192
+
193
+ xit('can unmount normalized text nodes', () => {
194
var el = document.createElement('div');
143
- var inst = ReactDOM.render(
144
- <div><span />{'bar'}<span />{'foobarbaz'}{'foo'}{'barfoo'}<span /></div>,
145
- el,
146
- );
147
-
148
- var container = ReactDOM.findDOMNode(inst);
149
- let childNodes = filterOutComments(ReactDOM.findDOMNode(inst).childNodes);
150
- let textNode = childNodes[3];
151
- textNode.textContent = 'foo';
152
- container.insertBefore(
153
- document.createTextNode('bar'),
154
- childNodes[3].nextSibling,
155
- );
156
- container.insertBefore(
157
- document.createTextNode('baz'),
158
- childNodes[3].nextSibling,
159
- );
160
- let secondTextNode = childNodes[5];
161
- secondTextNode.textContent = 'bar';
162
- container.insertBefore(
163
- document.createTextNode('foo'),
164
- childNodes[5].nextSibling,
165
- );
166
-
167
- inst = ReactDOM.render(
168
- <div><span />{'baz'}<span />{'barbazqux'}{'bar'}{'bazbar'}<span /></div>,
169
- el,
170
- );
171
- container = ReactDOM.findDOMNode(inst);
172
- expect(container.textContent).toBe('bazbarbazquxbarbazbar');
195
+ ReactDOM.render(<div>{''}{'foo'}{'bar'}</div>, el);
196
+ el.normalize();
197
+ ReactDOM.render(<div />, el);
198
+ expect(el.innerHTML).toBe('<div></div>');
199
});
200
});