-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -222,6 +222,7 @@ export default () => { | |||||
withModal(props, null, modal => { | ||||||
mouseDownAt(moverlay(modal)); | ||||||
mouseUpAt(mcontent(modal)); | ||||||
clickAt(moverlay(modal)); | ||||||
requestCloseCallback.called.should.not.be.ok(); | ||||||
}); | ||||||
}); | ||||||
|
@@ -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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. I tested this again by simply adding the For example I created this reference. As you can see in lines 18-19, I remove content But if we add I hope this proofs is sufficient. Let me know what you think about it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah now I remember it... The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes that's it! There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
requestCloseCallback.called.should.not.be.ok(); | ||||||
}); | ||||||
}); | ||||||
|
||||||
it("click on button containing stopPropagation inside modal shouldn't block closing", () => { | ||||||
const requestCloseCallback = sinon.spy(); | ||||||
let innerButton = null; | ||||||
let innerButtonRef = ref => { | ||||||
innerButton = ref; | ||||||
}; | ||||||
function click(event) { | ||||||
event.stopPropagation(); | ||||||
} | ||||||
|
||||||
withModal( | ||||||
{ | ||||||
isOpen: true, | ||||||
onRequestClose: requestCloseCallback | ||||||
}, | ||||||
<button ref={innerButtonRef} onClick={click} />, | ||||||
modal => { | ||||||
// imitate regular click with all mouse events on button inside modal | ||||||
mouseDownAt(innerButton); | ||||||
mouseUpAt(innerButton); | ||||||
Comment on lines
+263
to
+264
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
clickAt(innerButton); | ||||||
// imitate regular click with all mouse events on modal overlay | ||||||
mouseDownAt(moverlay(modal)); | ||||||
mouseUpAt(moverlay(modal)); | ||||||
Comment on lines
+267
to
+268
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
clickAt(moverlay(modal)); | ||||||
requestCloseCallback.called.should.be.ok(); | ||||||
} | ||||||
); | ||||||
}); | ||||||
}); | ||||||
|
||||||
it("should not stop event propagation", () => { | ||||||
|
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.