-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Popup): prevent closing popup when finishing select text outside (#…
…19201) * fix(Popup): prevent closing popup on finishing select text outside * fix: tests * fix: test * fix popup * update test * fix test Co-authored-by: Charles Assuncao <charlesassuncao@192.168.1.39>
- Loading branch information
Showing
5 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
packages/fluentui/e2e/tests/popupMouseDownSelecting-example.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import * as React from 'react'; | ||
import { Popup, Button, buttonClassName, popupContentClassName } from '@fluentui/react-northstar'; | ||
|
||
export const selectors = { | ||
popupContent: popupContentClassName, | ||
button: buttonClassName, | ||
secondDiv: 'second-div', | ||
}; | ||
|
||
const PopupWithoutTriggerExample = () => { | ||
return ( | ||
<div | ||
style={{ | ||
width: 500, | ||
height: 500, | ||
}} | ||
> | ||
<Popup | ||
content={{ | ||
content: 'Test Content', | ||
styles: { margin: '20px' }, | ||
}} | ||
trigger={<Button content="Test button" />} | ||
/> | ||
<div | ||
id={selectors.secondDiv} | ||
style={{ | ||
width: 50, | ||
height: 50, | ||
margin: 50, | ||
}} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default PopupWithoutTriggerExample; |
15 changes: 15 additions & 0 deletions
15
packages/fluentui/e2e/tests/popupMouseDownSelecting.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
describe('Popup without `trigger`', () => { | ||
const selectors = { popupContent: 'ui-popup__content', button: 'ui-button' }; | ||
const button = `.${selectors.button}`; | ||
const popupContent = `.${selectors.popupContent}`; | ||
|
||
beforeEach(() => { | ||
cy.gotoTestCase(__filename, button); | ||
}); | ||
|
||
it('Popup still open on mousedown event', () => { | ||
cy.clickOn(button); | ||
cy.get(popupContent).trigger('mousedown', { which: 1 }).trigger('mousemove', { clientX: 300, clientY: 300 }); | ||
cy.visible(popupContent); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters