Skip to content

Commit

Permalink
Address CR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronlademann-wf committed Mar 11, 2019
1 parent a7f9fa7 commit 7496192
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
6 changes: 2 additions & 4 deletions lib/src/component/error_boundary.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,8 @@ class ErrorBoundaryComponent<T extends ErrorBoundaryProps, S extends ErrorBounda
? props.fallbackUIRenderer(_error, _componentStack)
: props.children.single;

// TODO: Make this fallback UI more useful.
ReactElement _renderDefaultFallbackUI(_, __) {
return Dom.h3()('Something went wrong.');
}
ReactElement _renderDefaultFallbackUI(_, __) =>
throw new UnimplementedError('Fallback UI will not be supported until support for ReactJS 16 is released in version 3.0.0');

@mustCallSuper
@override
Expand Down
7 changes: 3 additions & 4 deletions test/over_react/component/error_boundary_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void main() {
test('initializes with the expected default prop values', () {
jacket = mount(ErrorBoundary()(dummyChild));

expect(ErrorBoundary(jacket.getProps()).fallbackUIRenderer(null, null), const isInstanceOf<ReactElement>());
expect(() => ErrorBoundary(jacket.getProps()).fallbackUIRenderer(null, null), throwsUnimplementedError);
});

test('initializes with the expected initial state values', () {
Expand All @@ -59,10 +59,9 @@ void main() {
test('', () {
jacket = mount(ErrorBoundary()(dummyChild));
final component = jacket.getDartInstance();
component.setState(component.newState()..hasError = true);

expect(jacket.getNode(), hasNodeName('H3'));
expect(jacket.getNode().text, 'Something went wrong.');
// Using throws for now since this is temporary, and the throwsUnimplementedError doesn't work here for some reason
expect(() => component.setState(component.newState()..hasError = true), throws);
});

// TODO: Update this test to assert the error / component stack values passed to the callback once the actual ReactJS 16 error lifecycle methods are implemented.
Expand Down

0 comments on commit 7496192

Please sign in to comment.