Skip to content

Commit

Permalink
Add test cases for PseudoStaticLifecycleDiagnostic
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronlademann-wf committed Jun 15, 2020
1 parent 66d4ae2 commit 519f4cc
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions playground/web/pseudo_static_lifecycle.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import 'package:over_react/over_react.dart';

part 'dom_prop_types.over_react.g.dart';

UiFactory<HammerTimeProps> HammerTime =
// ignore: undefined_identifier
_$HammerTime;

mixin HammerTimeProps on UiProps {
String somethingThatCanBeTouched;
}

mixin HammerTimeState on UiState {}

class HammerTimeComponent extends UiStatefulComponent2<HammerTimeProps, HammerTimeState> {
final mcHammer = 'cant touch this';

@override
get defaultProps {
return newProps()
..somethingThatCanBeTouched = mcHammer;
}

@override
getDerivedStateFromProps(Map nextProps, Map prevState) {
final tNextProps = typedPropsFactory(nextProps);
final tNextPropsJs = typedPropsFactoryJs(nextProps);
final tPrevState = typedStateFactory(prevState);
final tPrevStateJs = typedStateFactoryJs(prevState);

if (props.somethingThatCanBeTouched == mcHammer) {
return newState();
}

return null;
}

@override
render() {}
}

0 comments on commit 519f4cc

Please sign in to comment.