Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade testing library #4954

Merged
merged 32 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d3895d2
chore: upgrade testing-library
jmfrancois Oct 24, 2023
e732530
fix: tsconfig
jmfrancois Oct 24, 2023
4751981
fix: udpate config
jmfrancois Oct 24, 2023
42fe6a4
chore: try something
jmfrancois Oct 24, 2023
2fb440b
chore: revert
jmfrancois Oct 24, 2023
804221f
Merge remote-tracking branch 'origin/master' into jmfrancois/chore/up…
Nov 6, 2023
e1b0653
Fix some UT
Nov 7, 2023
14ea1a4
Update UT
Nov 8, 2023
5b4db8d
Merge branch 'master' into jmfrancois/chore/upgrade-testing-library
jmainguytalend Nov 8, 2023
24df624
Merge 5b4db8d4b48406b06e0d07437e45e97e3b167924 into 841be39f34ef8e579…
jmfrancois Nov 8, 2023
bd5da44
chore: yarn-deduplicate
github-actions[bot] Nov 8, 2023
40660d8
Merge remote-tracking branch 'origin/master' into jmfrancois/chore/up…
Nov 13, 2023
5bb3393
Merge 40660d88e9e4d73f0a8197d8d73cbcb3fbed8529 into e82cc7f30406efff3…
jmfrancois Nov 13, 2023
e482271
chore: yarn-deduplicate
github-actions[bot] Nov 13, 2023
45e75fe
Update yarn lock
Nov 13, 2023
60ca02e
Merge branch 'jmfrancois/chore/upgrade-testing-library' of github.com…
Nov 13, 2023
bc42429
Merge remote-tracking branch 'origin/master' into jmfrancois/chore/up…
Nov 13, 2023
8872f3e
Fix some UT #1
Nov 15, 2023
4834b8f
Fix some UT #2
Nov 15, 2023
232b061
Fix some UT #3
Nov 16, 2023
fc9a802
Update deps
Nov 16, 2023
5d85e6c
Fix some UT #4
Nov 20, 2023
5e7d405
Merge remote-tracking branch 'origin/master' into jmfrancois/chore/up…
Nov 20, 2023
5264ba0
Merge remote-tracking branch 'origin/master' into jmfrancois/chore/up…
Nov 20, 2023
a0620aa
Update prettierrc
Nov 21, 2023
531a4ce
Merge remote-tracking branch 'origin/master' into jmfrancois/chore/up…
Nov 21, 2023
9a6c5c8
Add changeset for modified non-test files
Nov 21, 2023
ae06047
Merge remote-tracking branch 'origin/master' into jmfrancois/chore/up…
Nov 21, 2023
6c0b8a6
Merge remote-tracking branch 'origin/master' into jmfrancois/chore/up…
Nov 27, 2023
441bedf
Update yarn
Nov 27, 2023
8ae32c2
Review update
Nov 27, 2023
4201510
Merge branch 'master' into jmfrancois/chore/upgrade-testing-library
romainseb Nov 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/strong-keys-drum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@talend/scripts-config-jest': major
---

