dependabot[bot] on npm_and_yarn
Bump y18n from 4.0.0 to 4.0.1 … (compare)
Hi everyone!
I am try to write a unit test of biz components which is base on antd select.
I use @testing-library
to write unit test.
This is my unit test code:
it('filter by input', async () => {
const { getByRole, rerender, container } = render(<MySelect />);
await act(async () => {
fireEvent.mouseDown(getByRole('combobox'));
});
expect(screen.queryAllByRole('option')).toHaveLength(58); // received => 2
});
This is my biz component
const OPTOINS = [{ value: 'a', text: 'a' }, {value: 'b', text: ‘b'} ]; // There are 58 options.
const MySelect = forwardRef((props, ref) => {
const handleSelectFilter = useCallback(
(input, option) => option.children.includes(input),
[],
);
return (
<Select
showSearch
defaultActiveFirstOption
filterOption={handleSelectFilter}
{...props}
ref={ref}
>
{OPTIONS.map(({ value, text }) => (
<Select.Option key={value}>{text}</Select.Option>
))}
</Select>
);
});
What should i do to simulate open select option list?
In antd v4, select impl by virtual list.
So, what is the correct excepted value?
I made a Youtube playlist about AntD English tutorials.
You can watch the videos.
You can add videos, this is how:
Use this link
https://www.youtube.com/playlist?list=PL0JRSe9GT_lfNG_Ju6Wz1Xb5-gYUn3bZt&jct=XGlUR-NvEDkDdNXiJxXBBBG-YhkDJA
Click CONTINUE
Click the Haburger_Plus sign to Save playlist (You become an author of the playlist)
Each time you want to add a video: 3 dots, Save to playlist, choose AntD .
Let me know if you like this idea and how difficult it was to follow the steps.
I'm thinking which state management library to use in a new UMI project: DVA or Redux.
You might have some thoughts on this, or just find this info useful.
What's the connection with antd?
Antd uses UMI and DVA.
DVA
PROS (DVA is good because:)
There is a Chinese community behind it (I live in China), they have tutorials and groups for questions.
UMI is made for DVA, so future compatibility is granted.
Small size. Empty UMI project with DVA added is 0.5 MB.
CONS (DVA is bad because:)
Poorly documented.
Redux
PROS:
There is a much bigger English language community behind it.
Very complex, has Hooks and other features to cover special needs.
CONS:
Large size. Empty UMI project with Redux added is 2.6 MB.
Conclusion:
This is not final, but i might choose DVA because of the size. It won't be easy though, cause I don't understand the Chinese documentation and machine translation gives a poor result.
@emelerdem
Hi!
İ used filtered antd
but not working
{
title: t('columns.status'),
dataIndex: 'status',
key: 'status',
editable: true,
inputType:'status',
filters: [
{
text: 'ONLINE',
value: "ONLINE",
},
{
text: 'OFFLINE',
value: "OFFLINE",
},
],
filterMultiple: false,
onFilter: (value, record) => record.status.indexOf(value) === 0,
this is my code