diff --git a/test/browser/refs.test.js b/test/browser/refs.test.js
index 905444fd34..b176e6da3a 100644
--- a/test/browser/refs.test.js
+++ b/test/browser/refs.test.js
@@ -536,4 +536,69 @@ describe('refs', () => {
expect(el.innerHTML).to.be.equal('Bar');
expect(ref.current.innerHTML).to.be.equal('Foo');
});
+
+ it.skip('should not remove refs for memoized components keyed', () => {
+ const ref = createRef();
+ const element =
hey
;
+ function App(props) {
+ return {element}
;
+ }
+
+ render(, scratch);
+ expect(ref.current).to.equal(scratch.firstChild.firstChild);
+ render(, scratch);
+ expect(ref.current).to.equal(scratch.firstChild.firstChild);
+ render(, scratch);
+ expect(ref.current).to.equal(scratch.firstChild.firstChild);
+ });
+
+ it('should not remove refs for memoized components unkeyed', () => {
+ const ref = createRef();
+ const element = hey
;
+ function App(props) {
+ return {element}
;
+ }
+
+ render(, scratch);
+ expect(ref.current).to.equal(scratch.firstChild.firstChild);
+ render(, scratch);
+ expect(ref.current).to.equal(scratch.firstChild.firstChild);
+ render(, scratch);
+ expect(ref.current).to.equal(scratch.firstChild.firstChild);
+ });
+
+ // TODO
+ it.skip('should properly call null for memoized components keyed', () => {
+ const calls = [];
+ const element = calls.push(x)}>hey
;
+ function App(props) {
+ return {element}
;
+ }
+
+ render(, scratch);
+ render(, scratch);
+ render(, scratch);
+ expect(calls.length).to.equal(5);
+ expect(calls).to.deep.equal([
+ scratch.firstChild.firstChild,
+ null,
+ scratch.firstChild.firstChild,
+ null,
+ scratch.firstChild.firstChild
+ ]);
+ });
+
+ it('should properly call null for memoized components unkeyed', () => {
+ const calls = [];
+ const element = calls.push(x)}>hey
;
+ function App(props) {
+ return {element}
;
+ }
+
+ render(, scratch);
+ render(, scratch);
+ render(, scratch);
+ expect(calls.length).to.equal(1);
+ expect(calls[0]).to.equal(scratch.firstChild.firstChild);
+ });
});