upgrade to patternfly 2.x, pf/react-core 3.x (#184)

This commit is contained in:
Keith Grant
2019-04-30 08:19:19 -04:00
committed by GitHub
parent 6fe93f474f
commit ffade973a9
13 changed files with 1317 additions and 904 deletions

View File

@@ -2,14 +2,16 @@ import React from 'react';
import { mountWithContexts } from '../../../../enzymeHelpers';
import Organization from '../../../../../src/pages/Organizations/screens/Organization/Organization';
describe('<OrganizationView />', () => {
describe.only('<Organization />', () => {
const me = {
is_super_user: true,
is_system_auditor: false
};
test('initially renders succesfully', () => {
mountWithContexts(<Organization me={me} />);
});
test('notifications tab shown/hidden based on permissions', () => {
const wrapper = mountWithContexts(<Organization me={me} />);
expect(wrapper.find('.pf-c-tabs__item').length).toBe(3);
@@ -18,6 +20,6 @@ describe('<OrganizationView />', () => {
isNotifAdmin: true
});
expect(wrapper.find('.pf-c-tabs__item').length).toBe(4);
expect(wrapper.find('.pf-c-tabs__button[children="Notifications"]').length).toBe(1);
expect(wrapper.find('button.pf-c-tabs__button[children="Notifications"]').length).toBe(1);
});
});

View File

@@ -71,9 +71,9 @@ describe('<OrganizationAccess />', () => {
};
});
test.only('initially renders succesfully', () => {
test('initially renders succesfully', () => {
const wrapper = mountWithContexts(
<OrganizationAccess id={1} organization={organization} />,
<OrganizationAccess organization={organization} />,
{ context: { network } }
);
expect(wrapper.find('OrganizationAccess')).toMatchSnapshot();
@@ -81,7 +81,7 @@ describe('<OrganizationAccess />', () => {
test('should fetch and display access records on mount', async () => {
const wrapper = mountWithContexts(
<OrganizationAccess id={1} />,
<OrganizationAccess organization={organization} />,
{ context: { network } }
);
await sleep(0);
@@ -94,7 +94,7 @@ describe('<OrganizationAccess />', () => {
test('should open confirmation dialog when deleting role', async () => {
const wrapper = mountWithContexts(
<OrganizationAccess id={1} />,
<OrganizationAccess organization={organization} />,
{ context: { network } }
);
await sleep(0);
@@ -114,7 +114,7 @@ describe('<OrganizationAccess />', () => {
it('should close dialog when cancel button clicked', async () => {
const wrapper = mountWithContexts(
<OrganizationAccess id={1} />,
<OrganizationAccess organization={organization} />,
{ context: { network } }
);
await sleep(0);
@@ -133,7 +133,7 @@ describe('<OrganizationAccess />', () => {
it('should delete user role', async () => {
const wrapper = mountWithContexts(
<OrganizationAccess id={1} />,
<OrganizationAccess organization={organization} />,
{ context: { network } }
);
await sleep(0);
@@ -156,7 +156,7 @@ describe('<OrganizationAccess />', () => {
it('should delete team role', async () => {
const wrapper = mountWithContexts(
<OrganizationAccess id={1} />,
<OrganizationAccess organization={organization} />,
{ context: { network } }
);
await sleep(0);

View File

@@ -5,7 +5,6 @@ exports[`<OrganizationAccess /> initially renders succesfully 1`] = `
api={"/api/"}
handleHttpError={[Function]}
history={"/history/"}
id={1}
location={
Object {
"hash": "",

View File

@@ -666,156 +666,246 @@ exports[`<OrganizationNotifications /> initially renders succesfully 1`] = `
aria-labelledby="items-list-item-1"
className="pf-c-data-list__item"
>
<DataListCell
<DataListItemRow
className=""
key=".0"
rowid="items-list-item-1"
width={1}
>
<div
className="pf-c-data-list__cell"
className="pf-c-data-list__item-row"
>
<Link
replace={false}
style={
Object {
"marginRight": "1.5em",
}
}
to={
Object {
"pathname": "/notifications/1",
}
}
>
<a
onClick={[Function]}
style={
Object {
"marginRight": "1.5em",
}
}
>
<b
id="items-list-item-1"
>
Notification one
</b>
</a>
</Link>
<Badge
<DataListItemCells
className=""
isRead={true}
style={
Object {
"textTransform": "capitalize",
}
dataListCells={
Array [
<DataListCell
alignRight={false}
className=""
isFilled={true}
isIcon={false}
width={1}
>
<Link
replace={false}
style={
Object {
"marginRight": "1.5em",
}
}
to={
Object {
"pathname": "/notifications/1",
}
}
>
<b
id="items-list-item-1"
>
Notification one
</b>
</Link>
<Badge
className=""
isRead={true}
style={
Object {
"textTransform": "capitalize",
}
}
>
email
</Badge>
</DataListCell>,
<DataListCell
alignRight={true}
className=""
isFilled={true}
isIcon={false}
width={1}
>
<Switch
aria-label="Toggle notification success"
className=""
id="notification-1-success-toggle"
isChecked={true}
isDisabled={false}
label="Successful"
onChange={[Function]}
/>
<Switch
aria-label="Toggle notification failure"
className=""
id="notification-1-error-toggle"
isChecked={false}
isDisabled={false}
label="Failure"
onChange={[Function]}
/>
</DataListCell>,
]
}
key=".0"
rowid="items-list-item-1"
>
<span
className="pf-c-badge pf-m-read"
style={
Object {
"textTransform": "capitalize",
}
}
<div
className="pf-c-data-list__item-content"
>
email
</span>
</Badge>
<DataListCell
alignRight={false}
className=""
isFilled={true}
isIcon={false}
key="name"
width={1}
>
<div
className="pf-c-data-list__cell"
>
<Link
replace={false}
style={
Object {
"marginRight": "1.5em",
}
}
to={
Object {
"pathname": "/notifications/1",
}
}
>
<a
onClick={[Function]}
style={
Object {
"marginRight": "1.5em",
}
}
>
<b
id="items-list-item-1"
>
Notification one
</b>
</a>
</Link>
<Badge
className=""
isRead={true}
style={
Object {
"textTransform": "capitalize",
}
}
>
<span
className="pf-c-badge pf-m-read"
style={
Object {
"textTransform": "capitalize",
}
}
>
email
</span>
</Badge>
</div>
</DataListCell>
<DataListCell
alignRight={true}
className=""
isFilled={true}
isIcon={false}
key="toggles"
width={1}
>
<div
className="pf-c-data-list__cell pf-m-align-right"
>
<Switch
aria-label="Toggle notification success"
className=""
id="notification-1-success-toggle"
isChecked={true}
isDisabled={false}
label="Successful"
onChange={[Function]}
>
<label
className="pf-c-switch"
htmlFor="notification-1-success-toggle"
>
<input
aria-label="Toggle notification success"
checked={true}
className="pf-c-switch__input"
disabled={false}
id="notification-1-success-toggle"
onChange={[Function]}
type="checkbox"
/>
<span
className="pf-c-switch__toggle"
/>
<span
aria-hidden="true"
className="pf-c-switch__label pf-m-on"
>
Successful
</span>
<span
aria-hidden="true"
className="pf-c-switch__label pf-m-off"
>
Successful
</span>
</label>
</Switch>
<Switch
aria-label="Toggle notification failure"
className=""
id="notification-1-error-toggle"
isChecked={false}
isDisabled={false}
label="Failure"
onChange={[Function]}
>
<label
className="pf-c-switch"
htmlFor="notification-1-error-toggle"
>
<input
aria-label="Toggle notification failure"
checked={false}
className="pf-c-switch__input"
disabled={false}
id="notification-1-error-toggle"
onChange={[Function]}
type="checkbox"
/>
<span
className="pf-c-switch__toggle"
/>
<span
aria-hidden="true"
className="pf-c-switch__label pf-m-on"
>
Failure
</span>
<span
aria-hidden="true"
className="pf-c-switch__label pf-m-off"
>
Failure
</span>
</label>
</Switch>
</div>
</DataListCell>
</div>
</DataListItemCells>
</div>
</DataListCell>
<DataListCell
alignRight={true}
className=""
key=".1"
rowid="items-list-item-1"
width={1}
>
<div
alignRight={true}
className="pf-c-data-list__cell"
>
<Switch
aria-label="Toggle notification success"
className=""
id="notification-1-success-toggle"
isChecked={true}
isDisabled={false}
label="Successful"
onChange={[Function]}
>
<label
className="pf-c-switch"
htmlFor="notification-1-success-toggle"
>
<input
aria-label="Toggle notification success"
checked={true}
className="pf-c-switch__input"
disabled={false}
id="notification-1-success-toggle"
onChange={[Function]}
type="checkbox"
/>
<span
className="pf-c-switch__toggle"
/>
<span
aria-hidden="true"
className="pf-c-switch__label pf-m-on"
>
Successful
</span>
<span
aria-hidden="true"
className="pf-c-switch__label pf-m-off"
>
Successful
</span>
</label>
</Switch>
<Switch
aria-label="Toggle notification failure"
className=""
id="notification-1-error-toggle"
isChecked={false}
isDisabled={false}
label="Failure"
onChange={[Function]}
>
<label
className="pf-c-switch"
htmlFor="notification-1-error-toggle"
>
<input
aria-label="Toggle notification failure"
checked={false}
className="pf-c-switch__input"
disabled={false}
id="notification-1-error-toggle"
onChange={[Function]}
type="checkbox"
/>
<span
className="pf-c-switch__toggle"
/>
<span
aria-hidden="true"
className="pf-c-switch__label pf-m-on"
>
Failure
</span>
<span
aria-hidden="true"
className="pf-c-switch__label pf-m-off"
>
Failure
</span>
</label>
</Switch>
</div>
</DataListCell>
</DataListItemRow>
</li>
</DataListItem>
</I18n>
@@ -850,156 +940,246 @@ exports[`<OrganizationNotifications /> initially renders succesfully 1`] = `
aria-labelledby="items-list-item-2"
className="pf-c-data-list__item"
>
<DataListCell
<DataListItemRow
className=""
key=".0"
rowid="items-list-item-2"
width={1}
>
<div
className="pf-c-data-list__cell"
className="pf-c-data-list__item-row"
>
<Link
replace={false}
style={
Object {
"marginRight": "1.5em",
}
}
to={
Object {
"pathname": "/notifications/2",
}
}
>
<a
onClick={[Function]}
style={
Object {
"marginRight": "1.5em",
}
}
>
<b
id="items-list-item-2"
>
Notification two
</b>
</a>
</Link>
<Badge
<DataListItemCells
className=""
isRead={true}
style={
Object {
"textTransform": "capitalize",
}
dataListCells={
Array [
<DataListCell
alignRight={false}
className=""
isFilled={true}
isIcon={false}
width={1}
>
<Link
replace={false}
style={
Object {
"marginRight": "1.5em",
}
}
to={
Object {
"pathname": "/notifications/2",
}
}
>
<b
id="items-list-item-2"
>
Notification two
</b>
</Link>
<Badge
className=""
isRead={true}
style={
Object {
"textTransform": "capitalize",
}
}
>
email
</Badge>
</DataListCell>,
<DataListCell
alignRight={true}
className=""
isFilled={true}
isIcon={false}
width={1}
>
<Switch
aria-label="Toggle notification success"
className=""
id="notification-2-success-toggle"
isChecked={false}
isDisabled={false}
label="Successful"
onChange={[Function]}
/>
<Switch
aria-label="Toggle notification failure"
className=""
id="notification-2-error-toggle"
isChecked={true}
isDisabled={false}
label="Failure"
onChange={[Function]}
/>
</DataListCell>,
]
}
key=".0"
rowid="items-list-item-2"
>
<span
className="pf-c-badge pf-m-read"
style={
Object {
"textTransform": "capitalize",
}
}
<div
className="pf-c-data-list__item-content"
>
email
</span>
</Badge>
<DataListCell
alignRight={false}
className=""
isFilled={true}
isIcon={false}
key="name"
width={1}
>
<div
className="pf-c-data-list__cell"
>
<Link
replace={false}
style={
Object {
"marginRight": "1.5em",
}
}
to={
Object {
"pathname": "/notifications/2",
}
}
>
<a
onClick={[Function]}
style={
Object {
"marginRight": "1.5em",
}
}
>
<b
id="items-list-item-2"
>
Notification two
</b>
</a>
</Link>
<Badge
className=""
isRead={true}
style={
Object {
"textTransform": "capitalize",
}
}
>
<span
className="pf-c-badge pf-m-read"
style={
Object {
"textTransform": "capitalize",
}
}
>
email
</span>
</Badge>
</div>
</DataListCell>
<DataListCell
alignRight={true}
className=""
isFilled={true}
isIcon={false}
key="toggles"
width={1}
>
<div
className="pf-c-data-list__cell pf-m-align-right"
>
<Switch
aria-label="Toggle notification success"
className=""
id="notification-2-success-toggle"
isChecked={false}
isDisabled={false}
label="Successful"
onChange={[Function]}
>
<label
className="pf-c-switch"
htmlFor="notification-2-success-toggle"
>
<input
aria-label="Toggle notification success"
checked={false}
className="pf-c-switch__input"
disabled={false}
id="notification-2-success-toggle"
onChange={[Function]}
type="checkbox"
/>
<span
className="pf-c-switch__toggle"
/>
<span
aria-hidden="true"
className="pf-c-switch__label pf-m-on"
>
Successful
</span>
<span
aria-hidden="true"
className="pf-c-switch__label pf-m-off"
>
Successful
</span>
</label>
</Switch>
<Switch
aria-label="Toggle notification failure"
className=""
id="notification-2-error-toggle"
isChecked={true}
isDisabled={false}
label="Failure"
onChange={[Function]}
>
<label
className="pf-c-switch"
htmlFor="notification-2-error-toggle"
>
<input
aria-label="Toggle notification failure"
checked={true}
className="pf-c-switch__input"
disabled={false}
id="notification-2-error-toggle"
onChange={[Function]}
type="checkbox"
/>
<span
className="pf-c-switch__toggle"
/>
<span
aria-hidden="true"
className="pf-c-switch__label pf-m-on"
>
Failure
</span>
<span
aria-hidden="true"
className="pf-c-switch__label pf-m-off"
>
Failure
</span>
</label>
</Switch>
</div>
</DataListCell>
</div>
</DataListItemCells>
</div>
</DataListCell>
<DataListCell
alignRight={true}
className=""
key=".1"
rowid="items-list-item-2"
width={1}
>
<div
alignRight={true}
className="pf-c-data-list__cell"
>
<Switch
aria-label="Toggle notification success"
className=""
id="notification-2-success-toggle"
isChecked={false}
isDisabled={false}
label="Successful"
onChange={[Function]}
>
<label
className="pf-c-switch"
htmlFor="notification-2-success-toggle"
>
<input
aria-label="Toggle notification success"
checked={false}
className="pf-c-switch__input"
disabled={false}
id="notification-2-success-toggle"
onChange={[Function]}
type="checkbox"
/>
<span
className="pf-c-switch__toggle"
/>
<span
aria-hidden="true"
className="pf-c-switch__label pf-m-on"
>
Successful
</span>
<span
aria-hidden="true"
className="pf-c-switch__label pf-m-off"
>
Successful
</span>
</label>
</Switch>
<Switch
aria-label="Toggle notification failure"
className=""
id="notification-2-error-toggle"
isChecked={true}
isDisabled={false}
label="Failure"
onChange={[Function]}
>
<label
className="pf-c-switch"
htmlFor="notification-2-error-toggle"
>
<input
aria-label="Toggle notification failure"
checked={true}
className="pf-c-switch__input"
disabled={false}
id="notification-2-error-toggle"
onChange={[Function]}
type="checkbox"
/>
<span
className="pf-c-switch__toggle"
/>
<span
aria-hidden="true"
className="pf-c-switch__label pf-m-on"
>
Failure
</span>
<span
aria-hidden="true"
className="pf-c-switch__label pf-m-off"
>
Failure
</span>
</label>
</Switch>
</div>
</DataListCell>
</DataListItemRow>
</li>
</DataListItem>
</I18n>