@samitouri / QOS-React / commits / 53dbb191d6

Uncomment invariant in UIManager mock (#9461)

Ben Alpert committed Apr 19, 2017 at 16:28 UTC 53dbb191d60ae08643635d6a6fdf3f23a42cb9f4
1 file changed +3 -3
src/__mocks__/UIManager.js
+3 -3
@@ -93,14 +93,12 @@ var RCTUIManager = {
93 setJSResponder: jest.fn(),
94 setChildren: jest.fn(function setChildren(parentTag, reactTags) {
95 autoCreateRoot(parentTag);
96 - /* TODO (spicyj) Re-enable this check once it won't cause test failures
96 // Native doesn't actually check this but it seems like a good idea
97 invariant(
98 views.get(parentTag).children.length === 0,
99 'Calling .setChildren on nonempty view %s',
100 parentTag,
101 );
103 - */
102 // This logic ported from iOS (RCTUIManager.m)
103 reactTags.forEach((tag, i) => {
104 insertSubviewAtIndex(parentTag, tag, i);
@@ -149,7 +147,9 @@ var RCTUIManager = {
147 }
148 }),
149 updateView: jest.fn(),
152 - removeSubviewsFromContainerWithID: jest.fn(),
150 + removeSubviewsFromContainerWithID: jest.fn(function(parentTag) {
151 + views.get(parentTag).children.forEach((tag) => removeChild(parentTag, tag));
152 + }),
153 replaceExistingNonRootView: jest.fn(),
154 __takeSnapshot: jest.fn(),
155 customBubblingEventTypes: {