|
15 | 15 | import 'package:over_react/over_react.dart'; |
16 | 16 | import 'package:over_react/over_react_flux.dart'; |
17 | 17 | import 'package:over_react/over_react_redux.dart'; |
18 | | -import 'package:redux/redux.dart' as redux; |
19 | 18 | import 'package:test/test.dart'; |
20 | 19 |
|
21 | 20 | import '../test_util/test_util.dart'; |
22 | 21 | import 'fixtures/connect_flux_counter.dart'; |
23 | 22 | import 'fixtures/connect_flux_store.dart'; |
24 | | -import 'fixtures/counter.dart'; |
25 | 23 | import 'fixtures/non_component_two_counter.dart'; |
26 | 24 | import 'fixtures/redux_actions.dart'; |
27 | | -import 'fixtures/store.dart' as redux_store; |
28 | 25 |
|
29 | 26 | // ignore_for_file: avoid_types_on_closure_parameters |
30 | 27 |
|
@@ -466,70 +463,6 @@ main() { |
466 | 463 |
|
467 | 464 | expect(jacket.mountNode.innerHtml, contains('Count: 0')); |
468 | 465 | }); |
469 | | - |
470 | | - test( |
471 | | - 'matches a standard Redux component when `areStatesEqual` is false', |
472 | | - () async { |
473 | | - final localReduxRef = createRef<CounterComponent>(); |
474 | | - |
475 | | - final ReduxConnectedCounter = |
476 | | - connect<redux_store.CounterState, CounterProps>( |
477 | | - mapStateToProps: (state) { |
478 | | - methodsCalled.add({'called': 'mapStateToProps'}); |
479 | | - return ConnectFluxCounter()..currentCount = state.count; |
480 | | - }, |
481 | | - areStatePropsEqual: (next, prev) { |
482 | | - methodsCalled.add({ |
483 | | - 'called': 'areStatePropsEqual', |
484 | | - 'prev': prev, |
485 | | - 'next': next, |
486 | | - }); |
487 | | - // Force it to always be true, meaning it shouldn't re-render if they change. |
488 | | - return true; |
489 | | - }, |
490 | | - forwardRef: true, |
491 | | - areStatesEqual: (_, __) => false, |
492 | | - )(Counter); |
493 | | - |
494 | | - final reduxStore = redux.Store(redux_store.counterStateReducer, |
495 | | - initialState: redux_store.CounterState()); |
496 | | - |
497 | | - jacket = mount( |
498 | | - (ReduxProvider()..store = reduxStore)( |
499 | | - (ReduxConnectedCounter()..ref = localReduxRef)('test'), |
500 | | - ), |
501 | | - ); |
502 | | - |
503 | | - // Because `areStatesEqual` is false, we expect additional method calls |
504 | | - expect(methodsCalled.map((methodObj) => methodObj['called']), |
505 | | - expectedMountMethodCalls); |
506 | | - for (final methodCall in methodsCalled) { |
507 | | - if (methodCall['called'] == 'areStatePropsEqual') { |
508 | | - expect(methodCall['prev'], isA<CounterProps>()); |
509 | | - expect(methodCall['next'], isA<CounterProps>()); |
510 | | - } |
511 | | - } |
512 | | - methodsCalled.clear(); |
513 | | - |
514 | | - var dispatchButton = |
515 | | - queryByTestId(jacket.mountNode, 'button-increment'); |
516 | | - click(dispatchButton); |
517 | | - |
518 | | - // wait for the next tick for the async dispatch to propagate |
519 | | - await Future(() {}); |
520 | | - |
521 | | - // store.state.count should be 1 but does not re-render due to override in `areStatePropsEqual` |
522 | | - expect(expectedUpdateMethodCalls, methodsCalled.map((methodObj) => methodObj['called']).toList(), |
523 | | - reason: 'expectedUpdateMethodCalls should match connect\'s sequence of calls'); |
524 | | - for (final methodCall in methodsCalled) { |
525 | | - if (methodCall['called'] == 'areStatePropsEqual') { |
526 | | - expect(methodCall['prev'], isA<CounterProps>()); |
527 | | - expect(methodCall['next'], isA<CounterProps>()); |
528 | | - } |
529 | | - } |
530 | | - |
531 | | - expect(jacket.mountNode.innerHtml, contains('Count: 0')); |
532 | | - }); |
533 | 466 | }); |
534 | 467 |
|
535 | 468 | group('areMergedPropsEqual', () { |
|
0 commit comments