Skip to content

Commit c2c7972

Browse files
committed
Update snapshots
1 parent 65c91f7 commit c2c7972

File tree

3 files changed

+90
-26
lines changed

3 files changed

+90
-26
lines changed

packages/pf4-component-mapper/src/tests/wizard/__snapshots__/wizard.test.js.snap

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,10 +1675,10 @@ exports[`<Wizard /> should render correctly in modal and unmount 1`] = `
16751675
aria-labelledby="wizard"
16761676
aria-modal="true"
16771677
class="pf-c-modal-box pf-m-lg"
1678-
data-ouia-component-id="OUIA-Generated-Modal-large-2"
1678+
data-ouia-component-id="OUIA-Generated-Modal-large-3"
16791679
data-ouia-component-type="PF4/ModalContent"
16801680
data-ouia-safe="true"
1681-
id="pf-modal-part-1"
1681+
id="pf-modal-part-2"
16821682
role="dialog"
16831683
>
16841684
@@ -1800,7 +1800,7 @@ exports[`<Wizard /> should render correctly in modal and unmount 1`] = `
18001800
<button
18011801
aria-disabled="false"
18021802
class="pf-c-button pf-m-primary"
1803-
data-ouia-component-id="OUIA-Generated-Button-primary-8"
1803+
data-ouia-component-id="OUIA-Generated-Button-primary-9"
18041804
data-ouia-component-type="PF4/Button"
18051805
data-ouia-safe="true"
18061806
type="button"
@@ -1810,7 +1810,7 @@ exports[`<Wizard /> should render correctly in modal and unmount 1`] = `
18101810
<button
18111811
aria-disabled="true"
18121812
class="pf-c-button pf-m-secondary pf-m-disabled"
1813-
data-ouia-component-id="OUIA-Generated-Button-secondary-8"
1813+
data-ouia-component-id="OUIA-Generated-Button-secondary-9"
18141814
data-ouia-component-type="PF4/Button"
18151815
data-ouia-safe="true"
18161816
disabled=""
@@ -1824,7 +1824,7 @@ exports[`<Wizard /> should render correctly in modal and unmount 1`] = `
18241824
<button
18251825
aria-disabled="false"
18261826
class="pf-c-button pf-m-link"
1827-
data-ouia-component-id="OUIA-Generated-Button-link-8"
1827+
data-ouia-component-id="OUIA-Generated-Button-link-9"
18281828
data-ouia-component-type="PF4/Button"
18291829
data-ouia-safe="true"
18301830
type="button"
@@ -1861,10 +1861,10 @@ exports[`<Wizard /> should render correctly in modal and unmount 1`] = `
18611861
aria-labelledby="wizard"
18621862
aria-modal="true"
18631863
class="pf-c-modal-box pf-m-lg"
1864-
data-ouia-component-id="OUIA-Generated-Modal-large-2"
1864+
data-ouia-component-id="OUIA-Generated-Modal-large-3"
18651865
data-ouia-component-type="PF4/ModalContent"
18661866
data-ouia-safe="true"
1867-
id="pf-modal-part-1"
1867+
id="pf-modal-part-2"
18681868
role="dialog"
18691869
>
18701870
@@ -1986,7 +1986,7 @@ exports[`<Wizard /> should render correctly in modal and unmount 1`] = `
19861986
<button
19871987
aria-disabled="false"
19881988
class="pf-c-button pf-m-primary"
1989-
data-ouia-component-id="OUIA-Generated-Button-primary-8"
1989+
data-ouia-component-id="OUIA-Generated-Button-primary-9"
19901990
data-ouia-component-type="PF4/Button"
19911991
data-ouia-safe="true"
19921992
type="button"
@@ -1996,7 +1996,7 @@ exports[`<Wizard /> should render correctly in modal and unmount 1`] = `
19961996
<button
19971997
aria-disabled="true"
19981998
class="pf-c-button pf-m-secondary pf-m-disabled"
1999-
data-ouia-component-id="OUIA-Generated-Button-secondary-8"
1999+
data-ouia-component-id="OUIA-Generated-Button-secondary-9"
20002000
data-ouia-component-type="PF4/Button"
20012001
data-ouia-safe="true"
20022002
disabled=""
@@ -2010,7 +2010,7 @@ exports[`<Wizard /> should render correctly in modal and unmount 1`] = `
20102010
<button
20112011
aria-disabled="false"
20122012
class="pf-c-button pf-m-link"
2013-
data-ouia-component-id="OUIA-Generated-Button-link-8"
2013+
data-ouia-component-id="OUIA-Generated-Button-link-9"
20142014
data-ouia-component-type="PF4/Button"
20152015
data-ouia-safe="true"
20162016
type="button"
@@ -2055,10 +2055,10 @@ exports[`<Wizard /> should render correctly in modal and unmount 1`] = `
20552055
aria-labelledby="wizard"
20562056
aria-modal="true"
20572057
class="pf-c-modal-box pf-m-lg"
2058-
data-ouia-component-id="OUIA-Generated-Modal-large-2"
2058+
data-ouia-component-id="OUIA-Generated-Modal-large-3"
20592059
data-ouia-component-type="PF4/ModalContent"
20602060
data-ouia-safe="true"
2061-
id="pf-modal-part-1"
2061+
id="pf-modal-part-2"
20622062
role="dialog"
20632063
>
20642064
@@ -2180,7 +2180,7 @@ exports[`<Wizard /> should render correctly in modal and unmount 1`] = `
21802180
<button
21812181
aria-disabled="false"
21822182
class="pf-c-button pf-m-primary"
2183-
data-ouia-component-id="OUIA-Generated-Button-primary-8"
2183+
data-ouia-component-id="OUIA-Generated-Button-primary-9"
21842184
data-ouia-component-type="PF4/Button"
21852185
data-ouia-safe="true"
21862186
type="button"
@@ -2190,7 +2190,7 @@ exports[`<Wizard /> should render correctly in modal and unmount 1`] = `
21902190
<button
21912191
aria-disabled="true"
21922192
class="pf-c-button pf-m-secondary pf-m-disabled"
2193-
data-ouia-component-id="OUIA-Generated-Button-secondary-8"
2193+
data-ouia-component-id="OUIA-Generated-Button-secondary-9"
21942194
data-ouia-component-type="PF4/Button"
21952195
data-ouia-safe="true"
21962196
disabled=""
@@ -2204,7 +2204,7 @@ exports[`<Wizard /> should render correctly in modal and unmount 1`] = `
22042204
<button
22052205
aria-disabled="false"
22062206
class="pf-c-button pf-m-link"
2207-
data-ouia-component-id="OUIA-Generated-Button-link-8"
2207+
data-ouia-component-id="OUIA-Generated-Button-link-9"
22082208
data-ouia-component-type="PF4/Button"
22092209
data-ouia-safe="true"
22102210
type="button"
@@ -2227,14 +2227,14 @@ exports[`<Wizard /> should render correctly in modal and unmount 1`] = `
22272227
aria-describedby=""
22282228
aria-label=""
22292229
aria-labelledby="wizard"
2230-
boxId="pf-modal-part-1"
2230+
boxId="pf-modal-part-2"
22312231
className=""
2232-
descriptorId="pf-modal-part-3"
2232+
descriptorId="pf-modal-part-4"
22332233
hasNoBodyWrapper={true}
22342234
isOpen={true}
2235-
labelId="pf-modal-part-2"
2235+
labelId="pf-modal-part-3"
22362236
onClose={[Function]}
2237-
ouiaId="OUIA-Generated-Modal-large-2"
2237+
ouiaId="OUIA-Generated-Modal-large-3"
22382238
ouiaSafe={true}
22392239
showClose={false}
22402240
title=""
@@ -2265,10 +2265,10 @@ exports[`<Wizard /> should render correctly in modal and unmount 1`] = `
22652265
aria-label=""
22662266
aria-labelledby="wizard"
22672267
className=""
2268-
data-ouia-component-id="OUIA-Generated-Modal-large-2"
2268+
data-ouia-component-id="OUIA-Generated-Modal-large-3"
22692269
data-ouia-component-type="PF4/ModalContent"
22702270
data-ouia-safe={true}
2271-
id="pf-modal-part-1"
2271+
id="pf-modal-part-2"
22722272
style={Object {}}
22732273
variant="large"
22742274
>
@@ -2278,10 +2278,10 @@ exports[`<Wizard /> should render correctly in modal and unmount 1`] = `
22782278
aria-labelledby="wizard"
22792279
aria-modal="true"
22802280
className="pf-c-modal-box pf-m-lg"
2281-
data-ouia-component-id="OUIA-Generated-Modal-large-2"
2281+
data-ouia-component-id="OUIA-Generated-Modal-large-3"
22822282
data-ouia-component-type="PF4/ModalContent"
22832283
data-ouia-safe={true}
2284-
id="pf-modal-part-1"
2284+
id="pf-modal-part-2"
22852285
role="dialog"
22862286
style={Object {}}
22872287
>
@@ -2934,7 +2934,7 @@ exports[`<Wizard /> should render correctly in modal and unmount 1`] = `
29342934
aria-disabled={false}
29352935
aria-label={null}
29362936
className="pf-c-button pf-m-primary"
2937-
data-ouia-component-id="OUIA-Generated-Button-primary-8"
2937+
data-ouia-component-id="OUIA-Generated-Button-primary-9"
29382938
data-ouia-component-type="PF4/Button"
29392939
data-ouia-safe={true}
29402940
disabled={false}
@@ -2956,7 +2956,7 @@ exports[`<Wizard /> should render correctly in modal and unmount 1`] = `
29562956
aria-disabled={true}
29572957
aria-label={null}
29582958
className="pf-c-button pf-m-secondary pf-m-disabled"
2959-
data-ouia-component-id="OUIA-Generated-Button-secondary-8"
2959+
data-ouia-component-id="OUIA-Generated-Button-secondary-9"
29602960
data-ouia-component-type="PF4/Button"
29612961
data-ouia-safe={true}
29622962
disabled={true}
@@ -2980,7 +2980,7 @@ exports[`<Wizard /> should render correctly in modal and unmount 1`] = `
29802980
aria-disabled={false}
29812981
aria-label={null}
29822982
className="pf-c-button pf-m-link"
2983-
data-ouia-component-id="OUIA-Generated-Button-link-8"
2983+
data-ouia-component-id="OUIA-Generated-Button-link-9"
29842984
data-ouia-component-type="PF4/Button"
29852985
data-ouia-safe={true}
29862986
disabled={false}

