-
Notifications
You must be signed in to change notification settings - Fork 810
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
[fixed]:1015 - Fixed closing by click on layout #1018
[fixed]:1015 - Fixed closing by click on layout #1018
Conversation
- Fixed incorrect behavior when you need to click twice on the overlay to close modal window if you click on something with event.stopPropagation() inside content block. - Wrote a test case for closing modal by click on the overlay after click on something placed inside modal and containing stopPropagation for the "click" event. Fixed test cases for the overlay MD -> content MU && content MD -> overlay MU cases.
specs/Modal.events.spec.js
Outdated
@@ -222,6 +222,7 @@ export default () => { | |||
withModal(props, null, modal => { | |||
mouseDownAt(moverlay(modal)); | |||
mouseUpAt(mcontent(modal)); | |||
clickAt(mcontent(modal)); |
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.
Here, mouse down and click at has the effect of a double click.
@@ -236,9 +237,40 @@ export default () => { | |||
withModal(props, null, modal => { | |||
mouseDownAt(mcontent(modal)); | |||
mouseUpAt(moverlay(modal)); | |||
clickAt(moverlay(modal)); |
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.
Same here.
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 tested this again by simply adding the log
to every content and layout event. And right now only the mouseUp
and mouseDown
events fire, but in the code they don't have the logic to close the modal, so we have false "true" results, because of course the modal can't be closed.
For example I created this reference. As you can see in lines 18-19, I remove content mouseUp
and mouseDown
events and after that in browser window we have both issues with modal closing. But if I comment out this methods in source the tests will still give "true" results.
But if we add clickAt(moverlay(modal))
then we will have the correct results, which match the real results I got on the actual product before (and during) these tests, and than we will be able to catch these errors.
I hope this proofs is sufficient. Let me know what you think about it.
I'll fix line 225 because I used clickAt
mcontent
instead of moverlay
but this isn't correct as I saw during the tests.
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.
Ah now I remember it...
The mouse down and up
are to test the scenario where you click and hold on a content and release (mouse up) on the overlay.
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.
Yes that's it!
It just didn't work when I ran the tests, so I compared it to real behavior and suggesting a way to fix the tests. Now they works at least for me :)
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 guess in the end the result is correct, but I'm not sure if the test "examplifies" the behavior.
I need to think about it.
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 one too.
If I press down on the content, drag to the overlay, it must not close the modal.
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.
clickAt(moverlay(modal)); |
- Fixed test case for the overlay MD -> content MU.
@ErikDeviashin Can you please rebase your PR please? Jut fixed the action issue. |
@diasbruno Sure, did it |
@@ -222,6 +222,7 @@ export default () => { | |||
withModal(props, null, modal => { | |||
mouseDownAt(moverlay(modal)); | |||
mouseUpAt(mcontent(modal)); | |||
clickAt(moverlay(modal)); |
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.
Here is the behavoir I was talking about.
This clickAt
shouldn't be here.
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.
clickAt(moverlay(modal)); |
mouseDownAt(innerButton); | ||
mouseUpAt(innerButton); |
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.
mouseDownAt(innerButton); | |
mouseUpAt(innerButton); |
mouseDownAt(moverlay(modal)); | ||
mouseUpAt(moverlay(modal)); |
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.
mouseDownAt(moverlay(modal)); | |
mouseUpAt(moverlay(modal)); |
I've made a few suggestions, I think that is what we are expecting from your new test. |
Those 2 other tests, they need to stay the same to guarantee the behavoir when dragging from the |
Hi, @diasbruno, sorry fore disappearing! Intense week. I almost ready to do whatever you say, but I just want to clarify one last time: I can remove all events from tests, but then the tests will gave wrong results and wouldn't catch errors that they should catch as it was in case that I described earlier. In case of the new test will also be incorrect behavior, because the very problem of 2 clicks on overlay appears from the logic in the I won't push anymore, but I do think it would be better to fix the tests. |
Ok. I'll have a look when I have time. |
@diasbruno it would be very cool if this fix will be merged to master. I have the same problem and I can't see any workaround to fix it |
@khmelevskii This patch needs a better look to see if it is right... What I expect:
|
Thank you @diasbruno ! it will be pretty difficult to find time for this soon, but thank you for sharing correct expectations. |
@diasbruno @khmelevskii This is used like This is better just because using @khmelevskii If you need some quick solution look at the |
Thank you @diasbruno ! I will try |
because those line number are not match the source file, it would be more clear if the patch file pasted here. |
Fixes #1015
Changes proposed:
Upgrade Path (for changed or removed APIs): -
Acceptance Checklist:
CONTRIBUTING.md
.