chore: bump testing-library to 6.x
10 changes: 3 additions & 7 deletions fork/react-bootstrap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook"
},
"prettier": {
"singleQuote": true
},
"files": [
"CHANGELOG.md",
"lib",
Expand All @@ -46,9 +43,9 @@
"@talend/scripts-core": "^16.2.0",
"@talend/scripts-config-babel": "^13.2.0",
"@talend/scripts-config-react-webpack": "^16.3.0",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^12.1.5",
"@testing-library/user-event": "^13.5.0",
"@testing-library/jest-dom": "^6.1.4",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.5.1",
"chai": "^4.3.10",
"chalk": "^2.4.2",
"create-react-class": "^15.7.0",
Expand All @@ -63,7 +60,6 @@
"classnames": "^2.3.2",
"dom-helpers": "^3.4.0",
"invariant": "^2.2.4",
"keycode": "^2.2.1",
"prop-types": "^15.8.1",
"prop-types-extra": "^1.1.1",
"react-overlays": "^0.9.3",
Expand Down
173 changes: 88 additions & 85 deletions fork/react-bootstrap/src/Alert.test.js
Original file line number Diff line number Diff line change
@@ -1,92 +1,95 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';

import Alert from './Alert';

describe('<Alert>', () => {
it('Should output a alert with message', () => {
// when
render(
<Alert>
<strong>Message</strong>
</Alert>
);

// then
expect(screen.getByRole('alert')).toBeInTheDocument();
expect(screen.getByText('Message')).toBeInTheDocument();
});

it('Should have bsType by default', () => {
// when
render(
<Alert>
<strong>Message</strong>
</Alert>
);

// then
expect(screen.getByRole('alert')).toHaveClass('alert-info');
});

it('Should have dismissable style with onDismiss', () => {
// when
render(
<Alert onDismiss={jest.fn()}>
<strong>Message</strong>
</Alert>
);

// then
expect(screen.getByRole('alert')).toHaveClass('alert-dismissable');
});

it('Should call onDismiss callback on dismiss click', () => {
// given
const onDismiss = jest.fn();
render(
<Alert onDismiss={onDismiss} closeLabel="close">
<strong>Message</strong>
</Alert>
);
expect(onDismiss).not.toBeCalled();

// when
userEvent.click(screen.getByRole('button', { name: 'close' }));

// then
expect(onDismiss).toBeCalled();
});

it('Should have a default bsStyle class', () => {
// when
render(<Alert>Message</Alert>);

// then
expect(screen.getByRole('alert')).toHaveClass('alert-info');
});

it('Should have use bsStyle class', () => {
// when
render(<Alert bsStyle="danger">Message</Alert>);

// then
expect(screen.getByRole('alert')).toHaveClass('alert-danger');
});

describe('Web Accessibility', () => {
it('Should call onDismiss callback when the sr-only dismiss link is activated', () => {
// given
const onDismiss = jest.fn();
render(<Alert onDismiss={onDismiss}>Message</Alert>);
expect(onDismiss).not.toBeCalled();

// when
userEvent.click(screen.getByRole('button', { name: 'Close alert' }));

// then
expect(onDismiss).toBeCalled();
});
});
it('Should output a alert with message', () => {
// when
render(
<Alert>
<strong>Message</strong>
</Alert>,
);

// then
expect(screen.getByRole('alert')).toBeInTheDocument();
expect(screen.getByText('Message')).toBeInTheDocument();
});

it('Should have bsType by default', () => {
// when
render(
<Alert>
<strong>Message</strong>
</Alert>,
);

// then
expect(screen.getByRole('alert')).toHaveClass('alert-info');
});

it('Should have dismissable style with onDismiss', () => {
// when
render(
<Alert onDismiss={jest.fn()}>
<strong>Message</strong>
</Alert>,
);

// then
expect(screen.getByRole('alert')).toHaveClass('alert-dismissable');
});

it('Should call onDismiss callback on dismiss click', async () => {
const user = userEvent.setup();

// given
const onDismiss = jest.fn();
render(
<Alert onDismiss={onDismiss} closeLabel="close">
<strong>Message</strong>
</Alert>,
);
expect(onDismiss).not.toHaveBeenCalled();

// when
await user.click(screen.getByRole('button', { name: 'close' }));

// then
expect(onDismiss).toHaveBeenCalled();
});

it('Should have a default bsStyle class', () => {
// when
render(<Alert>Message</Alert>);

// then
expect(screen.getByRole('alert')).toHaveClass('alert-info');
});

it('Should have use bsStyle class', () => {
// when
render(<Alert bsStyle="danger">Message</Alert>);

// then
expect(screen.getByRole('alert')).toHaveClass('alert-danger');
});

describe('Web Accessibility', () => {
it('Should call onDismiss callback when the sr-only dismiss link is activated', async () => {
const user = userEvent.setup();

// given
const onDismiss = jest.fn();
render(<Alert onDismiss={onDismiss}>Message</Alert>);
expect(onDismiss).not.toHaveBeenCalled();

// when
await user.click(screen.getByRole('button', { name: 'Close alert' }));

// then
expect(onDismiss).toHaveBeenCalled();
});
});
});
Loading
Loading