-
Notifications
You must be signed in to change notification settings - Fork 398
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
Refactor ReportAbuseButton to use DismissibleTextForm #7382
Refactor ReportAbuseButton to use DismissibleTextForm #7382
Conversation
Codecov Report
@@ Coverage Diff @@
## master mozilla/addons-frontend#7382 +/- ##
==========================================
- Coverage 97.87% 97.86% -0.01%
==========================================
Files 257 257
Lines 7044 7024 -20
Branches 1302 1299 -3
==========================================
- Hits 6894 6874 -20
Misses 136 136
Partials 14 14
Continue to review full report at Codecov.
|
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.
Thanks, very good start!
// We need to use mount here because we're interacting with refs. (In | ||
// this case, the textarea.) | ||
const root = renderMount(); |
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.
Is the comment above still accurate? We could maybe use shallow
instead of mount
here now.
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 agree the comment is not accurate any more. I tried shallow
, but it seems that I need to call renderShallow
again to make the expect
line works. I am not sure why it does not rerender. If calling renderShallow
twice is ok, I will change it to shallow
.
let root = renderShallow({ addon, store });
root.find(Button).simulate('click', fakeEvent)
root = renderShallow({ addon, store });
expect(root.find('.ReportAbuseButton--is-expanded')).toHaveLength(1);
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.
what if you call root.update()
instead?
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.
Neither of root.update()
/ root.instance().forceUpdate()
works. It looks like root
(<ReportAbuseButtonBase/>
) cannot get the updated props value from <ReportAbuseButton>
. It might be related to enzymejs/enzyme#1229 (comment)
I found some other tests using render
twice.
root = render({ collection, editing: true, store }); |
root = render({ review }); |
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 see. let's keep it as is then
Hi @mirefly, it looks like you resolved all comments but you did not push any update yet. |
@willdurand Thanks very much for help on this. I pushed the changes. |
e529f44
to
adbd48f
Compare
adbd48f
to
c7eded3
Compare
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.
r+
Thanks @mirefly! |
Fixes mozilla/addons#10834
Botton styles changes.
I also removed relevant part of
disableAbuseButtonUI
andenableAbuseButtonUI
in "core/reducers/abuse.js" since they are not used any more.Before,
After,