-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UIP-2430 Use over_react_test, rip out duplicated test utils #83
UIP-2430 Use over_react_test, rip out duplicated test utils #83
Conversation
RavenNumber of Findings: 0 |
@@ -1101,3 +1101,12 @@ class PlainObjectPropsMap { | |||
class PlainObjectStyleMap { | |||
external get width; | |||
} | |||
|
|||
/// Helper component that renders whatever you tell it to. Necessary for rendering components with the 'ref' prop. | |||
final RenderingContainerComponentFactory = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was only needed by this file, so I moved it here from test/test_util/react_util.dart
@@ -35,7 +35,7 @@ main() { | |||
test('root contains the other element', () { | |||
var rootInstance = render(DomTest()); | |||
var rootNode = findDomNode(rootInstance); | |||
var otherNode = getDomByTestId(rootInstance, 'innerComponent'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was deprecated
@@ -265,8 +265,6 @@ void testClassNameMerging(BuilderOnlyUiFactory factory, dynamic childrenFactory( | |||
excludesClasses('blacklisted-class-1 blacklisted-class-2') | |||
) | |||
)); | |||
|
|||
unmount(renderedInstance); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was being auto-unmounted, so this was unnecessary
@@ -278,8 +276,6 @@ void testClassNameMerging(BuilderOnlyUiFactory factory, dynamic childrenFactory( | |||
var descendantsWithCustomClass = react_test_utils.scryRenderedDOMComponentsWithClass(renderedInstance, customClass); | |||
|
|||
expect(descendantsWithCustomClass, hasLength(1)); | |||
|
|||
unmount(renderedInstance); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was being auto-unmounted, so this was unnecessary
@@ -289,7 +285,8 @@ void testClassNameOverrides(BuilderOnlyUiFactory factory, dynamic childrenFactor | |||
var reactInstanceWithoutOverrides = render( | |||
(factory() | |||
..addProp(forwardedPropBeacon, true) | |||
)(childrenFactory()) | |||
)(childrenFactory()), | |||
autoTearDown: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was being unmounted manually later on, so this was necessary
export 'dom_util.dart'; | ||
export 'react_util.dart'; | ||
export 'wrapper_component.dart'; | ||
export 'package:over_react_test/over_react_test.dart'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just exported these instead of updating the imports in every file, in order to get this through more quickly and with less risk of merge conflicts.
Codecov Report
@@ Coverage Diff @@
## master #83 +/- ##
=======================================
Coverage 94.81% 94.81%
=======================================
Files 31 31
Lines 1522 1522
=======================================
Hits 1443 1443
Misses 79 79 |
QA +10
|
Ultimate problem:
We had duplicated code for test utils that has since made its way into over_react_test.
How it was fixed:
Pull in over_react_test, rip out duplicated test utils
Testing suggestions:
ddev test -p content-shell
ddev test -p chrome
Potential areas of regression:
Tests