Browse Source

testing passing props

Daniel Zlotin 8 years ago
parent
commit
6a409be54d
1 changed files with 27 additions and 28 deletions
  1. 27
    28
      src2/containers/ContainerRegistry.test.js

+ 27
- 28
src2/containers/ContainerRegistry.test.js View File

@@ -52,32 +52,31 @@ describe('ComponentRegistry', () => {
52 52
     );
53 53
     expect(tree.toJSON().children).toEqual(['Hello, Daniel!']);
54 54
   });
55
-  //
56
-  //xit('updates props into original container', () => {
57
-  //uut.registerContainer('example.MyContainer', () => MyContainer);
58
-  //
59
-  //const NavigationContainer = getRegisteredComponentClassFromAppRegistry();
60
-  //
61
-  //class TestParent extends Component {
62
-  //  constructor(props) {
63
-  //    super(props);
64
-  //    this.state = {};
65
-  //  }
66
-  //
67
-  //  render() {
68
-  //    return (
69
-  //      <NavigationContainer/>
70
-  //    );
71
-  //  }
72
-  //}
73
-  //
74
-  //let navContainerRef;
75
-  //const NavigationContainer = getRegisteredComponentClassFromAppRegistry();
76
-  //const tree = renderer.create(
77
-  //  <NavigationContainer ref={(r) => navContainerRef = r} name={_.get(navContainerRef, 'state.name')}/>
78
-  //);
79
-  //expect(tree.toJSON().children).toEqual(['Hello, World!']);
80
-  //navContainerRef.setState({name: 'Gandalf'});
81
-  //expect(tree.toJSON().children).toEqual(['Hello, Gandalf!']);
82
-  //});
55
+
56
+  it('updates props into original container', () => {
57
+    uut.registerContainer('example.MyContainer', () => MyContainer);
58
+
59
+    const NavigationContainer = getRegisteredComponentClassFromAppRegistry();
60
+    let testParentRef = null;
61
+    class TestParent extends Component { //eslint-disable-line
62
+      constructor(props) {
63
+        super(props);
64
+        this.state = {};
65
+      }
66
+
67
+      render() {
68
+        return (
69
+          <NavigationContainer name={this.state.name}/>
70
+        );
71
+      }
72
+    }
73
+
74
+    const tree = renderer.create(
75
+      <TestParent ref={(r) => testParentRef = r}/>
76
+    );
77
+
78
+    expect(tree.toJSON().children).toEqual(['Hello, World!']);
79
+    testParentRef.setState({name: 'Gandalf'});
80
+    expect(tree.toJSON().children).toEqual(['Hello, Gandalf!']);
81
+  });
83 82
 });