packages/pf4-component-mapper/src/tests/wizard/step-buttons.test.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,32 @@ describe('<WizardSTepButtons', () => {
279279
expect(handleSubmit).not.toHaveBeenCalled();
280280
});
281281

282+
it('nothing happen when ctrl is pressed', () => {
283+
event = {
284+
...event,
285+
ctrlKey: true
286+
};
287+
288+
handleEnter(event, formOptions, activeStep, findCurrentStep, handleNext, handleSubmit);
289+
290+
expect(event.preventDefault).not.toHaveBeenCalled();
291+
expect(handleNext).not.toHaveBeenCalled();
292+
expect(handleSubmit).not.toHaveBeenCalled();
293+
});
294+
295+
it('nothing happen when shift is pressed', () => {
296+
event = {
297+
...event,
298+
shiftKey: true
299+
};
300+
301+
handleEnter(event, formOptions, activeStep, findCurrentStep, handleNext, handleSubmit);
302+
303+
expect(event.preventDefault).not.toHaveBeenCalled();
304+
expect(handleNext).not.toHaveBeenCalled();
305+
expect(handleSubmit).not.toHaveBeenCalled();
306+
});
307+
282308
it('nothing happen when target is button', () => {
283309
event = {
284310
...event,

packages/pf4-component-mapper/src/tests/wizard/wizard.test.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,44 @@ describe('<Wizard />', () => {
224224
expect(enterHandle.default).toHaveBeenCalledWith(event, formOptions, '1', findCurrentStep, handleNext, handleSubmit);
225225
});
226226

227+
it('should call onCancel handler when pressing escape in modal', () => {
228+
schema = {
229+
fields: [
230+
{
231+
name: 'wizard',
232+
component: 'wizard',
233+
inModal: true,
234+
fields: [
235+
{
236+
title: 'foo-step',
237+
name: '1',
238+
fields: [
239+
{
240+
name: 'foo-field',
241+
component: 'text-field'
242+
}
243+
]
244+
}
245+
]
246+
}
247+
]
248+
};
249+
250+
const onCancel = jest.fn();
251+
252+
const wrapper = mount(<FormRenderer {...initialProps} schema={schema} onCancel={onCancel} />);
253+
254+
expect(onCancel).not.toHaveBeenCalled();
255+
256+
const wizard = wrapper.find('.pf-c-wizard');
257+
258+
const event = { key: 'Escape' };
259+
260+
wizard.props().onKeyDown(event);
261+
262+
expect(onCancel).toHaveBeenCalledWith(expect.any(Object), expect.any(Object));
263+
});
264+
227265
it('should render correctly with objects as substepOf and nodes titles', () => {
228266
schema = {
229267
fields: [

0 commit comments

Comments
 (0)