Skip to content

Commit b4973cb

Browse files
committed
Try to fix flaky test
1 parent 8a66f03 commit b4973cb

2 files changed

Lines changed: 12 additions & 15 deletions

File tree

packages/module/patternfly-docs/content/extensions/chatbot/tree-shaking.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Place this import after your PatternFly CSS imports so ChatBot overrides apply c
7979

8080
## Verify tree-shaking in your project
8181

82-
The repository includes a tree-shaking demo at `packages/tree-shaking-demo/` that builds six scenarios and compares bundle size, icon count, and component count:
82+
The repository includes a tree-shaking demo at `packages/tree-shaking-demo/` that builds three scenarios and compares bundle size, icon count, and component count:
8383

8484
```bash
8585
npm run build -w @patternfly/chatbot

packages/module/src/ResponseActions/ResponseActions.test.tsx

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -116,18 +116,16 @@ describe('ResponseActions', () => {
116116
});
117117
});
118118
it('should handle click outside of group of buttons correctly', async () => {
119-
// using message just so we have something outside the group that's rendered
120119
render(
121-
<Message
122-
name="Bot"
123-
role="bot"
124-
avatar=""
125-
content="I updated your account with those settings. You're ready to set up your first dashboard!"
126-
actions={{
127-
positive: {},
128-
negative: {}
129-
}}
130-
/>
120+
<div>
121+
<ResponseActions
122+
actions={{
123+
positive: { onClick: jest.fn() },
124+
negative: { onClick: jest.fn() }
125+
}}
126+
/>
127+
<div data-testid="outside">Outside</div>
128+
</div>
131129
);
132130
const goodBtn = screen.getByRole('button', { name: 'Good response' });
133131
const badBtn = screen.getByRole('button', { name: 'Bad response' });
@@ -145,9 +143,8 @@ describe('ResponseActions', () => {
145143
'pf-chatbot__button--response-action-clicked'
146144
);
147145
expect(goodBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
148-
await userEvent.click(
149-
screen.getByText("I updated your account with those settings. You're ready to set up your first dashboard!")
150-
);
146+
147+
await userEvent.click(screen.getByTestId('outside'));
151148
expect(goodBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
152149
expect(badBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
153150
});

0 commit comments

Comments
 (0)