forked from Semantic-Org/Semantic-UI-React
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Sidebar): fix issue with Portals in React 17 (Semantic-Org#4144)
* add failing test * update deps
- Loading branch information
1 parent
0fadae0
commit ad261dd
Showing
5 changed files
with
116 additions
and
11 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"baseUrl": "http://localhost:3000", | ||
"testFiles": "**/*.visual.js", | ||
"testFiles": "**/*.{spec,visual}.js", | ||
"video": false | ||
} |
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,20 @@ | ||
/// <reference types="cypress" /> | ||
|
||
describe('Sidebar: spec', () => { | ||
it('with a Modal', () => { | ||
cy.visit('/maximize/sidebar-and-modal/') | ||
|
||
cy.get('[data-tid="button-modal-open"]').click() | ||
cy.get('[data-tid="modal-content"]').should('be.visible') | ||
|
||
cy.get('[data-tid="button-modal-close"]').click() | ||
cy.get('[data-tid="modal-content"]').should('not.be.visible') | ||
|
||
cy.get('[data-tid="button-sidebar-toggle"]').click() | ||
cy.get('[data-tid="sidebar-home"]').click() | ||
cy.get('[data-tid="sidebar"]').should('be.visible') | ||
|
||
cy.get('[data-tid="button-sidebar-toggle"]').click() | ||
cy.get('[data-tid="sidebar"]').should('not.be.visible') | ||
}) | ||
}) |
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,85 @@ | ||
import React from 'react' | ||
import { | ||
Button, | ||
Grid, | ||
Header, | ||
Icon, | ||
Menu, | ||
Segment, | ||
Sidebar, | ||
Modal, | ||
} from 'semantic-ui-react' | ||
|
||
const SidebarAndModal = () => { | ||
const [visible, setVisible] = React.useState(false) | ||
|
||
return ( | ||
<> | ||
<Button | ||
data-tid='button-sidebar-toggle' | ||
onClick={() => setVisible(!visible)} | ||
> | ||
Toggle | ||
</Button> | ||
<Grid columns={1}> | ||
<Grid.Column>Hello world!</Grid.Column> | ||
|
||
<Grid.Column> | ||
<Sidebar.Pushable as={Segment}> | ||
<Sidebar | ||
as={Menu} | ||
animation='overlay' | ||
data-tid='sidebar' | ||
icon='labeled' | ||
inverted | ||
onHide={() => setVisible(false)} | ||
vertical | ||
visible={visible} | ||
width='thin' | ||
> | ||
<Menu.Item as='a' data-tid='sidebar-home'> | ||
<Icon name='home' /> | ||
Home | ||
</Menu.Item> | ||
<Menu.Item as='a'> | ||
<Icon name='gamepad' /> | ||
Games | ||
</Menu.Item> | ||
<Menu.Item as='a'> | ||
<Icon name='camera' /> | ||
Channels | ||
</Menu.Item> | ||
</Sidebar> | ||
|
||
<Sidebar.Pusher> | ||
<Segment basic style={{ minHeight: '50vh' }}> | ||
<Header as='h3'>Application Content</Header> | ||
<Modal | ||
trigger={ | ||
<Button data-tid='button-modal-open'>Show Modal</Button> | ||
} | ||
header='Reminder!' | ||
content={{ | ||
content: 'Call Benjamin regarding the reports', | ||
'data-tid': 'modal-content', | ||
}} | ||
actions={[ | ||
'Snooze', | ||
{ | ||
key: 'done', | ||
content: 'Done', | ||
'data-tid': 'button-modal-close', | ||
positive: true, | ||
}, | ||
]} | ||
/> | ||
</Segment> | ||
</Sidebar.Pusher> | ||
</Sidebar.Pushable> | ||
</Grid.Column> | ||
</Grid> | ||
</> | ||
) | ||
} | ||
|
||
export default SidebarAndModal |
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