Skip to content

Commit 9cb8aa6

Browse files
committed
Updated prop in tests and demo
1 parent 11e6885 commit 9cb8aa6

3 files changed

Lines changed: 34 additions & 12 deletions

File tree

packages/react-core/src/components/Button/__tests__/Button.test.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -556,12 +556,12 @@ describe('Favorite button', () => {
556556
});
557557

558558
describe('Dock variant', () => {
559-
test(`Renders with class ${styles.modifiers.dock} when isDock = true`, () => {
560-
render(<Button isDock>Dock Button</Button>);
559+
test(`Renders with class ${styles.modifiers.dock} when isDocked = true`, () => {
560+
render(<Button isDocked>Dock Button</Button>);
561561
expect(screen.getByRole('button')).toHaveClass(styles.modifiers.dock);
562562
});
563563

564-
test(`Does not render with class ${styles.modifiers.dock} when isDock is not passed`, () => {
564+
test(`Does not render with class ${styles.modifiers.dock} when isDocked is not passed`, () => {
565565
render(<Button>Button</Button>);
566566
expect(screen.getByRole('button')).not.toHaveClass(styles.modifiers.dock);
567567
});
@@ -575,6 +575,17 @@ describe('Dock variant', () => {
575575
render(<Button>Button</Button>);
576576
expect(screen.getByRole('button')).not.toHaveClass(styles.modifiers.textExpanded);
577577
});
578+
579+
test(`Renders with both ${styles.modifiers.dock} and ${styles.modifiers.textExpanded} when both props are true`, () => {
580+
render(
581+
<Button isDocked isTextExpanded>
582+
Dock Text Expanded Button
583+
</Button>
584+
);
585+
const button = screen.getByRole('button');
586+
expect(button).toHaveClass(styles.modifiers.dock);
587+
expect(button).toHaveClass(styles.modifiers.textExpanded);
588+
});
578589
});
579590

580591
test(`Renders basic button`, () => {

packages/react-core/src/components/MenuToggle/__tests__/MenuToggle.test.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,12 @@ test('Does not render custom icon when icon prop and isSettings are passed', ()
139139
expect(screen.queryByText('Custom icon')).not.toBeInTheDocument();
140140
});
141141

142-
test(`Renders with class ${styles.modifiers.dock} when isDock is passed`, () => {
143-
render(<MenuToggle isDock>Dock Toggle</MenuToggle>);
142+
test(`Renders with class ${styles.modifiers.dock} when isDocked is passed`, () => {
143+
render(<MenuToggle isDocked>Dock Toggle</MenuToggle>);
144144
expect(screen.getByRole('button')).toHaveClass(styles.modifiers.dock);
145145
});
146146

147-
test(`Does not render with class ${styles.modifiers.dock} when isDock is not passed`, () => {
147+
test(`Does not render with class ${styles.modifiers.dock} when isDocked is not passed`, () => {
148148
render(<MenuToggle>Toggle</MenuToggle>);
149149
expect(screen.getByRole('button')).not.toHaveClass(styles.modifiers.dock);
150150
});
@@ -158,3 +158,14 @@ test(`Does not render with class ${styles.modifiers.textExpanded} when isTextExp
158158
render(<MenuToggle>Toggle</MenuToggle>);
159159
expect(screen.getByRole('button')).not.toHaveClass(styles.modifiers.textExpanded);
160160
});
161+
162+
test(`Renders with both ${styles.modifiers.dock} and ${styles.modifiers.textExpanded} when both props are passed`, () => {
163+
render(
164+
<MenuToggle isDocked isTextExpanded>
165+
Dock Text Expanded Toggle
166+
</MenuToggle>
167+
);
168+
const button = screen.getByRole('button');
169+
expect(button).toHaveClass(styles.modifiers.dock);
170+
expect(button).toHaveClass(styles.modifiers.textExpanded);
171+
});

packages/react-core/src/demos/examples/Page/PageDockedNav.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ export const PageDockedNav: React.FunctionComponent = () => {
324324
ref={appsRef}
325325
variant="plain"
326326
icon={<ThIcon />}
327-
isDock
327+
isDocked
328328
isTextExpanded={isDockTextExpanded}
329329
aria-label="Applications"
330330
>
@@ -336,7 +336,7 @@ export const PageDockedNav: React.FunctionComponent = () => {
336336
ref={appsRef}
337337
variant="plain"
338338
icon={<ThIcon />}
339-
isDock
339+
isDocked
340340
isTextExpanded={isDockTextExpanded}
341341
aria-label="Applications"
342342
>
@@ -352,7 +352,7 @@ export const PageDockedNav: React.FunctionComponent = () => {
352352
aria-label="Settings"
353353
isSettings
354354
variant="plain"
355-
isDock
355+
isDocked
356356
isTextExpanded={isDockTextExpanded}
357357
>
358358
Settings
@@ -364,7 +364,7 @@ export const PageDockedNav: React.FunctionComponent = () => {
364364
aria-label="Settings"
365365
isSettings
366366
variant="plain"
367-
isDock
367+
isDocked
368368
isTextExpanded={isDockTextExpanded}
369369
>
370370
Settings
@@ -378,7 +378,7 @@ export const PageDockedNav: React.FunctionComponent = () => {
378378
ref={helpRef}
379379
variant="plain"
380380
icon={<QuestionCircleIcon />}
381-
isDock
381+
isDocked
382382
isTextExpanded={isDockTextExpanded}
383383
aria-label="Help"
384384
>
@@ -390,7 +390,7 @@ export const PageDockedNav: React.FunctionComponent = () => {
390390
ref={helpRef}
391391
variant="plain"
392392
icon={<QuestionCircleIcon />}
393-
isDock
393+
isDocked
394394
isTextExpanded={isDockTextExpanded}
395395
aria-label="Help"
396396
>

0 commit comments

Comments
 (0)