@samitouri / QOS-React / commits / 75e1e1431b

Expanded the reorder tests slightly

Brian Vaughn committed Apr 17, 2019 at 13:11 UTC 75e1e1431b34f68c50f1971e20662540d285eeb6
2 files changed +55
src/__tests__/__snapshots__/store-test.js.snap
+37
@@ -158,6 +158,21 @@ exports[`Store collapseNodesByDefault:false should support reordering of childre
158 <Component key="0">
159 `;
160
161 +exports[`Store collapseNodesByDefault:false should support reordering of children: 4: collapse root 1`] = `
162 +[root]
163 + ▸ <Root>
164 +`;
165 +
166 +exports[`Store collapseNodesByDefault:false should support reordering of children: 5: expand root 1`] = `
167 +[root]
168 + ▾ <Root>
169 + ▾ <Bar key="bar">
170 + <Component key="0">
171 + <Component key="1">
172 + ▾ <Foo key="foo">
173 + <Component key="0">
174 +`;
175 +
176 exports[`Store collapseNodesByDefault:true should display Suspense nodes properly in various states: 1: loading 1`] = `
177 [root]
178 ▸ <Wrapper>
@@ -340,6 +355,28 @@ exports[`Store collapseNodesByDefault:true should support reordering of children
355 ▸ <Root>
356 `;
357
358 +exports[`Store collapseNodesByDefault:true should support reordering of children: 4: expand root 1`] = `
359 +[root]
360 + ▾ <Root>
361 + ▸ <Bar key="bar">
362 + ▸ <Foo key="foo">
363 +`;
364 +
365 +exports[`Store collapseNodesByDefault:true should support reordering of children: 5: expand leaves 1`] = `
366 +[root]
367 + ▾ <Root>
368 + ▾ <Bar key="bar">
369 + <Component key="0">
370 + <Component key="1">
371 + ▾ <Foo key="foo">
372 + <Component key="0">
373 +`;
374 +
375 +exports[`Store collapseNodesByDefault:true should support reordering of children: 6: collapse root 1`] = `
376 +[root]
377 + ▸ <Root>
378 +`;
379 +
380 exports[`Store should not allow a root node to be collapsed: 1: mount 1`] = `
381 [root]
382 <Component>
src/__tests__/store-test.js
+18
@@ -204,6 +204,12 @@ describe('Store', () => {
204
205 act(() => ReactDOM.render(<Root>{[bar, foo]}</Root>, container));
206 expect(store).toMatchSnapshot('3: reorder children');
207 +
208 + act(() => store.toggleIsCollapsed(store.getElementIDAtIndex(0), true));
209 + expect(store).toMatchSnapshot('4: collapse root');
210 +
211 + act(() => store.toggleIsCollapsed(store.getElementIDAtIndex(0), false));
212 + expect(store).toMatchSnapshot('5: expand root');
213 });
214 });
215
@@ -441,6 +447,18 @@ describe('Store', () => {
447
448 act(() => ReactDOM.render(<Root>{[bar, foo]}</Root>, container));
449 expect(store).toMatchSnapshot('3: reorder children');
450 +
451 + act(() => store.toggleIsCollapsed(store.getElementIDAtIndex(0), false));
452 + expect(store).toMatchSnapshot('4: expand root');
453 +
454 + act(() => {
455 + store.toggleIsCollapsed(store.getElementIDAtIndex(2), false);
456 + store.toggleIsCollapsed(store.getElementIDAtIndex(1), false);
457 + });
458 + expect(store).toMatchSnapshot('5: expand leaves');
459 +
460 + act(() => store.toggleIsCollapsed(store.getElementIDAtIndex(0), true));
461 + expect(store).toMatchSnapshot('6: collapse root');
462 });
463 });
464 });