Skip to content

Commit 612d640

Browse files
Merge remote-tracking branch 'origin/release-22.x' into Peter_Kulko/sync-22-to-23
2 parents 1b45e08 + 477e1ee commit 612d640

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+148
-158
lines changed

example/src/MyComponent.jsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import React, { useState } from 'react';
2-
import { Button, Form, Icon, Bubble, Stack, Container } from '@openedx/paragon'; // eslint-disable-line
3-
import { FavoriteBorder } from '@openedx/paragon/icons'; // eslint-disable-line
2+
// eslint-disable-next-line import/no-extraneous-dependencies
3+
import {
4+
Button, Form, Icon, Bubble, Stack, Container,
5+
} from '@openedx/paragon';
6+
// eslint-disable-next-line import/no-extraneous-dependencies
7+
import { FavoriteBorder } from '@openedx/paragon/icons';
48

59
function MyComponent() {
610
const [value, setValue] = useState('');

lib/version.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
/* eslint-disable no-console */
21
const chalk = require('chalk');
32
const { version } = require('../package.json');
43

54
function versionCommand() {
6-
console.log(`Paragon CLI version: ${chalk.bold(version)}`);
5+
console.log(`Paragon CLI version: ${chalk.bold(version)}`); /* eslint-disable-line no-console */
76
}
87

98
module.exports = versionCommand;

src/Card/CardCarousel/tests/CardCarousel.test.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ jest.mock('../../../OverflowScroll', () => ({
1212
OverflowScroll: jest.fn(),
1313
}));
1414

15-
// eslint-disable-next-line react/prop-types
1615
OverflowScroll.mockImplementation(({ children }) => {
1716
const overflowRef = { current: document.createElement('div') };
1817
const contextValue = {

src/Chip/constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// eslint-disable-next-line import/prefer-default-export
21
export const STYLE_VARIANTS = {
32
DARK: 'dark',
43
LIGHT: 'light',

src/ChipCarousel/ChipCarousel.test.jsx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
/* eslint-disable jsx-a11y/click-events-have-key-events */
2-
/* eslint-disable jsx-a11y/no-static-element-interactions */
31
import React from 'react';
42
import { render, screen } from '@testing-library/react';
53
import userEvent from '@testing-library/user-event';
64
import { IntlProvider } from 'react-intl';
75
import ChipCarousel from '.';
6+
import Chip from '../Chip';
87

9-
const items = [
10-
<div onClick={jest.fn()} data-testid="chip">Item 1</div>,
11-
<div onClick={jest.fn()} data-testid="chip">Item 2</div>,
12-
<div onClick={jest.fn()} data-testid="chip">Item 3</div>,
13-
<div onClick={jest.fn()} data-testid="chip" />,
14-
];
8+
const items = Array.from({ length: 4 }, (_, i) => (
9+
<Chip onClick={jest.fn()}>
10+
{`Item ${i + 1}`}
11+
</Chip>
12+
));
1513

1614
const ariaLabel = 'Test aria label';
1715
function TestingChipCarousel(props) {
@@ -29,9 +27,9 @@ describe('<ChipCarousel />', () => {
2927
const carousel = screen.getByTestId('chip-carousel');
3028
expect(carousel).toBeTruthy();
3129

32-
const chipItems = screen.queryAllByTestId('chip');
33-
expect(chipItems).toHaveLength(items.length - 1);
34-
for (let i = 0; i < chipItems.length - 1; i++) {
30+
const chipItems = screen.queryAllByRole('button');
31+
expect(chipItems).toHaveLength(items.length);
32+
for (let i = 0; i < chipItems.length; i++) {
3533
expect(chipItems[i].textContent).toBe(items[i].props.children);
3634
}
3735
});

src/Container/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable react/require-default-props */
21
import React, {
32
ForwardedRef, ReactNode, ElementType, forwardRef,
43
} from 'react';

src/DataTable/CollapsibleButtonGroup.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ function CollapsibleButtonGroup({
5151
const cloneAction = (action, index) => React.cloneElement(
5252
action.component,
5353
{
54-
// eslint-disable-next-line react/no-array-index-key
5554
key: `${action}${index}`,
5655
as: Button, // for backwards compatibility this is needed
5756
...action.args,

src/DataTable/README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -423,17 +423,17 @@ See ``dataViewToggleOptions`` props documentation for all supported props.
423423
Filter: CheckboxFilter,
424424
filter: 'includesValue',
425425
filterChoices: [{
426-
name: 'orange tabby',
426+
name: 'Orange Tabby',
427427
number: 1,
428428
value: 'orange tabby',
429429
},
430430
{
431-
name: 'brown tabby',
431+
name: 'Brown Tabby',
432432
number: 1,
433433
value: 'brown tabby',
434434
},
435435
{
436-
name: 'siamese',
436+
name: 'Siamese',
437437
number: 1,
438438
value: 'siamese',
439439
}],
@@ -503,17 +503,17 @@ See ``dataViewToggleOptions`` props documentation for all supported props.
503503
Filter: CheckboxFilter,
504504
filter: 'includesValue',
505505
filterChoices: [{
506-
name: 'orange tabby',
506+
name: 'Orange Tabby',
507507
number: 1,
508508
value: 'orange tabby',
509509
},
510510
{
511-
name: 'brown tabby',
511+
name: 'Brown Tabby',
512512
number: 1,
513513
value: 'brown tabby',
514514
},
515515
{
516-
name: 'siamese',
516+
name: 'Siamese',
517517
number: 1,
518518
value: 'siamese',
519519
}]
@@ -1306,17 +1306,17 @@ For a more desktop friendly view, you can move filters into a sidebar by providi
13061306
Filter: CheckboxFilter,
13071307
filter: 'includesValue',
13081308
filterChoices: [{
1309-
name: 'orange tabby',
1309+
name: 'Orange Tabby',
13101310
number: 2,
13111311
value: 'orange tabby',
13121312
},
13131313
{
1314-
name: 'brown tabby',
1314+
name: 'Brown Tabby',
13151315
number: 2,
13161316
value: 'brown tabby',
13171317
},
13181318
{
1319-
name: 'siamese',
1319+
name: 'Siamese',
13201320
number: 1,
13211321
value: 'siamese',
13221322
}]
@@ -1659,17 +1659,17 @@ After selecting the maximum possible number of rows, you can display an error me
16591659
filter: 'includesValue',
16601660
filterChoices: [
16611661
{
1662-
name: 'russian white',
1662+
name: 'Russian white',
16631663
number: 1,
16641664
value: 'russian white',
16651665
},
16661666
{
1667-
name: 'orange tabby',
1667+
name: 'Orange Tabby',
16681668
number: 2,
16691669
value: 'orange tabby',
16701670
},
16711671
{
1672-
name: 'brown tabby',
1672+
name: 'Brown Tabby',
16731673
number: 3,
16741674
value: 'brown tabby',
16751675
},

src/DataTable/filters/CheckboxFilter.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function CheckboxFilter({
3131
{filterChoices.map(({ name, number, value }) => (
3232
<Form.Checkbox
3333
key={`${headerBasedId}${name}`}
34-
value={name}
34+
value={value}
3535
checked={checkedBoxes.includes(value)}
3636
onChange={() => changeCheckbox(value)}
3737
aria-label={name}

src/DataTable/filters/tests/CheckboxFilter.test.jsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,35 @@ describe('<CheckboxFilter />', () => {
8383
expect(checkbox).not.toBeChecked();
8484
});
8585
});
86+
87+
it('uses value for filtering when name and value differ', async () => {
88+
const testChoice = { name: 'Test', value: 'test' };
89+
const propsWithCaseDifference = {
90+
column: {
91+
...props.column,
92+
filterChoices: [testChoice],
93+
filterValue: [],
94+
},
95+
};
96+
97+
const { rerender } = render(<CheckboxFilter {...propsWithCaseDifference} />);
98+
99+
const checkbox = screen.getByLabelText(testChoice.name);
100+
101+
await userEvent.click(checkbox);
102+
103+
expect(setFilterMock).toHaveBeenCalledWith([testChoice.value]);
104+
105+
rerender(<CheckboxFilter column={{
106+
...propsWithCaseDifference.column,
107+
filterValue: [testChoice.value],
108+
}}
109+
/>);
110+
111+
expect(checkbox).toBeChecked();
112+
113+
await userEvent.click(checkbox);
114+
115+
expect(setFilterMock).toHaveBeenCalledWith([]);
116+
});
86117
});

0 commit comments

Comments
 (0)