Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #21130: Use patternfly-react npm package
Update to patternfly-react and DropdownKebab implementation http://projects.theforeman.org/issues/21130
- Loading branch information
1 parent
510dbaa
commit 7ab3f34
Showing
8 changed files
with
216 additions
and
36 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 |
---|---|---|
|
@@ -46,3 +46,4 @@ public/webpack | |
.env* | ||
package-lock.json | ||
npm-debug.log | ||
.vscode |
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
10 changes: 10 additions & 0 deletions
10
...ts/javascripts/react_app/components/notifications/drawer/NotificationDropdown.fixtures.js
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,10 @@ | ||
export const propsWithLinks = { | ||
id: 6, | ||
links: [ | ||
{ | ||
href: 'https://theforeman.org/blog', | ||
title: 'Link to blog' | ||
} | ||
], | ||
onClickedLink: () => {} | ||
}; |
25 changes: 8 additions & 17 deletions
25
webpack/assets/javascripts/react_app/components/notifications/drawer/NotificationDropdown.js
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
21 changes: 21 additions & 0 deletions
21
...assets/javascripts/react_app/components/notifications/drawer/NotificationDropdown.test.js
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,21 @@ | ||
// Configure Enzyme | ||
import { configure } from 'enzyme'; | ||
import Adapter from 'enzyme-adapter-react-16'; | ||
configure({ adapter: new Adapter() }); | ||
|
||
import React from 'react'; | ||
import { mount } from 'enzyme'; | ||
import toJson from 'enzyme-to-json'; | ||
import NotificationDropdown from './NotificationDropdown'; | ||
|
||
import { propsWithLinks } from './NotificationDropdown.fixtures'; | ||
|
||
describe('Notification dropdown', () => { | ||
it('Renders links provided', () => { | ||
const wrapper = mount(<NotificationDropdown {...propsWithLinks} />); | ||
|
||
expect(toJson(wrapper)).toMatchSnapshot(); | ||
|
||
}); | ||
|
||
}); |
150 changes: 150 additions & 0 deletions
150
...react_app/components/notifications/drawer/__snapshots__/NotificationDropdown.test.js.snap
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,150 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Notification dropdown Renders links provided 1`] = ` | ||
<NotificationDropdown | ||
id={6} | ||
links={ | ||
Array [ | ||
Object { | ||
"href": "https://theforeman.org/blog", | ||
"title": "Link to blog", | ||
}, | ||
] | ||
} | ||
onClickedLink={[Function]} | ||
> | ||
<DropdownKebab | ||
id={6} | ||
pullRight={true} | ||
> | ||
<Uncontrolled(Dropdown) | ||
className="dropdown-kebab-pf" | ||
id={6} | ||
pullRight={true} | ||
> | ||
<Dropdown | ||
bsClass="dropdown" | ||
className="dropdown-kebab-pf" | ||
componentClass={[Function]} | ||
id={6} | ||
onToggle={[Function]} | ||
pullRight={true} | ||
> | ||
<ButtonGroup | ||
block={false} | ||
bsClass="btn-group" | ||
className="dropdown-kebab-pf dropdown" | ||
justified={false} | ||
vertical={false} | ||
> | ||
<div | ||
className="dropdown-kebab-pf dropdown btn-group" | ||
> | ||
<DropdownToggle | ||
bsClass="dropdown-toggle" | ||
bsRole="toggle" | ||
bsStyle="link" | ||
id={6} | ||
key=".0" | ||
noCaret={true} | ||
onClick={[Function]} | ||
onKeyDown={[Function]} | ||
open={false} | ||
useAnchor={false} | ||
> | ||
<Button | ||
active={false} | ||
aria-expanded={false} | ||
aria-haspopup={true} | ||
block={false} | ||
bsClass="btn" | ||
bsStyle="link" | ||
className="dropdown-toggle" | ||
disabled={false} | ||
id={6} | ||
onClick={[Function]} | ||
onKeyDown={[Function]} | ||
role="button" | ||
> | ||
<button | ||
aria-expanded={false} | ||
aria-haspopup={true} | ||
className="dropdown-toggle btn btn-link" | ||
disabled={false} | ||
id={6} | ||
onClick={[Function]} | ||
onKeyDown={[Function]} | ||
role="button" | ||
type="button" | ||
> | ||
<span | ||
className="fa fa-ellipsis-v" | ||
/> | ||
</button> | ||
</Button> | ||
</DropdownToggle> | ||
<DropdownMenu | ||
bsClass="dropdown-menu" | ||
bsRole="menu" | ||
key=".1" | ||
labelledBy={6} | ||
onClose={[Function]} | ||
onSelect={[Function]} | ||
pullRight={true} | ||
> | ||
<RootCloseWrapper | ||
disabled={true} | ||
event="click" | ||
onRootClose={[Function]} | ||
> | ||
<ul | ||
aria-labelledby={6} | ||
className="dropdown-menu dropdown-menu-right" | ||
role="menu" | ||
> | ||
<MenuItem | ||
bsClass="dropdown" | ||
disabled={false} | ||
divider={false} | ||
header={false} | ||
id="notification-kebab-0" | ||
key=".$0" | ||
onClick={[Function]} | ||
onKeyDown={[Function]} | ||
onSelect={[Function]} | ||
> | ||
<li | ||
className="" | ||
role="presentation" | ||
> | ||
<SafeAnchor | ||
componentClass="a" | ||
id="notification-kebab-0" | ||
onClick={[Function]} | ||
onKeyDown={[Function]} | ||
role="menuitem" | ||
tabIndex="-1" | ||
> | ||
<a | ||
href="#" | ||
id="notification-kebab-0" | ||
onClick={[Function]} | ||
onKeyDown={[Function]} | ||
role="menuitem" | ||
tabIndex="-1" | ||
> | ||
Link to blog | ||
</a> | ||
</SafeAnchor> | ||
</li> | ||
</MenuItem> | ||
</ul> | ||
</RootCloseWrapper> | ||
</DropdownMenu> | ||
</div> | ||
</ButtonGroup> | ||
</Dropdown> | ||
</Uncontrolled(Dropdown)> | ||
</DropdownKebab> | ||
</NotificationDropdown> | ||
`; |
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