Skip to content

Commit 7becdf5

Browse files
Merge branch 'patternfly:main' into main
2 parents b26411a + ee753b3 commit 7becdf5

File tree

36 files changed

+4379
-5840
lines changed

36 files changed

+4379
-5840
lines changed

.github/dependabot.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ updates:
1616
- version-update:semver-major
1717
open-pull-requests-limit: 10
1818
reviewers:
19-
- fhlavac
19+
- aferd
20+
- epwinchell
21+
- InsaneZein
2022
- nicolethoen
2123
- dlabaj
2224

@@ -36,6 +38,8 @@ updates:
3638
- version-update:semver-major
3739
open-pull-requests-limit: 10
3840
reviewers:
39-
- fhlavac
41+
- aferd
42+
- epwinchell
43+
- InsaneZein
4044
- nicolethoen
4145
- dlabaj

.github/workflows/pr-preview.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
with:
3434
path: '**/node_modules'
3535
key: ${{ runner.os }}-npm-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('package-lock.json') }}
36-
- run: npm install --frozen-lockfile
36+
- run: npm install --frozen-lockfile --legacy-peer-deps
3737
if: steps.yarn-cache.outputs.cache-hit != 'true'
3838
- run: npm run build
3939
name: Build component groups

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22

33
This repo contains a set of opinionated react component groups used to standardize functionality and look and feel across products. The components are based on PatternFly with some additional functionality.
44

5+
### Branches
6+
`main` - PatternFly 6 implementation
7+
8+
`v5` - PatternFly 5 implementation
9+
10+
`do-not-delete` - do not delete
11+
12+
> NOTE: If new features are not needed in `v5,` they should be added directly to the `main` branch. For bug fixes, it is preferred to fix the bug for both versions (fix in one branch and cherry-pick to another). Pulling new changes from 5 to 6 and vice versa is not recommended using `rebase`. Rather, always cherry-pick specific commits.
13+
14+
---
15+
516
### Migration from [RedHatInsights/frontend-components](https://github.com/RedHatInsights/frontend-components) to [patternfly/react-component-groups](https://github.com/patternfly/react-component-groups)
617
Please see the [migration guide](./migration.md)
718

cypress/component/WarningModal.cy.tsx

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,29 +37,57 @@ const CheckboxModal: React.FunctionComponent = () => {
3737
</>
3838
};
3939

40+
const TextConfirmationModal: React.FunctionComponent = () => {
41+
const [ isOpen, setIsOpen ] = React.useState(false);
42+
return <>
43+
<Button onClick={() => setIsOpen(true)}>Open modal</Button>
44+
<WarningModal
45+
isOpen={isOpen}
46+
title='Delete item?'
47+
confirmButtonLabel='Yes'
48+
cancelButtonLabel='No'
49+
onClose={() => setIsOpen(false)}
50+
onConfirm={() => setIsOpen(false)}
51+
textConfirmation={{ type: 'text', isRequired: true }}
52+
deleteName='Item1'>
53+
The item will be deleted.
54+
</WarningModal>
55+
</>
56+
};
57+
4058
describe('WarningModal', () => {
4159
it('renders WarningModal', () => {
42-
cy.mount(<BasicModal />)
60+
cy.mount(<BasicModal />);
4361
cy.get('button').click();
4462
cy.get('[data-ouia-component-id="WarningModal"]').should('exist');
4563
cy.get('[data-ouia-component-id="WarningModal"]').contains('Unsaved changes');
4664
cy.get('[data-ouia-component-id="WarningModal"]').contains('Your page contains unsaved changes. Do you want to leave?');
4765
});
4866

4967
it('confirm button should be disabled if checkbox is not checked', () => {
50-
cy.mount(<CheckboxModal />)
68+
cy.mount(<CheckboxModal />);
5169
cy.get('button').click();
52-
cy.get('[data-ouia-component-id="WarningModal-confirm-button"').should('have.attr', 'disabled')
70+
cy.get('[data-ouia-component-id="WarningModal-confirm-button"').should('have.attr', 'disabled');
5371
cy.get('[data-ouia-component-id="WarningModal-confirm-checkbox"').click();
54-
cy.get('[data-ouia-component-id="WarningModal-confirm-button"').should('not.have.attr', 'disabled')
72+
cy.get('[data-ouia-component-id="WarningModal-confirm-button"').should('not.have.attr', 'disabled');
5573
});
5674

5775
it('should reset the confirmation checkbox once reopened', () => {
58-
cy.mount(<CheckboxModal />)
76+
cy.mount(<CheckboxModal />);
5977
cy.get('button').click();
6078
cy.get('[data-ouia-component-id="WarningModal-confirm-checkbox"').click();
6179
cy.get('[data-ouia-component-id="WarningModal-confirm-button"').click();
6280
cy.get('button').click();
63-
cy.get('[data-ouia-component-id="WarningModal-confirm-button"').should('have.attr', 'disabled')
64-
})
81+
cy.get('[data-ouia-component-id="WarningModal-confirm-button"').should('have.attr', 'disabled');
82+
});
83+
84+
it('confirm button should be enabled only when confirmation text matches the item name', () => {
85+
cy.mount(<TextConfirmationModal />);
86+
cy.get('button').click();
87+
cy.get('[data-ouia-component-id="WarningModal-confirmation-text-input"').type('abcd');
88+
cy.get('[data-ouia-component-id="WarningModal-confirm-button"').should('have.attr', 'disabled');
89+
cy.get('[data-ouia-component-id="WarningModal-confirmation-text-input"').clear();
90+
cy.get('[data-ouia-component-id="WarningModal-confirmation-text-input"').type('Item1');
91+
cy.get('[data-ouia-component-id="WarningModal-confirm-button"').should('not.have.attr', 'disabled');
92+
});
6593
});

0 commit comments

Comments
 (0)