You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/02/17 16:16:28 UTC

[GitHub] [superset] michael-s-molina commented on a change in pull request #18784: feat(native-filters): Re-arrange controls in FilterBar

michael-s-molina commented on a change in pull request #18784:
URL: https://github.com/apache/superset/pull/18784#discussion_r809226037



##########
File path: superset-frontend/src/dashboard/components/nativeFilters/FilterBar/ActionButtons/ActionButtons.test.tsx
##########
@@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import React from 'react';
+import userEvent from '@testing-library/user-event';
+import { render, screen } from 'spec/helpers/testing-library';
+import { ActionButtons } from './index';
+
+const createProps = () => ({
+  onApply: jest.fn(),
+  onClearAll: jest.fn(),
+  dataMaskSelected: {
+    DefaultsID: {
+      filterState: {
+        value: null,
+      },
+    },
+  },
+  dataMaskApplied: {
+    DefaultsID: {
+      id: 'DefaultsID',
+      filterState: {
+        value: null,
+      },
+    },
+  },
+  isApplyDisabled: false,
+});
+
+test('should render the "Clear all" option', () => {
+  const mockedProps = createProps();
+  render(<ActionButtons {...mockedProps} />, { useRedux: true });
+  expect(screen.getByText('Clear all')).toBeInTheDocument();
+});
+
+test('should render the "Apply" button', () => {
+  const mockedProps = createProps();
+  render(<ActionButtons {...mockedProps} />, { useRedux: true });
+  expect(screen.getByText('Apply filters')).toBeInTheDocument();
+  expect(screen.getByText('Apply filters').parentElement).toBeEnabled();
+});
+
+test('should render the "Clear all" button as disabled', () => {

Review comment:
       Since we're not passing any additional prop to the default render here, I think this test is sufficient and we could remove the one named "should render the "Clear all" option". Because this test is already checking that the "Clear all" button exists and is also disabled.




-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org