You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by mi...@apache.org on 2022/09/09 10:44:46 UTC
[superset] branch master updated: test: Fix act errors in SelectFilterPlugin test (#21396)
This is an automated email from the ASF dual-hosted git repository.
michaelsmolina pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 584f2e63d1 test: Fix act errors in SelectFilterPlugin test (#21396)
584f2e63d1 is described below
commit 584f2e63d185a2dec5c9e49aab288840a99f24e0
Author: Lyndsi Kay Williams <55...@users.noreply.github.com>
AuthorDate: Fri Sep 9 05:44:35 2022 -0500
test: Fix act errors in SelectFilterPlugin test (#21396)
---
.../components/Select/SelectFilterPlugin.test.tsx | 32 ++++++++++++++++------
1 file changed, 24 insertions(+), 8 deletions(-)
diff --git a/superset-frontend/src/filters/components/Select/SelectFilterPlugin.test.tsx b/superset-frontend/src/filters/components/Select/SelectFilterPlugin.test.tsx
index 8c025c9711..f0aa4453b1 100644
--- a/superset-frontend/src/filters/components/Select/SelectFilterPlugin.test.tsx
+++ b/superset-frontend/src/filters/components/Select/SelectFilterPlugin.test.tsx
@@ -24,6 +24,8 @@ import { NULL_STRING } from 'src/utils/common';
import SelectFilterPlugin from './SelectFilterPlugin';
import transformProps from './transformProps';
+jest.useFakeTimers();
+
const selectMultipleProps = {
formData: {
sortAscending: true,
@@ -86,7 +88,7 @@ describe('SelectFilterPlugin', () => {
jest.clearAllMocks();
});
- it('Add multiple values with first render', () => {
+ test('Add multiple values with first render', async () => {
getWrapper();
expect(setDataMask).toHaveBeenCalledWith({
extraFormData: {},
@@ -114,6 +116,7 @@ describe('SelectFilterPlugin', () => {
});
userEvent.click(screen.getByRole('combobox'));
userEvent.click(screen.getByTitle('girl'));
+ expect(await screen.findByTitle(/girl/i)).toBeInTheDocument();
expect(setDataMask).toHaveBeenCalledWith({
__cache: {
value: ['boy'],
@@ -134,9 +137,14 @@ describe('SelectFilterPlugin', () => {
});
});
- it('Remove multiple values when required', () => {
+ test('Remove multiple values when required', () => {
getWrapper();
- userEvent.click(document.querySelector('[data-icon="close"]')!);
+ userEvent.click(
+ screen.getByRole('img', {
+ name: /close-circle/i,
+ hidden: true,
+ }),
+ );
expect(setDataMask).toHaveBeenCalledWith({
__cache: {
value: ['boy'],
@@ -157,9 +165,14 @@ describe('SelectFilterPlugin', () => {
});
});
- it('Remove multiple values when not required', () => {
+ test('Remove multiple values when not required', () => {
getWrapper({ enableEmptyFilter: false });
- userEvent.click(document.querySelector('[data-icon="close"]')!);
+ userEvent.click(
+ screen.getByRole('img', {
+ name: /close-circle/i,
+ hidden: true,
+ }),
+ );
expect(setDataMask).toHaveBeenCalledWith({
__cache: {
value: ['boy'],
@@ -172,9 +185,10 @@ describe('SelectFilterPlugin', () => {
});
});
- it('Select single values with inverse', () => {
+ test('Select single values with inverse', async () => {
getWrapper({ multiSelect: false, inverseSelection: true });
userEvent.click(screen.getByRole('combobox'));
+ expect(await screen.findByTitle('girl')).toBeInTheDocument();
userEvent.click(screen.getByTitle('girl'));
expect(setDataMask).toHaveBeenCalledWith({
__cache: {
@@ -196,9 +210,10 @@ describe('SelectFilterPlugin', () => {
});
});
- it('Select single null (empty) value', () => {
+ test('Select single null (empty) value', async () => {
getWrapper();
userEvent.click(screen.getByRole('combobox'));
+ expect(await screen.findByRole('combobox')).toBeInTheDocument();
userEvent.click(screen.getByTitle(NULL_STRING));
expect(setDataMask).toHaveBeenLastCalledWith({
__cache: {
@@ -220,9 +235,10 @@ describe('SelectFilterPlugin', () => {
});
});
- it('Add ownState with column types when search all options', () => {
+ test('Add ownState with column types when search all options', async () => {
getWrapper({ searchAllOptions: true, multiSelect: false });
userEvent.click(screen.getByRole('combobox'));
+ expect(await screen.findByRole('combobox')).toBeInTheDocument();
userEvent.click(screen.getByTitle('girl'));
expect(setDataMask).toHaveBeenCalledWith({
__cache: {