@samitouri / QOS-React / commits / a99d77e073

added a regression test for factory components

Dominic Gannaway committed Feb 23, 2017 at 14:00 UTC a99d77e0732fcfd0dc9e3afb090499e4a7076557
2 files changed +14 -2
scripts/fiber/tests-passing.txt
+1
@@ -842,6 +842,7 @@ src/renderers/__tests__/refs-destruction-test.js
842
843 src/renderers/__tests__/refs-test.js
844 * Should increase refs with an increase in divs
845 +* Should correctly get the ref
846 * Allow refs to hop around children correctly
847 * always has a value for this.refs
848 * ref called correctly for stateless component when __DEV__ = false
src/renderers/__tests__/refs-test.js
+13 -2
@@ -144,12 +144,23 @@ describe('reactiverefs', () => {
144 // Now reset again
145 ReactTestUtils.Simulate.click(testRefsComponent.refs.resetDiv);
146 expectClickLogsLengthToBe(testRefsComponent, 1);
147 -
147 });
149 -
148 });
149
150 +describe('factory components', () => {
151 + it('Should correctly get the ref', () => {
152 + function Comp() {
153 + return {
154 + render() {
155 + return <div ref="elemRef" />;
156 + },
157 + };
158 + }
159
160 + const inst = ReactTestUtils.renderIntoDocument(<Comp />);
161 + expect(inst.refs.elemRef.tagName).toBe('DIV');
162 + });
163 +});
164
165 /**
166 * Tests that when a ref hops around children, we can track that correctly.