rebenitez1802 commented on code in PR #37017:
URL: https://github.com/apache/superset/pull/37017#discussion_r2687427646
##########
superset-frontend/src/filters/components/Select/SelectFilterPlugin.test.tsx:
##########
@@ -602,6 +602,84 @@ describe('SelectFilterPlugin', () => {
expect(options[2]).toHaveTextContent('alpha');
});
+ test('Select boolean FALSE value in single-select mode', async () => {
+ const setDataMaskMock = jest.fn();
+ const testProps = {
+ ...selectMultipleProps,
+ formData: {
+ ...selectMultipleProps.formData,
+ multiSelect: false,
+ groupby: ['is_active'],
+ },
+ queriesData: [
+ {
+ ...selectMultipleProps.queriesData[0],
+ colnames: ['is_active'],
+ data: [{ is_active: true }, { is_active: false }],
+ applied_filters: [{ column: 'is_active' }],
+ },
+ ],
+ filterState: { value: undefined },
+ };
+
+ render(
+ // @ts-ignore
+ <SelectFilterPlugin
+ // @ts-ignore
+ {...transformProps(testProps)}
+ setDataMask={setDataMaskMock}
+ showOverflow={false}
+ />,
+ {
+ useRedux: true,
+ initialState: {
+ nativeFilters: {
+ filters: {
+ 'test-filter': {
+ name: 'Test Filter',
+ },
+ },
+ },
+ dataMask: {
+ 'test-filter': {
+ extraFormData: {},
+ filterState: {
+ value: undefined,
+ },
+ },
+ },
+ },
+ },
+ );
+
+ const filterSelect = screen.getByRole('combobox');
+ await userEvent.click(filterSelect);
+
+ const falseOption = await screen.findByRole('option', { name: /false/i });
+ expect(falseOption).toBeInTheDocument();
+ await userEvent.click(falseOption);
+
+ const selectedElements = await screen.findAllByTitle('FALSE');
+ expect(selectedElements.length).toBeGreaterThan(0);
Review Comment:
```suggestion
expect(await screen.findByTitle('FALSE')).toBeInTheDocument();
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]