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 2021/03/31 17:48:05 UTC

[GitHub] [superset] yardz opened a new pull request #13888: test: SliceHeader

yardz opened a new pull request #13888:
URL: https://github.com/apache/superset/pull/13888


   ### SUMMARY
   Tests for SliceHeader
   


-- 
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.

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


[GitHub] [superset] michael-s-molina commented on a change in pull request #13888: test: SliceHeader

Posted by GitBox <gi...@apache.org>.
michael-s-molina commented on a change in pull request #13888:
URL: https://github.com/apache/superset/pull/13888#discussion_r605632028



##########
File path: superset-frontend/src/dashboard/components/SliceHeader/SliceHeader.test.tsx
##########
@@ -0,0 +1,399 @@
+/**
+ * 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 { Slice } from 'src/types/Chart';
+import React from 'react';
+import { render, screen } from 'spec/helpers/testing-library';
+import userEvent from '@testing-library/user-event';
+import SliceHeader from '.';
+
+jest.mock('src/dashboard/components/SliceHeaderControls', () => ({
+  __esModule: true,
+  default: (props: any) => (
+    <div
+      data-test="SliceHeaderControls"
+      data-slice={JSON.stringify(props.slice)}
+      data-is-cached={props.isCached}
+      data-is-expanded={props.isExpanded}
+      data-cached-dttm={props.cachedDttm}
+      data-updated-dttm={props.updatedDttm}
+      data-superset-can-explore={props.supersetCanExplore}
+      data-superset-can-csv={props.supersetCanCSV}
+      data-slice-can-edit={props.sliceCanEdit}
+      data-component-id={props.componentId}
+      data-dashboard-id={props.dashboardId}
+      data-is-full-size={props.isFullSize}
+      data-chart-status={props.chartStatus}
+    >
+      <button
+        type="button"
+        data-test="toggleExpandSlice"
+        onClick={props.toggleExpandSlice}
+      >
+        toggleExpandSlice
+      </button>
+      <button
+        type="button"
+        data-test="forceRefresh"
+        onClick={props.forceRefresh}
+      >
+        forceRefresh
+      </button>
+
+      <button
+        type="button"
+        data-test="exploreChart"
+        onClick={props.exploreChart}
+      >
+        exploreChart
+      </button>
+
+      <button type="button" data-test="exportCSV" onClick={props.exportCSV}>
+        exportCSV
+      </button>
+
+      <button
+        type="button"
+        data-test="handleToggleFullSize"
+        onClick={props.handleToggleFullSize}
+      >
+        handleToggleFullSize
+      </button>
+
+      <button
+        type="button"
+        data-test="addSuccessToast"
+        onClick={props.addSuccessToast}
+      >
+        addSuccessToast
+      </button>
+
+      <button
+        type="button"
+        data-test="addDangerToast"
+        onClick={props.addDangerToast}
+      >
+        addDangerToast
+      </button>
+    </div>
+  ),
+}));
+
+jest.mock('src/dashboard/containers/FiltersBadge', () => ({
+  __esModule: true,
+  default: (props: any) => (
+    <div data-test="FiltersBadge" data-chart-id={props.chartId} />
+  ),
+}));
+
+const createProps = () => ({
+  filters: {}, // is in typing but not being used
+  editMode: false,
+  annotationQuery: { param01: 'annotationQuery' } as any,
+  annotationError: { param01: 'annotationError' } as any,
+  cachedDttm: [] as string[],
+  updatedDttm: 1617207718004,
+  isCached: [false],
+  isExpanded: false,
+  sliceName: 'Vaccine Candidates per Phase',
+  supersetCanExplore: true,
+  supersetCanCSV: true,
+  sliceCanEdit: false,
+  slice: ({
+    slice_id: 312,
+    slice_url: '/superset/explore/?form_data=%7B%22slice_id%22%3A%20312%7D',
+    slice_name: 'Vaccine Candidates per Phase',
+    form_data: {
+      adhoc_filters: [],
+      bottom_margin: 'auto',
+      color_scheme: 'SUPERSET_DEFAULT',
+      columns: [],
+      datasource: '58__table',
+      groupby: ['clinical_stage'],
+      label_colors: {},
+      metrics: ['count'],
+      row_limit: 10000,
+      show_legend: false,
+      time_range: 'No filter',
+      time_range_endpoints: ['inclusive', 'exclusive'],
+      url_params: {},
+      viz_type: 'dist_bar',
+      x_ticks_layout: 'auto',
+      y_axis_format: 'SMART_NUMBER',
+      slice_id: 312,
+    },
+    viz_type: 'dist_bar',
+    datasource: '58__table',
+    description: null,
+    description_markeddown: '',
+    owners: [],
+    modified: '<span class="no-wrap">20 hours ago</span>',
+    changed_on: 1617143411366,
+  } as unknown) as Slice,
+  componentId: 'CHART-aGfmWtliqA',
+  dashboardId: 26,
+  isFullSize: false,
+  chartStatus: 'rendered',
+  addSuccessToast: jest.fn(),
+  addDangerToast: jest.fn(),
+  handleToggleFullSize: jest.fn(),
+  updateSliceName: jest.fn(),
+  toggleExpandSlice: jest.fn(),
+  forceRefresh: jest.fn(),
+  exploreChart: jest.fn(),
+  exportCSV: jest.fn(),
+});
+
+test('Should render', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByTestId('slice-header')).toBeInTheDocument();
+});
+
+test('Should render - default props', () => {
+  const props = createProps();
+
+  // @ts-ignore
+  delete props.forceRefresh;
+  // @ts-ignore
+  delete props.updateSliceName;
+  // @ts-ignore
+  delete props.toggleExpandSlice;
+  // @ts-ignore
+  delete props.exploreChart;
+  // @ts-ignore
+  delete props.exportCSV;
+  // @ts-ignore
+  delete props.innerRef;
+  // @ts-ignore
+  delete props.editMode;
+  // @ts-ignore
+  delete props.annotationQuery;
+  // @ts-ignore
+  delete props.annotationError;
+  // @ts-ignore
+  delete props.cachedDttm;
+  // @ts-ignore
+  delete props.updatedDttm;
+  // @ts-ignore
+  delete props.isCached;
+  // @ts-ignore
+  delete props.isExpanded;
+  // @ts-ignore
+  delete props.sliceName;
+  // @ts-ignore
+  delete props.supersetCanExplore;
+  // @ts-ignore
+  delete props.supersetCanCSV;
+  // @ts-ignore
+  delete props.sliceCanEdit;
+
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByTestId('slice-header')).toBeInTheDocument();
+});
+
+test('Should render default props and "call" actions', () => {
+  const props = createProps();
+
+  // @ts-ignore
+  delete props.forceRefresh;
+  // @ts-ignore
+  delete props.updateSliceName;
+  // @ts-ignore
+  delete props.toggleExpandSlice;
+  // @ts-ignore
+  delete props.exploreChart;
+  // @ts-ignore
+  delete props.exportCSV;
+  // @ts-ignore
+  delete props.innerRef;
+  // @ts-ignore
+  delete props.editMode;
+  // @ts-ignore
+  delete props.annotationQuery;
+  // @ts-ignore
+  delete props.annotationError;
+  // @ts-ignore
+  delete props.cachedDttm;
+  // @ts-ignore
+  delete props.updatedDttm;
+  // @ts-ignore
+  delete props.isCached;
+  // @ts-ignore
+  delete props.isExpanded;
+  // @ts-ignore
+  delete props.sliceName;
+  // @ts-ignore
+  delete props.supersetCanExplore;
+  // @ts-ignore
+  delete props.supersetCanCSV;
+  // @ts-ignore
+  delete props.sliceCanEdit;

Review comment:
       Is this required?

##########
File path: superset-frontend/src/dashboard/components/SliceHeader/SliceHeader.test.tsx
##########
@@ -0,0 +1,399 @@
+/**
+ * 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 { Slice } from 'src/types/Chart';
+import React from 'react';
+import { render, screen } from 'spec/helpers/testing-library';
+import userEvent from '@testing-library/user-event';
+import SliceHeader from '.';
+
+jest.mock('src/dashboard/components/SliceHeaderControls', () => ({
+  __esModule: true,
+  default: (props: any) => (
+    <div
+      data-test="SliceHeaderControls"
+      data-slice={JSON.stringify(props.slice)}
+      data-is-cached={props.isCached}
+      data-is-expanded={props.isExpanded}
+      data-cached-dttm={props.cachedDttm}
+      data-updated-dttm={props.updatedDttm}
+      data-superset-can-explore={props.supersetCanExplore}
+      data-superset-can-csv={props.supersetCanCSV}
+      data-slice-can-edit={props.sliceCanEdit}
+      data-component-id={props.componentId}
+      data-dashboard-id={props.dashboardId}
+      data-is-full-size={props.isFullSize}
+      data-chart-status={props.chartStatus}
+    >
+      <button
+        type="button"
+        data-test="toggleExpandSlice"
+        onClick={props.toggleExpandSlice}
+      >
+        toggleExpandSlice
+      </button>
+      <button
+        type="button"
+        data-test="forceRefresh"
+        onClick={props.forceRefresh}
+      >
+        forceRefresh
+      </button>
+
+      <button
+        type="button"
+        data-test="exploreChart"
+        onClick={props.exploreChart}
+      >
+        exploreChart
+      </button>
+
+      <button type="button" data-test="exportCSV" onClick={props.exportCSV}>
+        exportCSV
+      </button>
+
+      <button
+        type="button"
+        data-test="handleToggleFullSize"
+        onClick={props.handleToggleFullSize}
+      >
+        handleToggleFullSize
+      </button>
+
+      <button
+        type="button"
+        data-test="addSuccessToast"
+        onClick={props.addSuccessToast}
+      >
+        addSuccessToast
+      </button>
+
+      <button
+        type="button"
+        data-test="addDangerToast"
+        onClick={props.addDangerToast}
+      >
+        addDangerToast
+      </button>
+    </div>
+  ),
+}));
+
+jest.mock('src/dashboard/containers/FiltersBadge', () => ({
+  __esModule: true,
+  default: (props: any) => (
+    <div data-test="FiltersBadge" data-chart-id={props.chartId} />
+  ),
+}));
+
+const createProps = () => ({
+  filters: {}, // is in typing but not being used
+  editMode: false,
+  annotationQuery: { param01: 'annotationQuery' } as any,
+  annotationError: { param01: 'annotationError' } as any,
+  cachedDttm: [] as string[],
+  updatedDttm: 1617207718004,
+  isCached: [false],
+  isExpanded: false,
+  sliceName: 'Vaccine Candidates per Phase',
+  supersetCanExplore: true,
+  supersetCanCSV: true,
+  sliceCanEdit: false,
+  slice: ({
+    slice_id: 312,
+    slice_url: '/superset/explore/?form_data=%7B%22slice_id%22%3A%20312%7D',
+    slice_name: 'Vaccine Candidates per Phase',
+    form_data: {
+      adhoc_filters: [],
+      bottom_margin: 'auto',
+      color_scheme: 'SUPERSET_DEFAULT',
+      columns: [],
+      datasource: '58__table',
+      groupby: ['clinical_stage'],
+      label_colors: {},
+      metrics: ['count'],
+      row_limit: 10000,
+      show_legend: false,
+      time_range: 'No filter',
+      time_range_endpoints: ['inclusive', 'exclusive'],
+      url_params: {},
+      viz_type: 'dist_bar',
+      x_ticks_layout: 'auto',
+      y_axis_format: 'SMART_NUMBER',
+      slice_id: 312,
+    },
+    viz_type: 'dist_bar',
+    datasource: '58__table',
+    description: null,
+    description_markeddown: '',
+    owners: [],
+    modified: '<span class="no-wrap">20 hours ago</span>',
+    changed_on: 1617143411366,
+  } as unknown) as Slice,
+  componentId: 'CHART-aGfmWtliqA',
+  dashboardId: 26,
+  isFullSize: false,
+  chartStatus: 'rendered',
+  addSuccessToast: jest.fn(),
+  addDangerToast: jest.fn(),
+  handleToggleFullSize: jest.fn(),
+  updateSliceName: jest.fn(),
+  toggleExpandSlice: jest.fn(),
+  forceRefresh: jest.fn(),
+  exploreChart: jest.fn(),
+  exportCSV: jest.fn(),
+});
+
+test('Should render', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByTestId('slice-header')).toBeInTheDocument();
+});
+
+test('Should render - default props', () => {
+  const props = createProps();
+
+  // @ts-ignore
+  delete props.forceRefresh;
+  // @ts-ignore
+  delete props.updateSliceName;
+  // @ts-ignore
+  delete props.toggleExpandSlice;
+  // @ts-ignore
+  delete props.exploreChart;
+  // @ts-ignore
+  delete props.exportCSV;
+  // @ts-ignore
+  delete props.innerRef;
+  // @ts-ignore
+  delete props.editMode;
+  // @ts-ignore
+  delete props.annotationQuery;
+  // @ts-ignore
+  delete props.annotationError;
+  // @ts-ignore
+  delete props.cachedDttm;
+  // @ts-ignore
+  delete props.updatedDttm;
+  // @ts-ignore
+  delete props.isCached;
+  // @ts-ignore
+  delete props.isExpanded;
+  // @ts-ignore
+  delete props.sliceName;
+  // @ts-ignore
+  delete props.supersetCanExplore;
+  // @ts-ignore
+  delete props.supersetCanCSV;
+  // @ts-ignore
+  delete props.sliceCanEdit;
+
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByTestId('slice-header')).toBeInTheDocument();
+});
+
+test('Should render default props and "call" actions', () => {
+  const props = createProps();
+
+  // @ts-ignore
+  delete props.forceRefresh;
+  // @ts-ignore
+  delete props.updateSliceName;
+  // @ts-ignore
+  delete props.toggleExpandSlice;
+  // @ts-ignore
+  delete props.exploreChart;
+  // @ts-ignore
+  delete props.exportCSV;
+  // @ts-ignore
+  delete props.innerRef;
+  // @ts-ignore
+  delete props.editMode;
+  // @ts-ignore
+  delete props.annotationQuery;
+  // @ts-ignore
+  delete props.annotationError;
+  // @ts-ignore
+  delete props.cachedDttm;
+  // @ts-ignore
+  delete props.updatedDttm;
+  // @ts-ignore
+  delete props.isCached;
+  // @ts-ignore
+  delete props.isExpanded;
+  // @ts-ignore
+  delete props.sliceName;
+  // @ts-ignore
+  delete props.supersetCanExplore;
+  // @ts-ignore
+  delete props.supersetCanCSV;
+  // @ts-ignore
+  delete props.sliceCanEdit;
+
+  render(<SliceHeader {...props} />, { useRedux: true });
+  userEvent.click(screen.getByTestId('toggleExpandSlice'));
+  userEvent.click(screen.getByTestId('forceRefresh'));
+  userEvent.click(screen.getByTestId('exploreChart'));
+  userEvent.click(screen.getByTestId('exportCSV'));
+  userEvent.click(screen.getByTestId('addSuccessToast'));
+  userEvent.click(screen.getByTestId('addDangerToast'));
+  userEvent.click(screen.getByTestId('handleToggleFullSize'));
+  expect(screen.getByTestId('slice-header')).toBeInTheDocument();
+});
+
+test('Should render title', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByText('Vaccine Candidates per Phase')).toBeInTheDocument();
+});
+
+test('Should render "annoationsLoading"', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(
+    screen.getByRole('img', {
+      name: 'Annotation layers are still loading.',
+    }),
+  ).toBeInTheDocument();
+});
+
+test('Should render "annoationsError"', () => {

Review comment:
       ```suggestion
   test('Should render "annotationsError"', () => {
   ```

##########
File path: superset-frontend/src/dashboard/components/SliceHeader/SliceHeader.test.tsx
##########
@@ -0,0 +1,399 @@
+/**
+ * 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 { Slice } from 'src/types/Chart';
+import React from 'react';
+import { render, screen } from 'spec/helpers/testing-library';
+import userEvent from '@testing-library/user-event';
+import SliceHeader from '.';
+
+jest.mock('src/dashboard/components/SliceHeaderControls', () => ({
+  __esModule: true,
+  default: (props: any) => (
+    <div
+      data-test="SliceHeaderControls"
+      data-slice={JSON.stringify(props.slice)}
+      data-is-cached={props.isCached}
+      data-is-expanded={props.isExpanded}
+      data-cached-dttm={props.cachedDttm}
+      data-updated-dttm={props.updatedDttm}
+      data-superset-can-explore={props.supersetCanExplore}
+      data-superset-can-csv={props.supersetCanCSV}
+      data-slice-can-edit={props.sliceCanEdit}
+      data-component-id={props.componentId}
+      data-dashboard-id={props.dashboardId}
+      data-is-full-size={props.isFullSize}
+      data-chart-status={props.chartStatus}
+    >
+      <button
+        type="button"
+        data-test="toggleExpandSlice"
+        onClick={props.toggleExpandSlice}
+      >
+        toggleExpandSlice
+      </button>
+      <button
+        type="button"
+        data-test="forceRefresh"
+        onClick={props.forceRefresh}
+      >
+        forceRefresh
+      </button>
+
+      <button
+        type="button"
+        data-test="exploreChart"
+        onClick={props.exploreChart}
+      >
+        exploreChart
+      </button>
+
+      <button type="button" data-test="exportCSV" onClick={props.exportCSV}>
+        exportCSV
+      </button>
+
+      <button
+        type="button"
+        data-test="handleToggleFullSize"
+        onClick={props.handleToggleFullSize}
+      >
+        handleToggleFullSize
+      </button>
+
+      <button
+        type="button"
+        data-test="addSuccessToast"
+        onClick={props.addSuccessToast}
+      >
+        addSuccessToast
+      </button>
+
+      <button
+        type="button"
+        data-test="addDangerToast"
+        onClick={props.addDangerToast}
+      >
+        addDangerToast
+      </button>
+    </div>
+  ),
+}));
+
+jest.mock('src/dashboard/containers/FiltersBadge', () => ({
+  __esModule: true,
+  default: (props: any) => (
+    <div data-test="FiltersBadge" data-chart-id={props.chartId} />
+  ),
+}));
+
+const createProps = () => ({
+  filters: {}, // is in typing but not being used
+  editMode: false,
+  annotationQuery: { param01: 'annotationQuery' } as any,
+  annotationError: { param01: 'annotationError' } as any,
+  cachedDttm: [] as string[],
+  updatedDttm: 1617207718004,
+  isCached: [false],
+  isExpanded: false,
+  sliceName: 'Vaccine Candidates per Phase',
+  supersetCanExplore: true,
+  supersetCanCSV: true,
+  sliceCanEdit: false,
+  slice: ({
+    slice_id: 312,
+    slice_url: '/superset/explore/?form_data=%7B%22slice_id%22%3A%20312%7D',
+    slice_name: 'Vaccine Candidates per Phase',
+    form_data: {
+      adhoc_filters: [],
+      bottom_margin: 'auto',
+      color_scheme: 'SUPERSET_DEFAULT',
+      columns: [],
+      datasource: '58__table',
+      groupby: ['clinical_stage'],
+      label_colors: {},
+      metrics: ['count'],
+      row_limit: 10000,
+      show_legend: false,
+      time_range: 'No filter',
+      time_range_endpoints: ['inclusive', 'exclusive'],
+      url_params: {},
+      viz_type: 'dist_bar',
+      x_ticks_layout: 'auto',
+      y_axis_format: 'SMART_NUMBER',
+      slice_id: 312,
+    },
+    viz_type: 'dist_bar',
+    datasource: '58__table',
+    description: null,
+    description_markeddown: '',
+    owners: [],
+    modified: '<span class="no-wrap">20 hours ago</span>',
+    changed_on: 1617143411366,
+  } as unknown) as Slice,
+  componentId: 'CHART-aGfmWtliqA',
+  dashboardId: 26,
+  isFullSize: false,
+  chartStatus: 'rendered',
+  addSuccessToast: jest.fn(),
+  addDangerToast: jest.fn(),
+  handleToggleFullSize: jest.fn(),
+  updateSliceName: jest.fn(),
+  toggleExpandSlice: jest.fn(),
+  forceRefresh: jest.fn(),
+  exploreChart: jest.fn(),
+  exportCSV: jest.fn(),
+});
+
+test('Should render', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByTestId('slice-header')).toBeInTheDocument();
+});
+
+test('Should render - default props', () => {
+  const props = createProps();
+
+  // @ts-ignore
+  delete props.forceRefresh;
+  // @ts-ignore
+  delete props.updateSliceName;
+  // @ts-ignore
+  delete props.toggleExpandSlice;
+  // @ts-ignore
+  delete props.exploreChart;
+  // @ts-ignore
+  delete props.exportCSV;
+  // @ts-ignore
+  delete props.innerRef;
+  // @ts-ignore
+  delete props.editMode;
+  // @ts-ignore
+  delete props.annotationQuery;
+  // @ts-ignore
+  delete props.annotationError;
+  // @ts-ignore
+  delete props.cachedDttm;
+  // @ts-ignore
+  delete props.updatedDttm;
+  // @ts-ignore
+  delete props.isCached;
+  // @ts-ignore
+  delete props.isExpanded;
+  // @ts-ignore
+  delete props.sliceName;
+  // @ts-ignore
+  delete props.supersetCanExplore;
+  // @ts-ignore
+  delete props.supersetCanCSV;
+  // @ts-ignore
+  delete props.sliceCanEdit;
+
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByTestId('slice-header')).toBeInTheDocument();
+});
+
+test('Should render default props and "call" actions', () => {
+  const props = createProps();
+
+  // @ts-ignore
+  delete props.forceRefresh;
+  // @ts-ignore
+  delete props.updateSliceName;
+  // @ts-ignore
+  delete props.toggleExpandSlice;
+  // @ts-ignore
+  delete props.exploreChart;
+  // @ts-ignore
+  delete props.exportCSV;
+  // @ts-ignore
+  delete props.innerRef;
+  // @ts-ignore
+  delete props.editMode;
+  // @ts-ignore
+  delete props.annotationQuery;
+  // @ts-ignore
+  delete props.annotationError;
+  // @ts-ignore
+  delete props.cachedDttm;
+  // @ts-ignore
+  delete props.updatedDttm;
+  // @ts-ignore
+  delete props.isCached;
+  // @ts-ignore
+  delete props.isExpanded;
+  // @ts-ignore
+  delete props.sliceName;
+  // @ts-ignore
+  delete props.supersetCanExplore;
+  // @ts-ignore
+  delete props.supersetCanCSV;
+  // @ts-ignore
+  delete props.sliceCanEdit;
+
+  render(<SliceHeader {...props} />, { useRedux: true });
+  userEvent.click(screen.getByTestId('toggleExpandSlice'));
+  userEvent.click(screen.getByTestId('forceRefresh'));
+  userEvent.click(screen.getByTestId('exploreChart'));
+  userEvent.click(screen.getByTestId('exportCSV'));
+  userEvent.click(screen.getByTestId('addSuccessToast'));
+  userEvent.click(screen.getByTestId('addDangerToast'));
+  userEvent.click(screen.getByTestId('handleToggleFullSize'));
+  expect(screen.getByTestId('slice-header')).toBeInTheDocument();
+});
+
+test('Should render title', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByText('Vaccine Candidates per Phase')).toBeInTheDocument();
+});
+
+test('Should render "annoationsLoading"', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(
+    screen.getByRole('img', {
+      name: 'Annotation layers are still loading.',
+    }),
+  ).toBeInTheDocument();
+});
+
+test('Should render "annoationsError"', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(
+    screen.getByRole('img', {
+      name: 'One ore more annotation layers failed loading.',
+    }),
+  ).toBeInTheDocument();
+});
+
+test('Should not render "annoationsError" and "annoationsLoading"', () => {

Review comment:
       ```suggestion
   test('Should not render "annotationsError" and "annotationsLoading"', () => {
   ```

##########
File path: superset-frontend/src/dashboard/components/SliceHeader/SliceHeader.test.tsx
##########
@@ -0,0 +1,399 @@
+/**
+ * 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 { Slice } from 'src/types/Chart';
+import React from 'react';
+import { render, screen } from 'spec/helpers/testing-library';
+import userEvent from '@testing-library/user-event';
+import SliceHeader from '.';
+
+jest.mock('src/dashboard/components/SliceHeaderControls', () => ({
+  __esModule: true,
+  default: (props: any) => (
+    <div
+      data-test="SliceHeaderControls"
+      data-slice={JSON.stringify(props.slice)}
+      data-is-cached={props.isCached}
+      data-is-expanded={props.isExpanded}
+      data-cached-dttm={props.cachedDttm}
+      data-updated-dttm={props.updatedDttm}
+      data-superset-can-explore={props.supersetCanExplore}
+      data-superset-can-csv={props.supersetCanCSV}
+      data-slice-can-edit={props.sliceCanEdit}
+      data-component-id={props.componentId}
+      data-dashboard-id={props.dashboardId}
+      data-is-full-size={props.isFullSize}
+      data-chart-status={props.chartStatus}
+    >
+      <button
+        type="button"
+        data-test="toggleExpandSlice"
+        onClick={props.toggleExpandSlice}
+      >
+        toggleExpandSlice
+      </button>
+      <button
+        type="button"
+        data-test="forceRefresh"
+        onClick={props.forceRefresh}
+      >
+        forceRefresh
+      </button>
+
+      <button
+        type="button"
+        data-test="exploreChart"
+        onClick={props.exploreChart}
+      >
+        exploreChart
+      </button>
+
+      <button type="button" data-test="exportCSV" onClick={props.exportCSV}>
+        exportCSV
+      </button>
+
+      <button
+        type="button"
+        data-test="handleToggleFullSize"
+        onClick={props.handleToggleFullSize}
+      >
+        handleToggleFullSize
+      </button>
+
+      <button
+        type="button"
+        data-test="addSuccessToast"
+        onClick={props.addSuccessToast}
+      >
+        addSuccessToast
+      </button>
+
+      <button
+        type="button"
+        data-test="addDangerToast"
+        onClick={props.addDangerToast}
+      >
+        addDangerToast
+      </button>
+    </div>
+  ),
+}));
+
+jest.mock('src/dashboard/containers/FiltersBadge', () => ({
+  __esModule: true,
+  default: (props: any) => (
+    <div data-test="FiltersBadge" data-chart-id={props.chartId} />
+  ),
+}));
+
+const createProps = () => ({
+  filters: {}, // is in typing but not being used
+  editMode: false,
+  annotationQuery: { param01: 'annotationQuery' } as any,
+  annotationError: { param01: 'annotationError' } as any,
+  cachedDttm: [] as string[],
+  updatedDttm: 1617207718004,
+  isCached: [false],
+  isExpanded: false,
+  sliceName: 'Vaccine Candidates per Phase',
+  supersetCanExplore: true,
+  supersetCanCSV: true,
+  sliceCanEdit: false,
+  slice: ({
+    slice_id: 312,
+    slice_url: '/superset/explore/?form_data=%7B%22slice_id%22%3A%20312%7D',
+    slice_name: 'Vaccine Candidates per Phase',
+    form_data: {
+      adhoc_filters: [],
+      bottom_margin: 'auto',
+      color_scheme: 'SUPERSET_DEFAULT',
+      columns: [],
+      datasource: '58__table',
+      groupby: ['clinical_stage'],
+      label_colors: {},
+      metrics: ['count'],
+      row_limit: 10000,
+      show_legend: false,
+      time_range: 'No filter',
+      time_range_endpoints: ['inclusive', 'exclusive'],
+      url_params: {},
+      viz_type: 'dist_bar',
+      x_ticks_layout: 'auto',
+      y_axis_format: 'SMART_NUMBER',
+      slice_id: 312,
+    },
+    viz_type: 'dist_bar',
+    datasource: '58__table',
+    description: null,
+    description_markeddown: '',
+    owners: [],
+    modified: '<span class="no-wrap">20 hours ago</span>',
+    changed_on: 1617143411366,
+  } as unknown) as Slice,
+  componentId: 'CHART-aGfmWtliqA',
+  dashboardId: 26,
+  isFullSize: false,
+  chartStatus: 'rendered',
+  addSuccessToast: jest.fn(),
+  addDangerToast: jest.fn(),
+  handleToggleFullSize: jest.fn(),
+  updateSliceName: jest.fn(),
+  toggleExpandSlice: jest.fn(),
+  forceRefresh: jest.fn(),
+  exploreChart: jest.fn(),
+  exportCSV: jest.fn(),
+});
+
+test('Should render', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByTestId('slice-header')).toBeInTheDocument();
+});
+
+test('Should render - default props', () => {
+  const props = createProps();
+
+  // @ts-ignore
+  delete props.forceRefresh;
+  // @ts-ignore
+  delete props.updateSliceName;
+  // @ts-ignore
+  delete props.toggleExpandSlice;
+  // @ts-ignore
+  delete props.exploreChart;
+  // @ts-ignore
+  delete props.exportCSV;
+  // @ts-ignore
+  delete props.innerRef;
+  // @ts-ignore
+  delete props.editMode;
+  // @ts-ignore
+  delete props.annotationQuery;
+  // @ts-ignore
+  delete props.annotationError;
+  // @ts-ignore
+  delete props.cachedDttm;
+  // @ts-ignore
+  delete props.updatedDttm;
+  // @ts-ignore
+  delete props.isCached;
+  // @ts-ignore
+  delete props.isExpanded;
+  // @ts-ignore
+  delete props.sliceName;
+  // @ts-ignore
+  delete props.supersetCanExplore;
+  // @ts-ignore
+  delete props.supersetCanCSV;
+  // @ts-ignore
+  delete props.sliceCanEdit;
+
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByTestId('slice-header')).toBeInTheDocument();
+});
+
+test('Should render default props and "call" actions', () => {
+  const props = createProps();
+
+  // @ts-ignore
+  delete props.forceRefresh;
+  // @ts-ignore
+  delete props.updateSliceName;
+  // @ts-ignore
+  delete props.toggleExpandSlice;
+  // @ts-ignore
+  delete props.exploreChart;
+  // @ts-ignore
+  delete props.exportCSV;
+  // @ts-ignore
+  delete props.innerRef;
+  // @ts-ignore
+  delete props.editMode;
+  // @ts-ignore
+  delete props.annotationQuery;
+  // @ts-ignore
+  delete props.annotationError;
+  // @ts-ignore
+  delete props.cachedDttm;
+  // @ts-ignore
+  delete props.updatedDttm;
+  // @ts-ignore
+  delete props.isCached;
+  // @ts-ignore
+  delete props.isExpanded;
+  // @ts-ignore
+  delete props.sliceName;
+  // @ts-ignore
+  delete props.supersetCanExplore;
+  // @ts-ignore
+  delete props.supersetCanCSV;
+  // @ts-ignore
+  delete props.sliceCanEdit;
+
+  render(<SliceHeader {...props} />, { useRedux: true });
+  userEvent.click(screen.getByTestId('toggleExpandSlice'));
+  userEvent.click(screen.getByTestId('forceRefresh'));
+  userEvent.click(screen.getByTestId('exploreChart'));
+  userEvent.click(screen.getByTestId('exportCSV'));
+  userEvent.click(screen.getByTestId('addSuccessToast'));
+  userEvent.click(screen.getByTestId('addDangerToast'));
+  userEvent.click(screen.getByTestId('handleToggleFullSize'));
+  expect(screen.getByTestId('slice-header')).toBeInTheDocument();
+});
+
+test('Should render title', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByText('Vaccine Candidates per Phase')).toBeInTheDocument();
+});
+
+test('Should render "annoationsLoading"', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(
+    screen.getByRole('img', {
+      name: 'Annotation layers are still loading.',
+    }),
+  ).toBeInTheDocument();
+});
+
+test('Should render "annoationsError"', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(
+    screen.getByRole('img', {
+      name: 'One ore more annotation layers failed loading.',
+    }),
+  ).toBeInTheDocument();
+});
+
+test('Should not render "annoationsError" and "annoationsLoading"', () => {
+  const props = createProps();
+  props.annotationQuery = {};
+  props.annotationError = {};
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(
+    screen.queryByRole('img', {
+      name: 'One ore more annotation layers failed loading.',
+    }),
+  ).not.toBeInTheDocument();
+  expect(
+    screen.queryByRole('img', {
+      name: 'Annotation layers are still loading.',
+    }),
+  ).not.toBeInTheDocument();
+});
+
+test('Correct props to "FiltersBadge"', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByTestId('FiltersBadge')).toHaveAttribute(
+    'data-chart-id',
+    '312',
+  );
+});
+
+test('Correct props to "SliceHeaderControls"', () => {

Review comment:
       I think that `SliceHeader` and `SliceHeaderControls` are the same feature, they should be in the same folder. If they are grouped we could have tests that consider this composition and we can discard all this mocking code. This would make the tests more similar to what the user is actually going to experience. Let's make a call so I can explain this a little better.

##########
File path: superset-frontend/src/dashboard/components/SliceHeader/SliceHeader.test.tsx
##########
@@ -0,0 +1,399 @@
+/**
+ * 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 { Slice } from 'src/types/Chart';
+import React from 'react';
+import { render, screen } from 'spec/helpers/testing-library';
+import userEvent from '@testing-library/user-event';
+import SliceHeader from '.';
+
+jest.mock('src/dashboard/components/SliceHeaderControls', () => ({
+  __esModule: true,
+  default: (props: any) => (
+    <div
+      data-test="SliceHeaderControls"
+      data-slice={JSON.stringify(props.slice)}
+      data-is-cached={props.isCached}
+      data-is-expanded={props.isExpanded}
+      data-cached-dttm={props.cachedDttm}
+      data-updated-dttm={props.updatedDttm}
+      data-superset-can-explore={props.supersetCanExplore}
+      data-superset-can-csv={props.supersetCanCSV}
+      data-slice-can-edit={props.sliceCanEdit}
+      data-component-id={props.componentId}
+      data-dashboard-id={props.dashboardId}
+      data-is-full-size={props.isFullSize}
+      data-chart-status={props.chartStatus}
+    >
+      <button
+        type="button"
+        data-test="toggleExpandSlice"
+        onClick={props.toggleExpandSlice}
+      >
+        toggleExpandSlice
+      </button>
+      <button
+        type="button"
+        data-test="forceRefresh"
+        onClick={props.forceRefresh}
+      >
+        forceRefresh
+      </button>
+
+      <button
+        type="button"
+        data-test="exploreChart"
+        onClick={props.exploreChart}
+      >
+        exploreChart
+      </button>
+
+      <button type="button" data-test="exportCSV" onClick={props.exportCSV}>
+        exportCSV
+      </button>
+
+      <button
+        type="button"
+        data-test="handleToggleFullSize"
+        onClick={props.handleToggleFullSize}
+      >
+        handleToggleFullSize
+      </button>
+
+      <button
+        type="button"
+        data-test="addSuccessToast"
+        onClick={props.addSuccessToast}
+      >
+        addSuccessToast
+      </button>
+
+      <button
+        type="button"
+        data-test="addDangerToast"
+        onClick={props.addDangerToast}
+      >
+        addDangerToast
+      </button>
+    </div>
+  ),
+}));
+
+jest.mock('src/dashboard/containers/FiltersBadge', () => ({
+  __esModule: true,
+  default: (props: any) => (
+    <div data-test="FiltersBadge" data-chart-id={props.chartId} />
+  ),
+}));
+
+const createProps = () => ({
+  filters: {}, // is in typing but not being used
+  editMode: false,
+  annotationQuery: { param01: 'annotationQuery' } as any,
+  annotationError: { param01: 'annotationError' } as any,
+  cachedDttm: [] as string[],
+  updatedDttm: 1617207718004,
+  isCached: [false],
+  isExpanded: false,
+  sliceName: 'Vaccine Candidates per Phase',
+  supersetCanExplore: true,
+  supersetCanCSV: true,
+  sliceCanEdit: false,
+  slice: ({
+    slice_id: 312,
+    slice_url: '/superset/explore/?form_data=%7B%22slice_id%22%3A%20312%7D',
+    slice_name: 'Vaccine Candidates per Phase',
+    form_data: {
+      adhoc_filters: [],
+      bottom_margin: 'auto',
+      color_scheme: 'SUPERSET_DEFAULT',
+      columns: [],
+      datasource: '58__table',
+      groupby: ['clinical_stage'],
+      label_colors: {},
+      metrics: ['count'],
+      row_limit: 10000,
+      show_legend: false,
+      time_range: 'No filter',
+      time_range_endpoints: ['inclusive', 'exclusive'],
+      url_params: {},
+      viz_type: 'dist_bar',
+      x_ticks_layout: 'auto',
+      y_axis_format: 'SMART_NUMBER',
+      slice_id: 312,
+    },
+    viz_type: 'dist_bar',
+    datasource: '58__table',
+    description: null,
+    description_markeddown: '',
+    owners: [],
+    modified: '<span class="no-wrap">20 hours ago</span>',
+    changed_on: 1617143411366,
+  } as unknown) as Slice,
+  componentId: 'CHART-aGfmWtliqA',
+  dashboardId: 26,
+  isFullSize: false,
+  chartStatus: 'rendered',
+  addSuccessToast: jest.fn(),
+  addDangerToast: jest.fn(),
+  handleToggleFullSize: jest.fn(),
+  updateSliceName: jest.fn(),
+  toggleExpandSlice: jest.fn(),
+  forceRefresh: jest.fn(),
+  exploreChart: jest.fn(),
+  exportCSV: jest.fn(),
+});
+
+test('Should render', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByTestId('slice-header')).toBeInTheDocument();
+});
+
+test('Should render - default props', () => {
+  const props = createProps();
+
+  // @ts-ignore
+  delete props.forceRefresh;
+  // @ts-ignore
+  delete props.updateSliceName;
+  // @ts-ignore
+  delete props.toggleExpandSlice;
+  // @ts-ignore
+  delete props.exploreChart;
+  // @ts-ignore
+  delete props.exportCSV;
+  // @ts-ignore
+  delete props.innerRef;
+  // @ts-ignore
+  delete props.editMode;
+  // @ts-ignore
+  delete props.annotationQuery;
+  // @ts-ignore
+  delete props.annotationError;
+  // @ts-ignore
+  delete props.cachedDttm;
+  // @ts-ignore
+  delete props.updatedDttm;
+  // @ts-ignore
+  delete props.isCached;
+  // @ts-ignore
+  delete props.isExpanded;
+  // @ts-ignore
+  delete props.sliceName;
+  // @ts-ignore
+  delete props.supersetCanExplore;
+  // @ts-ignore
+  delete props.supersetCanCSV;
+  // @ts-ignore
+  delete props.sliceCanEdit;
+
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByTestId('slice-header')).toBeInTheDocument();
+});
+
+test('Should render default props and "call" actions', () => {
+  const props = createProps();
+
+  // @ts-ignore
+  delete props.forceRefresh;
+  // @ts-ignore
+  delete props.updateSliceName;
+  // @ts-ignore
+  delete props.toggleExpandSlice;
+  // @ts-ignore
+  delete props.exploreChart;
+  // @ts-ignore
+  delete props.exportCSV;
+  // @ts-ignore
+  delete props.innerRef;
+  // @ts-ignore
+  delete props.editMode;
+  // @ts-ignore
+  delete props.annotationQuery;
+  // @ts-ignore
+  delete props.annotationError;
+  // @ts-ignore
+  delete props.cachedDttm;
+  // @ts-ignore
+  delete props.updatedDttm;
+  // @ts-ignore
+  delete props.isCached;
+  // @ts-ignore
+  delete props.isExpanded;
+  // @ts-ignore
+  delete props.sliceName;
+  // @ts-ignore
+  delete props.supersetCanExplore;
+  // @ts-ignore
+  delete props.supersetCanCSV;
+  // @ts-ignore
+  delete props.sliceCanEdit;
+
+  render(<SliceHeader {...props} />, { useRedux: true });
+  userEvent.click(screen.getByTestId('toggleExpandSlice'));
+  userEvent.click(screen.getByTestId('forceRefresh'));
+  userEvent.click(screen.getByTestId('exploreChart'));
+  userEvent.click(screen.getByTestId('exportCSV'));
+  userEvent.click(screen.getByTestId('addSuccessToast'));
+  userEvent.click(screen.getByTestId('addDangerToast'));
+  userEvent.click(screen.getByTestId('handleToggleFullSize'));
+  expect(screen.getByTestId('slice-header')).toBeInTheDocument();
+});
+
+test('Should render title', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByText('Vaccine Candidates per Phase')).toBeInTheDocument();
+});
+
+test('Should render "annoationsLoading"', () => {

Review comment:
       ```suggestion
   test('Should render "annotationsLoading"', () => {
   ```




-- 
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.

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


[GitHub] [superset] codecov[bot] edited a comment on pull request #13888: test: SliceHeader

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #13888:
URL: https://github.com/apache/superset/pull/13888#issuecomment-811393256


   # [Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=h1) Report
   > Merging [#13888](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=desc) (c95e47a) into [master](https://codecov.io/gh/apache/superset/commit/d54cc6d82aa86444dff0eaff072ee9e8e9ea915f?el=desc) (d54cc6d) will **decrease** coverage by `0.04%`.
   > The diff coverage is `42.85%`.
   
   > :exclamation: Current head c95e47a differs from pull request most recent head 5e5b7c7. Consider uploading reports for the commit 5e5b7c7 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/13888/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #13888      +/-   ##
   ==========================================
   - Coverage   77.55%   77.50%   -0.05%     
   ==========================================
     Files         935      936       +1     
     Lines       47301    47358      +57     
     Branches     5907     5936      +29     
   ==========================================
   + Hits        36685    36706      +21     
   - Misses      10472    10508      +36     
     Partials      144      144              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | cypress | `56.02% <ø> (ø)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [...end/src/dashboard/components/SliceHeader/index.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1NsaWNlSGVhZGVyL2luZGV4LnRzeA==) | `41.02% <ø> (ø)` | |
   | [superset/viz.py](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdml6LnB5) | `55.90% <25.00%> (-0.17%)` | :arrow_down: |
   | [superset/examples/big\_data.py](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZXhhbXBsZXMvYmlnX2RhdGEucHk=) | `35.00% <40.00%> (+1.66%)` | :arrow_up: |
   | [superset/tasks/async\_queries.py](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdGFza3MvYXN5bmNfcXVlcmllcy5weQ==) | `91.07% <62.50%> (-4.93%)` | :arrow_down: |
   | [superset/db\_engine\_specs/presto.py](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3ByZXN0by5weQ==) | `88.28% <0.00%> (-0.42%)` | :arrow_down: |
   | [...set-frontend/src/dashboard/util/getDropPosition.js](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2dldERyb3BQb3NpdGlvbi5qcw==) | `92.42% <0.00%> (+1.51%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=footer). Last update [d54cc6d...5e5b7c7](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
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.

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


[GitHub] [superset] codecov[bot] edited a comment on pull request #13888: test: SliceHeader

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #13888:
URL: https://github.com/apache/superset/pull/13888#issuecomment-811393256


   # [Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=h1) Report
   > Merging [#13888](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=desc) (d7e79b6) into [master](https://codecov.io/gh/apache/superset/commit/d54cc6d82aa86444dff0eaff072ee9e8e9ea915f?el=desc) (d54cc6d) will **decrease** coverage by `0.35%`.
   > The diff coverage is `67.56%`.
   
   > :exclamation: Current head d7e79b6 differs from pull request most recent head 6f61a6f. Consider uploading reports for the commit 6f61a6f to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/13888/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #13888      +/-   ##
   ==========================================
   - Coverage   77.55%   77.19%   -0.36%     
   ==========================================
     Files         935      939       +4     
     Lines       47301    47766     +465     
     Branches     5907     6068     +161     
   ==========================================
   + Hits        36685    36874     +189     
   - Misses      10472    10749     +277     
   + Partials      144      143       -1     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | cypress | `56.03% <100.00%> (+<0.01%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [...frontend/src/components/DatabaseSelector/index.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvRGF0YWJhc2VTZWxlY3Rvci9pbmRleC50c3g=) | `92.70% <ø> (+1.04%)` | :arrow_up: |
   | [...et-frontend/src/components/TableSelector/index.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvVGFibGVTZWxlY3Rvci9pbmRleC50c3g=) | `84.92% <ø> (ø)` | |
   | [...end/src/dashboard/components/SliceHeader/index.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1NsaWNlSGVhZGVyL2luZGV4LnRzeA==) | `41.02% <ø> (ø)` | |
   | [...src/dashboard/components/dnd/handleScroll/index.ts](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2RuZC9oYW5kbGVTY3JvbGwvaW5kZXgudHM=) | `73.33% <ø> (ø)` | |
   | [...d/src/explore/components/DatasourcePanel/index.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9EYXRhc291cmNlUGFuZWwvaW5kZXgudHN4) | `87.93% <ø> (ø)` | |
   | [...rc/explore/components/DisplayQueryButton/index.jsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9EaXNwbGF5UXVlcnlCdXR0b24vaW5kZXguanN4) | `100.00% <ø> (ø)` | |
   | [...re/components/controls/DatasourceControl/index.jsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRhc291cmNlQ29udHJvbC9pbmRleC5qc3g=) | `86.84% <ø> (ø)` | |
   | [...controls/DndColumnSelectControl/DndSelectLabel.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EbmRDb2x1bW5TZWxlY3RDb250cm9sL0RuZFNlbGVjdExhYmVsLnRzeA==) | `35.00% <ø> (ø)` | |
   | [...trols/DndColumnSelectControl/components/Option.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EbmRDb2x1bW5TZWxlY3RDb250cm9sL2NvbXBvbmVudHMvT3B0aW9uLnRzeA==) | `50.00% <ø> (ø)` | |
   | [...ents/controls/FilterControl/AdhocFilterControl.jsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9GaWx0ZXJDb250cm9sL0FkaG9jRmlsdGVyQ29udHJvbC5qc3g=) | `60.00% <ø> (ø)` | |
   | ... and [39 more](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=footer). Last update [d54cc6d...6f61a6f](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
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.

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


[GitHub] [superset] codecov[bot] edited a comment on pull request #13888: test: SliceHeader

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #13888:
URL: https://github.com/apache/superset/pull/13888#issuecomment-811393256


   # [Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=h1) Report
   > Merging [#13888](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=desc) (3b2868a) into [master](https://codecov.io/gh/apache/superset/commit/d54cc6d82aa86444dff0eaff072ee9e8e9ea915f?el=desc) (d54cc6d) will **decrease** coverage by `0.03%`.
   > The diff coverage is `50.00%`.
   
   > :exclamation: Current head 3b2868a differs from pull request most recent head 5e5b7c7. Consider uploading reports for the commit 5e5b7c7 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/13888/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #13888      +/-   ##
   ==========================================
   - Coverage   77.55%   77.52%   -0.04%     
   ==========================================
     Files         935      936       +1     
     Lines       47301    47340      +39     
     Branches     5907     5936      +29     
   ==========================================
   + Hits        36685    36701      +16     
   - Misses      10472    10495      +23     
     Partials      144      144              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | cypress | `56.02% <ø> (-0.01%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [...end/src/dashboard/components/SliceHeader/index.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1NsaWNlSGVhZGVyL2luZGV4LnRzeA==) | `41.02% <ø> (ø)` | |
   | [superset/viz.py](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdml6LnB5) | `56.07% <50.00%> (ø)` | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=footer). Last update [d54cc6d...5e5b7c7](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
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.

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


[GitHub] [superset] codecov[bot] edited a comment on pull request #13888: test: SliceHeader

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #13888:
URL: https://github.com/apache/superset/pull/13888#issuecomment-811393256


   # [Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=h1) Report
   > Merging [#13888](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=desc) (3b2868a) into [master](https://codecov.io/gh/apache/superset/commit/d54cc6d82aa86444dff0eaff072ee9e8e9ea915f?el=desc) (d54cc6d) will **decrease** coverage by `0.03%`.
   > The diff coverage is `50.00%`.
   
   > :exclamation: Current head 3b2868a differs from pull request most recent head 5e5b7c7. Consider uploading reports for the commit 5e5b7c7 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/13888/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #13888      +/-   ##
   ==========================================
   - Coverage   77.55%   77.52%   -0.04%     
   ==========================================
     Files         935      936       +1     
     Lines       47301    47340      +39     
     Branches     5907     5936      +29     
   ==========================================
   + Hits        36685    36701      +16     
   - Misses      10472    10495      +23     
     Partials      144      144              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | cypress | `56.02% <ø> (-0.01%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [...end/src/dashboard/components/SliceHeader/index.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1NsaWNlSGVhZGVyL2luZGV4LnRzeA==) | `41.02% <ø> (ø)` | |
   | [superset/viz.py](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdml6LnB5) | `56.07% <50.00%> (ø)` | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=footer). Last update [d54cc6d...5e5b7c7](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
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.

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


[GitHub] [superset] yardz commented on a change in pull request #13888: test: SliceHeader

Posted by GitBox <gi...@apache.org>.
yardz commented on a change in pull request #13888:
URL: https://github.com/apache/superset/pull/13888#discussion_r608689315



##########
File path: superset-frontend/src/dashboard/components/SliceHeader/SliceHeader.test.tsx
##########
@@ -0,0 +1,399 @@
+/**
+ * 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 { Slice } from 'src/types/Chart';
+import React from 'react';
+import { render, screen } from 'spec/helpers/testing-library';
+import userEvent from '@testing-library/user-event';
+import SliceHeader from '.';
+
+jest.mock('src/dashboard/components/SliceHeaderControls', () => ({
+  __esModule: true,
+  default: (props: any) => (
+    <div
+      data-test="SliceHeaderControls"
+      data-slice={JSON.stringify(props.slice)}
+      data-is-cached={props.isCached}
+      data-is-expanded={props.isExpanded}
+      data-cached-dttm={props.cachedDttm}
+      data-updated-dttm={props.updatedDttm}
+      data-superset-can-explore={props.supersetCanExplore}
+      data-superset-can-csv={props.supersetCanCSV}
+      data-slice-can-edit={props.sliceCanEdit}
+      data-component-id={props.componentId}
+      data-dashboard-id={props.dashboardId}
+      data-is-full-size={props.isFullSize}
+      data-chart-status={props.chartStatus}
+    >
+      <button
+        type="button"
+        data-test="toggleExpandSlice"
+        onClick={props.toggleExpandSlice}
+      >
+        toggleExpandSlice
+      </button>
+      <button
+        type="button"
+        data-test="forceRefresh"
+        onClick={props.forceRefresh}
+      >
+        forceRefresh
+      </button>
+
+      <button
+        type="button"
+        data-test="exploreChart"
+        onClick={props.exploreChart}
+      >
+        exploreChart
+      </button>
+
+      <button type="button" data-test="exportCSV" onClick={props.exportCSV}>
+        exportCSV
+      </button>
+
+      <button
+        type="button"
+        data-test="handleToggleFullSize"
+        onClick={props.handleToggleFullSize}
+      >
+        handleToggleFullSize
+      </button>
+
+      <button
+        type="button"
+        data-test="addSuccessToast"
+        onClick={props.addSuccessToast}
+      >
+        addSuccessToast
+      </button>
+
+      <button
+        type="button"
+        data-test="addDangerToast"
+        onClick={props.addDangerToast}
+      >
+        addDangerToast
+      </button>
+    </div>
+  ),
+}));
+
+jest.mock('src/dashboard/containers/FiltersBadge', () => ({
+  __esModule: true,
+  default: (props: any) => (
+    <div data-test="FiltersBadge" data-chart-id={props.chartId} />
+  ),
+}));
+
+const createProps = () => ({
+  filters: {}, // is in typing but not being used
+  editMode: false,
+  annotationQuery: { param01: 'annotationQuery' } as any,
+  annotationError: { param01: 'annotationError' } as any,
+  cachedDttm: [] as string[],
+  updatedDttm: 1617207718004,
+  isCached: [false],
+  isExpanded: false,
+  sliceName: 'Vaccine Candidates per Phase',
+  supersetCanExplore: true,
+  supersetCanCSV: true,
+  sliceCanEdit: false,
+  slice: ({
+    slice_id: 312,
+    slice_url: '/superset/explore/?form_data=%7B%22slice_id%22%3A%20312%7D',
+    slice_name: 'Vaccine Candidates per Phase',
+    form_data: {
+      adhoc_filters: [],
+      bottom_margin: 'auto',
+      color_scheme: 'SUPERSET_DEFAULT',
+      columns: [],
+      datasource: '58__table',
+      groupby: ['clinical_stage'],
+      label_colors: {},
+      metrics: ['count'],
+      row_limit: 10000,
+      show_legend: false,
+      time_range: 'No filter',
+      time_range_endpoints: ['inclusive', 'exclusive'],
+      url_params: {},
+      viz_type: 'dist_bar',
+      x_ticks_layout: 'auto',
+      y_axis_format: 'SMART_NUMBER',
+      slice_id: 312,
+    },
+    viz_type: 'dist_bar',
+    datasource: '58__table',
+    description: null,
+    description_markeddown: '',
+    owners: [],
+    modified: '<span class="no-wrap">20 hours ago</span>',
+    changed_on: 1617143411366,
+  } as unknown) as Slice,
+  componentId: 'CHART-aGfmWtliqA',
+  dashboardId: 26,
+  isFullSize: false,
+  chartStatus: 'rendered',
+  addSuccessToast: jest.fn(),
+  addDangerToast: jest.fn(),
+  handleToggleFullSize: jest.fn(),
+  updateSliceName: jest.fn(),
+  toggleExpandSlice: jest.fn(),
+  forceRefresh: jest.fn(),
+  exploreChart: jest.fn(),
+  exportCSV: jest.fn(),
+});
+
+test('Should render', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByTestId('slice-header')).toBeInTheDocument();
+});
+
+test('Should render - default props', () => {
+  const props = createProps();
+
+  // @ts-ignore
+  delete props.forceRefresh;
+  // @ts-ignore
+  delete props.updateSliceName;
+  // @ts-ignore
+  delete props.toggleExpandSlice;
+  // @ts-ignore
+  delete props.exploreChart;
+  // @ts-ignore
+  delete props.exportCSV;
+  // @ts-ignore
+  delete props.innerRef;
+  // @ts-ignore
+  delete props.editMode;
+  // @ts-ignore
+  delete props.annotationQuery;
+  // @ts-ignore
+  delete props.annotationError;
+  // @ts-ignore
+  delete props.cachedDttm;
+  // @ts-ignore
+  delete props.updatedDttm;
+  // @ts-ignore
+  delete props.isCached;
+  // @ts-ignore
+  delete props.isExpanded;
+  // @ts-ignore
+  delete props.sliceName;
+  // @ts-ignore
+  delete props.supersetCanExplore;
+  // @ts-ignore
+  delete props.supersetCanCSV;
+  // @ts-ignore
+  delete props.sliceCanEdit;
+
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByTestId('slice-header')).toBeInTheDocument();
+});
+
+test('Should render default props and "call" actions', () => {
+  const props = createProps();
+
+  // @ts-ignore
+  delete props.forceRefresh;
+  // @ts-ignore
+  delete props.updateSliceName;
+  // @ts-ignore
+  delete props.toggleExpandSlice;
+  // @ts-ignore
+  delete props.exploreChart;
+  // @ts-ignore
+  delete props.exportCSV;
+  // @ts-ignore
+  delete props.innerRef;
+  // @ts-ignore
+  delete props.editMode;
+  // @ts-ignore
+  delete props.annotationQuery;
+  // @ts-ignore
+  delete props.annotationError;
+  // @ts-ignore
+  delete props.cachedDttm;
+  // @ts-ignore
+  delete props.updatedDttm;
+  // @ts-ignore
+  delete props.isCached;
+  // @ts-ignore
+  delete props.isExpanded;
+  // @ts-ignore
+  delete props.sliceName;
+  // @ts-ignore
+  delete props.supersetCanExplore;
+  // @ts-ignore
+  delete props.supersetCanCSV;
+  // @ts-ignore
+  delete props.sliceCanEdit;
+
+  render(<SliceHeader {...props} />, { useRedux: true });
+  userEvent.click(screen.getByTestId('toggleExpandSlice'));
+  userEvent.click(screen.getByTestId('forceRefresh'));
+  userEvent.click(screen.getByTestId('exploreChart'));
+  userEvent.click(screen.getByTestId('exportCSV'));
+  userEvent.click(screen.getByTestId('addSuccessToast'));
+  userEvent.click(screen.getByTestId('addDangerToast'));
+  userEvent.click(screen.getByTestId('handleToggleFullSize'));
+  expect(screen.getByTestId('slice-header')).toBeInTheDocument();
+});
+
+test('Should render title', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByText('Vaccine Candidates per Phase')).toBeInTheDocument();
+});
+
+test('Should render "annoationsLoading"', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(
+    screen.getByRole('img', {
+      name: 'Annotation layers are still loading.',
+    }),
+  ).toBeInTheDocument();
+});
+
+test('Should render "annoationsError"', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(
+    screen.getByRole('img', {
+      name: 'One ore more annotation layers failed loading.',
+    }),
+  ).toBeInTheDocument();
+});
+
+test('Should not render "annoationsError" and "annoationsLoading"', () => {
+  const props = createProps();
+  props.annotationQuery = {};
+  props.annotationError = {};
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(
+    screen.queryByRole('img', {
+      name: 'One ore more annotation layers failed loading.',
+    }),
+  ).not.toBeInTheDocument();
+  expect(
+    screen.queryByRole('img', {
+      name: 'Annotation layers are still loading.',
+    }),
+  ).not.toBeInTheDocument();
+});
+
+test('Correct props to "FiltersBadge"', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByTestId('FiltersBadge')).toHaveAttribute(
+    'data-chart-id',
+    '312',
+  );
+});
+
+test('Correct props to "SliceHeaderControls"', () => {

Review comment:
       @rusackas I had already talked to @michael-s-molina but forgot to put the answer here. hahaha
   
   I agree with him that they should be in the same folder. But as I am opening up component by component I would not be able to do this in a single PR.
   
   And the IAPA had also not been approved. I think these two components should be put together when we are rearranging the files.




-- 
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.

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


[GitHub] [superset] codecov[bot] edited a comment on pull request #13888: test: SliceHeader

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #13888:
URL: https://github.com/apache/superset/pull/13888#issuecomment-811393256


   # [Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=h1) Report
   > Merging [#13888](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=desc) (c95e47a) into [master](https://codecov.io/gh/apache/superset/commit/d54cc6d82aa86444dff0eaff072ee9e8e9ea915f?el=desc) (d54cc6d) will **increase** coverage by `0.01%`.
   > The diff coverage is `53.84%`.
   
   > :exclamation: Current head c95e47a differs from pull request most recent head 6f61a6f. Consider uploading reports for the commit 6f61a6f to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/13888/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #13888      +/-   ##
   ==========================================
   + Coverage   77.55%   77.57%   +0.01%     
   ==========================================
     Files         935      935              
     Lines       47301    47319      +18     
     Branches     5907     5906       -1     
   ==========================================
   + Hits        36685    36707      +22     
   - Misses      10472    10473       +1     
   + Partials      144      139       -5     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | cypress | `56.02% <ø> (ø)` | |
   | javascript | `63.80% <100.00%> (+0.07%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [superset/viz.py](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdml6LnB5) | `55.90% <25.00%> (-0.17%)` | :arrow_down: |
   | [superset/examples/big\_data.py](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZXhhbXBsZXMvYmlnX2RhdGEucHk=) | `35.00% <40.00%> (+1.66%)` | :arrow_up: |
   | [superset/tasks/async\_queries.py](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdGFza3MvYXN5bmNfcXVlcmllcy5weQ==) | `91.07% <62.50%> (-4.93%)` | :arrow_down: |
   | [...end/src/dashboard/components/SliceHeader/index.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1NsaWNlSGVhZGVyL2luZGV4LnRzeA==) | `92.00% <100.00%> (ø)` | |
   | [superset/db\_engine\_specs/presto.py](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3ByZXN0by5weQ==) | `88.28% <0.00%> (-0.42%)` | :arrow_down: |
   | [...set-frontend/src/dashboard/util/getDropPosition.js](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2dldERyb3BQb3NpdGlvbi5qcw==) | `92.42% <0.00%> (+1.51%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=footer). Last update [d54cc6d...6f61a6f](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
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.

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


[GitHub] [superset] rusackas commented on a change in pull request #13888: test: SliceHeader

Posted by GitBox <gi...@apache.org>.
rusackas commented on a change in pull request #13888:
URL: https://github.com/apache/superset/pull/13888#discussion_r606427022



##########
File path: superset-frontend/src/dashboard/components/SliceHeader/SliceHeader.test.tsx
##########
@@ -0,0 +1,399 @@
+/**
+ * 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 { Slice } from 'src/types/Chart';
+import React from 'react';
+import { render, screen } from 'spec/helpers/testing-library';
+import userEvent from '@testing-library/user-event';
+import SliceHeader from '.';
+
+jest.mock('src/dashboard/components/SliceHeaderControls', () => ({
+  __esModule: true,
+  default: (props: any) => (
+    <div
+      data-test="SliceHeaderControls"
+      data-slice={JSON.stringify(props.slice)}
+      data-is-cached={props.isCached}
+      data-is-expanded={props.isExpanded}
+      data-cached-dttm={props.cachedDttm}
+      data-updated-dttm={props.updatedDttm}
+      data-superset-can-explore={props.supersetCanExplore}
+      data-superset-can-csv={props.supersetCanCSV}
+      data-slice-can-edit={props.sliceCanEdit}
+      data-component-id={props.componentId}
+      data-dashboard-id={props.dashboardId}
+      data-is-full-size={props.isFullSize}
+      data-chart-status={props.chartStatus}
+    >
+      <button
+        type="button"
+        data-test="toggleExpandSlice"
+        onClick={props.toggleExpandSlice}
+      >
+        toggleExpandSlice
+      </button>
+      <button
+        type="button"
+        data-test="forceRefresh"
+        onClick={props.forceRefresh}
+      >
+        forceRefresh
+      </button>
+
+      <button
+        type="button"
+        data-test="exploreChart"
+        onClick={props.exploreChart}
+      >
+        exploreChart
+      </button>
+
+      <button type="button" data-test="exportCSV" onClick={props.exportCSV}>
+        exportCSV
+      </button>
+
+      <button
+        type="button"
+        data-test="handleToggleFullSize"
+        onClick={props.handleToggleFullSize}
+      >
+        handleToggleFullSize
+      </button>
+
+      <button
+        type="button"
+        data-test="addSuccessToast"
+        onClick={props.addSuccessToast}
+      >
+        addSuccessToast
+      </button>
+
+      <button
+        type="button"
+        data-test="addDangerToast"
+        onClick={props.addDangerToast}
+      >
+        addDangerToast
+      </button>
+    </div>
+  ),
+}));
+
+jest.mock('src/dashboard/containers/FiltersBadge', () => ({
+  __esModule: true,
+  default: (props: any) => (
+    <div data-test="FiltersBadge" data-chart-id={props.chartId} />
+  ),
+}));
+
+const createProps = () => ({
+  filters: {}, // is in typing but not being used
+  editMode: false,
+  annotationQuery: { param01: 'annotationQuery' } as any,
+  annotationError: { param01: 'annotationError' } as any,
+  cachedDttm: [] as string[],
+  updatedDttm: 1617207718004,
+  isCached: [false],
+  isExpanded: false,
+  sliceName: 'Vaccine Candidates per Phase',
+  supersetCanExplore: true,
+  supersetCanCSV: true,
+  sliceCanEdit: false,
+  slice: ({
+    slice_id: 312,
+    slice_url: '/superset/explore/?form_data=%7B%22slice_id%22%3A%20312%7D',
+    slice_name: 'Vaccine Candidates per Phase',
+    form_data: {
+      adhoc_filters: [],
+      bottom_margin: 'auto',
+      color_scheme: 'SUPERSET_DEFAULT',
+      columns: [],
+      datasource: '58__table',
+      groupby: ['clinical_stage'],
+      label_colors: {},
+      metrics: ['count'],
+      row_limit: 10000,
+      show_legend: false,
+      time_range: 'No filter',
+      time_range_endpoints: ['inclusive', 'exclusive'],
+      url_params: {},
+      viz_type: 'dist_bar',
+      x_ticks_layout: 'auto',
+      y_axis_format: 'SMART_NUMBER',
+      slice_id: 312,
+    },
+    viz_type: 'dist_bar',
+    datasource: '58__table',
+    description: null,
+    description_markeddown: '',
+    owners: [],
+    modified: '<span class="no-wrap">20 hours ago</span>',
+    changed_on: 1617143411366,
+  } as unknown) as Slice,
+  componentId: 'CHART-aGfmWtliqA',
+  dashboardId: 26,
+  isFullSize: false,
+  chartStatus: 'rendered',
+  addSuccessToast: jest.fn(),
+  addDangerToast: jest.fn(),
+  handleToggleFullSize: jest.fn(),
+  updateSliceName: jest.fn(),
+  toggleExpandSlice: jest.fn(),
+  forceRefresh: jest.fn(),
+  exploreChart: jest.fn(),
+  exportCSV: jest.fn(),
+});
+
+test('Should render', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByTestId('slice-header')).toBeInTheDocument();
+});
+
+test('Should render - default props', () => {
+  const props = createProps();
+
+  // @ts-ignore
+  delete props.forceRefresh;
+  // @ts-ignore
+  delete props.updateSliceName;
+  // @ts-ignore
+  delete props.toggleExpandSlice;
+  // @ts-ignore
+  delete props.exploreChart;
+  // @ts-ignore
+  delete props.exportCSV;
+  // @ts-ignore
+  delete props.innerRef;
+  // @ts-ignore
+  delete props.editMode;
+  // @ts-ignore
+  delete props.annotationQuery;
+  // @ts-ignore
+  delete props.annotationError;
+  // @ts-ignore
+  delete props.cachedDttm;
+  // @ts-ignore
+  delete props.updatedDttm;
+  // @ts-ignore
+  delete props.isCached;
+  // @ts-ignore
+  delete props.isExpanded;
+  // @ts-ignore
+  delete props.sliceName;
+  // @ts-ignore
+  delete props.supersetCanExplore;
+  // @ts-ignore
+  delete props.supersetCanCSV;
+  // @ts-ignore
+  delete props.sliceCanEdit;
+
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByTestId('slice-header')).toBeInTheDocument();
+});
+
+test('Should render default props and "call" actions', () => {
+  const props = createProps();
+
+  // @ts-ignore
+  delete props.forceRefresh;
+  // @ts-ignore
+  delete props.updateSliceName;
+  // @ts-ignore
+  delete props.toggleExpandSlice;
+  // @ts-ignore
+  delete props.exploreChart;
+  // @ts-ignore
+  delete props.exportCSV;
+  // @ts-ignore
+  delete props.innerRef;
+  // @ts-ignore
+  delete props.editMode;
+  // @ts-ignore
+  delete props.annotationQuery;
+  // @ts-ignore
+  delete props.annotationError;
+  // @ts-ignore
+  delete props.cachedDttm;
+  // @ts-ignore
+  delete props.updatedDttm;
+  // @ts-ignore
+  delete props.isCached;
+  // @ts-ignore
+  delete props.isExpanded;
+  // @ts-ignore
+  delete props.sliceName;
+  // @ts-ignore
+  delete props.supersetCanExplore;
+  // @ts-ignore
+  delete props.supersetCanCSV;
+  // @ts-ignore
+  delete props.sliceCanEdit;

Review comment:
       Same question here.... just like `SliceHeaderControls` but I'm not sure the purpose.




-- 
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.

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


[GitHub] [superset] yardz closed pull request #13888: test: SliceHeader

Posted by GitBox <gi...@apache.org>.
yardz closed pull request #13888:
URL: https://github.com/apache/superset/pull/13888


   


-- 
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.

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


[GitHub] [superset] codecov[bot] commented on pull request #13888: test: SliceHeader

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on pull request #13888:
URL: https://github.com/apache/superset/pull/13888#issuecomment-811393256


   # [Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=h1) Report
   > Merging [#13888](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=desc) (3b2868a) into [master](https://codecov.io/gh/apache/superset/commit/d54cc6d82aa86444dff0eaff072ee9e8e9ea915f?el=desc) (d54cc6d) will **decrease** coverage by `1.27%`.
   > The diff coverage is `50.00%`.
   
   > :exclamation: Current head 3b2868a differs from pull request most recent head 5e5b7c7. Consider uploading reports for the commit 5e5b7c7 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/13888/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #13888      +/-   ##
   ==========================================
   - Coverage   77.55%   76.28%   -1.28%     
   ==========================================
     Files         935      936       +1     
     Lines       47301    47340      +39     
     Branches     5907     5936      +29     
   ==========================================
   - Hits        36685    36111     -574     
   - Misses      10472    11068     +596     
   - Partials      144      161      +17     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | cypress | `49.83% <ø> (-6.20%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [...end/src/dashboard/components/SliceHeader/index.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1NsaWNlSGVhZGVyL2luZGV4LnRzeA==) | `41.02% <ø> (ø)` | |
   | [superset/viz.py](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdml6LnB5) | `56.07% <50.00%> (ø)` | |
   | [...nd/src/dashboard/util/getFilterValuesByFilterId.js](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2dldEZpbHRlclZhbHVlc0J5RmlsdGVySWQuanM=) | `25.00% <0.00%> (-50.00%)` | :arrow_down: |
   | [...rc/explore/components/controls/AnnotationLayer.jsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9Bbm5vdGF0aW9uTGF5ZXIuanN4) | `2.38% <0.00%> (-49.53%)` | :arrow_down: |
   | [...erset-frontend/src/common/hooks/useUrlShortener.ts](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbW1vbi9ob29rcy91c2VVcmxTaG9ydGVuZXIudHM=) | `50.00% <0.00%> (-42.86%)` | :arrow_down: |
   | [...teFilterControl/components/DateFunctionTooltip.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC9jb21wb25lbnRzL0RhdGVGdW5jdGlvblRvb2x0aXAudHN4) | `58.33% <0.00%> (-41.67%)` | :arrow_down: |
   | [...trols/DateFilterControl/components/CommonFrame.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC9jb21wb25lbnRzL0NvbW1vbkZyYW1lLnRzeA==) | `41.66% <0.00%> (-41.67%)` | :arrow_down: |
   | [...ore/components/controls/AnnotationLayerControl.jsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9Bbm5vdGF0aW9uTGF5ZXJDb250cm9sLmpzeA==) | `42.85% <0.00%> (-40.00%)` | :arrow_down: |
   | [...ols/DateFilterControl/components/CalendarFrame.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC9jb21wb25lbnRzL0NhbGVuZGFyRnJhbWUudHN4) | `46.15% <0.00%> (-38.47%)` | :arrow_down: |
   | [...nents/controls/MetricControl/AdhocMetricOption.jsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9NZXRyaWNDb250cm9sL0FkaG9jTWV0cmljT3B0aW9uLmpzeA==) | `72.72% <0.00%> (-27.28%)` | :arrow_down: |
   | ... and [59 more](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=footer). Last update [d54cc6d...5e5b7c7](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
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.

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


[GitHub] [superset] yardz commented on a change in pull request #13888: test: SliceHeader

Posted by GitBox <gi...@apache.org>.
yardz commented on a change in pull request #13888:
URL: https://github.com/apache/superset/pull/13888#discussion_r608689315



##########
File path: superset-frontend/src/dashboard/components/SliceHeader/SliceHeader.test.tsx
##########
@@ -0,0 +1,399 @@
+/**
+ * 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 { Slice } from 'src/types/Chart';
+import React from 'react';
+import { render, screen } from 'spec/helpers/testing-library';
+import userEvent from '@testing-library/user-event';
+import SliceHeader from '.';
+
+jest.mock('src/dashboard/components/SliceHeaderControls', () => ({
+  __esModule: true,
+  default: (props: any) => (
+    <div
+      data-test="SliceHeaderControls"
+      data-slice={JSON.stringify(props.slice)}
+      data-is-cached={props.isCached}
+      data-is-expanded={props.isExpanded}
+      data-cached-dttm={props.cachedDttm}
+      data-updated-dttm={props.updatedDttm}
+      data-superset-can-explore={props.supersetCanExplore}
+      data-superset-can-csv={props.supersetCanCSV}
+      data-slice-can-edit={props.sliceCanEdit}
+      data-component-id={props.componentId}
+      data-dashboard-id={props.dashboardId}
+      data-is-full-size={props.isFullSize}
+      data-chart-status={props.chartStatus}
+    >
+      <button
+        type="button"
+        data-test="toggleExpandSlice"
+        onClick={props.toggleExpandSlice}
+      >
+        toggleExpandSlice
+      </button>
+      <button
+        type="button"
+        data-test="forceRefresh"
+        onClick={props.forceRefresh}
+      >
+        forceRefresh
+      </button>
+
+      <button
+        type="button"
+        data-test="exploreChart"
+        onClick={props.exploreChart}
+      >
+        exploreChart
+      </button>
+
+      <button type="button" data-test="exportCSV" onClick={props.exportCSV}>
+        exportCSV
+      </button>
+
+      <button
+        type="button"
+        data-test="handleToggleFullSize"
+        onClick={props.handleToggleFullSize}
+      >
+        handleToggleFullSize
+      </button>
+
+      <button
+        type="button"
+        data-test="addSuccessToast"
+        onClick={props.addSuccessToast}
+      >
+        addSuccessToast
+      </button>
+
+      <button
+        type="button"
+        data-test="addDangerToast"
+        onClick={props.addDangerToast}
+      >
+        addDangerToast
+      </button>
+    </div>
+  ),
+}));
+
+jest.mock('src/dashboard/containers/FiltersBadge', () => ({
+  __esModule: true,
+  default: (props: any) => (
+    <div data-test="FiltersBadge" data-chart-id={props.chartId} />
+  ),
+}));
+
+const createProps = () => ({
+  filters: {}, // is in typing but not being used
+  editMode: false,
+  annotationQuery: { param01: 'annotationQuery' } as any,
+  annotationError: { param01: 'annotationError' } as any,
+  cachedDttm: [] as string[],
+  updatedDttm: 1617207718004,
+  isCached: [false],
+  isExpanded: false,
+  sliceName: 'Vaccine Candidates per Phase',
+  supersetCanExplore: true,
+  supersetCanCSV: true,
+  sliceCanEdit: false,
+  slice: ({
+    slice_id: 312,
+    slice_url: '/superset/explore/?form_data=%7B%22slice_id%22%3A%20312%7D',
+    slice_name: 'Vaccine Candidates per Phase',
+    form_data: {
+      adhoc_filters: [],
+      bottom_margin: 'auto',
+      color_scheme: 'SUPERSET_DEFAULT',
+      columns: [],
+      datasource: '58__table',
+      groupby: ['clinical_stage'],
+      label_colors: {},
+      metrics: ['count'],
+      row_limit: 10000,
+      show_legend: false,
+      time_range: 'No filter',
+      time_range_endpoints: ['inclusive', 'exclusive'],
+      url_params: {},
+      viz_type: 'dist_bar',
+      x_ticks_layout: 'auto',
+      y_axis_format: 'SMART_NUMBER',
+      slice_id: 312,
+    },
+    viz_type: 'dist_bar',
+    datasource: '58__table',
+    description: null,
+    description_markeddown: '',
+    owners: [],
+    modified: '<span class="no-wrap">20 hours ago</span>',
+    changed_on: 1617143411366,
+  } as unknown) as Slice,
+  componentId: 'CHART-aGfmWtliqA',
+  dashboardId: 26,
+  isFullSize: false,
+  chartStatus: 'rendered',
+  addSuccessToast: jest.fn(),
+  addDangerToast: jest.fn(),
+  handleToggleFullSize: jest.fn(),
+  updateSliceName: jest.fn(),
+  toggleExpandSlice: jest.fn(),
+  forceRefresh: jest.fn(),
+  exploreChart: jest.fn(),
+  exportCSV: jest.fn(),
+});
+
+test('Should render', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByTestId('slice-header')).toBeInTheDocument();
+});
+
+test('Should render - default props', () => {
+  const props = createProps();
+
+  // @ts-ignore
+  delete props.forceRefresh;
+  // @ts-ignore
+  delete props.updateSliceName;
+  // @ts-ignore
+  delete props.toggleExpandSlice;
+  // @ts-ignore
+  delete props.exploreChart;
+  // @ts-ignore
+  delete props.exportCSV;
+  // @ts-ignore
+  delete props.innerRef;
+  // @ts-ignore
+  delete props.editMode;
+  // @ts-ignore
+  delete props.annotationQuery;
+  // @ts-ignore
+  delete props.annotationError;
+  // @ts-ignore
+  delete props.cachedDttm;
+  // @ts-ignore
+  delete props.updatedDttm;
+  // @ts-ignore
+  delete props.isCached;
+  // @ts-ignore
+  delete props.isExpanded;
+  // @ts-ignore
+  delete props.sliceName;
+  // @ts-ignore
+  delete props.supersetCanExplore;
+  // @ts-ignore
+  delete props.supersetCanCSV;
+  // @ts-ignore
+  delete props.sliceCanEdit;
+
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByTestId('slice-header')).toBeInTheDocument();
+});
+
+test('Should render default props and "call" actions', () => {
+  const props = createProps();
+
+  // @ts-ignore
+  delete props.forceRefresh;
+  // @ts-ignore
+  delete props.updateSliceName;
+  // @ts-ignore
+  delete props.toggleExpandSlice;
+  // @ts-ignore
+  delete props.exploreChart;
+  // @ts-ignore
+  delete props.exportCSV;
+  // @ts-ignore
+  delete props.innerRef;
+  // @ts-ignore
+  delete props.editMode;
+  // @ts-ignore
+  delete props.annotationQuery;
+  // @ts-ignore
+  delete props.annotationError;
+  // @ts-ignore
+  delete props.cachedDttm;
+  // @ts-ignore
+  delete props.updatedDttm;
+  // @ts-ignore
+  delete props.isCached;
+  // @ts-ignore
+  delete props.isExpanded;
+  // @ts-ignore
+  delete props.sliceName;
+  // @ts-ignore
+  delete props.supersetCanExplore;
+  // @ts-ignore
+  delete props.supersetCanCSV;
+  // @ts-ignore
+  delete props.sliceCanEdit;
+
+  render(<SliceHeader {...props} />, { useRedux: true });
+  userEvent.click(screen.getByTestId('toggleExpandSlice'));
+  userEvent.click(screen.getByTestId('forceRefresh'));
+  userEvent.click(screen.getByTestId('exploreChart'));
+  userEvent.click(screen.getByTestId('exportCSV'));
+  userEvent.click(screen.getByTestId('addSuccessToast'));
+  userEvent.click(screen.getByTestId('addDangerToast'));
+  userEvent.click(screen.getByTestId('handleToggleFullSize'));
+  expect(screen.getByTestId('slice-header')).toBeInTheDocument();
+});
+
+test('Should render title', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByText('Vaccine Candidates per Phase')).toBeInTheDocument();
+});
+
+test('Should render "annoationsLoading"', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(
+    screen.getByRole('img', {
+      name: 'Annotation layers are still loading.',
+    }),
+  ).toBeInTheDocument();
+});
+
+test('Should render "annoationsError"', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(
+    screen.getByRole('img', {
+      name: 'One ore more annotation layers failed loading.',
+    }),
+  ).toBeInTheDocument();
+});
+
+test('Should not render "annoationsError" and "annoationsLoading"', () => {
+  const props = createProps();
+  props.annotationQuery = {};
+  props.annotationError = {};
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(
+    screen.queryByRole('img', {
+      name: 'One ore more annotation layers failed loading.',
+    }),
+  ).not.toBeInTheDocument();
+  expect(
+    screen.queryByRole('img', {
+      name: 'Annotation layers are still loading.',
+    }),
+  ).not.toBeInTheDocument();
+});
+
+test('Correct props to "FiltersBadge"', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByTestId('FiltersBadge')).toHaveAttribute(
+    'data-chart-id',
+    '312',
+  );
+});
+
+test('Correct props to "SliceHeaderControls"', () => {

Review comment:
       @rusackas I had already talked to @michael-s-molina but forgot to put the answer here. hahaha
   
   I agree with him that they should be in the same folder. But as I am opening up component by component I would not be able to do this in a single PR.
   
   And the SIP had also not been approved. I think these two components should be put together when we are rearranging the files.




-- 
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.

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


[GitHub] [superset] codecov[bot] edited a comment on pull request #13888: test: SliceHeader

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #13888:
URL: https://github.com/apache/superset/pull/13888#issuecomment-811393256


   # [Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=h1) Report
   > Merging [#13888](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=desc) (c95e47a) into [master](https://codecov.io/gh/apache/superset/commit/d54cc6d82aa86444dff0eaff072ee9e8e9ea915f?el=desc) (d54cc6d) will **increase** coverage by `0.01%`.
   > The diff coverage is `53.84%`.
   
   > :exclamation: Current head c95e47a differs from pull request most recent head 1607e0f. Consider uploading reports for the commit 1607e0f to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/13888/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #13888      +/-   ##
   ==========================================
   + Coverage   77.55%   77.57%   +0.01%     
   ==========================================
     Files         935      935              
     Lines       47301    47319      +18     
     Branches     5907     5906       -1     
   ==========================================
   + Hits        36685    36707      +22     
   - Misses      10472    10473       +1     
   + Partials      144      139       -5     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | cypress | `56.02% <ø> (ø)` | |
   | javascript | `63.80% <100.00%> (+0.07%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [superset/viz.py](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdml6LnB5) | `55.90% <25.00%> (-0.17%)` | :arrow_down: |
   | [superset/examples/big\_data.py](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZXhhbXBsZXMvYmlnX2RhdGEucHk=) | `35.00% <40.00%> (+1.66%)` | :arrow_up: |
   | [superset/tasks/async\_queries.py](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdGFza3MvYXN5bmNfcXVlcmllcy5weQ==) | `91.07% <62.50%> (-4.93%)` | :arrow_down: |
   | [...end/src/dashboard/components/SliceHeader/index.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1NsaWNlSGVhZGVyL2luZGV4LnRzeA==) | `92.00% <100.00%> (ø)` | |
   | [superset/db\_engine\_specs/presto.py](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3ByZXN0by5weQ==) | `88.28% <0.00%> (-0.42%)` | :arrow_down: |
   | [...set-frontend/src/dashboard/util/getDropPosition.js](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2dldERyb3BQb3NpdGlvbi5qcw==) | `92.42% <0.00%> (+1.51%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=footer). Last update [d54cc6d...1607e0f](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
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.

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


[GitHub] [superset] codecov[bot] edited a comment on pull request #13888: test: SliceHeader

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #13888:
URL: https://github.com/apache/superset/pull/13888#issuecomment-811393256


   # [Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=h1) Report
   > Merging [#13888](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=desc) (d7e79b6) into [master](https://codecov.io/gh/apache/superset/commit/d54cc6d82aa86444dff0eaff072ee9e8e9ea915f?el=desc) (d54cc6d) will **decrease** coverage by `0.29%`.
   > The diff coverage is `71.42%`.
   
   > :exclamation: Current head d7e79b6 differs from pull request most recent head 6f61a6f. Consider uploading reports for the commit 6f61a6f to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/13888/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #13888      +/-   ##
   ==========================================
   - Coverage   77.55%   77.26%   -0.30%     
   ==========================================
     Files         935      938       +3     
     Lines       47301    47727     +426     
     Branches     5907     6048     +141     
   ==========================================
   + Hits        36685    36875     +190     
   - Misses      10472    10714     +242     
   + Partials      144      138       -6     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | cypress | `56.03% <100.00%> (+<0.01%)` | :arrow_up: |
   | javascript | `64.70% <85.71%> (+0.98%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [...frontend/src/components/DatabaseSelector/index.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvRGF0YWJhc2VTZWxlY3Rvci9pbmRleC50c3g=) | `92.70% <ø> (+1.04%)` | :arrow_up: |
   | [...et-frontend/src/components/TableSelector/index.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvVGFibGVTZWxlY3Rvci9pbmRleC50c3g=) | `84.92% <ø> (ø)` | |
   | [...src/dashboard/components/dnd/handleScroll/index.ts](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2RuZC9oYW5kbGVTY3JvbGwvaW5kZXgudHM=) | `73.33% <ø> (ø)` | |
   | [...d/src/explore/components/DatasourcePanel/index.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9EYXRhc291cmNlUGFuZWwvaW5kZXgudHN4) | `87.93% <ø> (ø)` | |
   | [...rc/explore/components/DisplayQueryButton/index.jsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9EaXNwbGF5UXVlcnlCdXR0b24vaW5kZXguanN4) | `100.00% <ø> (ø)` | |
   | [...re/components/controls/DatasourceControl/index.jsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRhc291cmNlQ29udHJvbC9pbmRleC5qc3g=) | `86.84% <ø> (ø)` | |
   | [...controls/DndColumnSelectControl/DndSelectLabel.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EbmRDb2x1bW5TZWxlY3RDb250cm9sL0RuZFNlbGVjdExhYmVsLnRzeA==) | `35.00% <ø> (ø)` | |
   | [...trols/DndColumnSelectControl/components/Option.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EbmRDb2x1bW5TZWxlY3RDb250cm9sL2NvbXBvbmVudHMvT3B0aW9uLnRzeA==) | `50.00% <ø> (ø)` | |
   | [...ents/controls/FilterControl/AdhocFilterControl.jsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9GaWx0ZXJDb250cm9sL0FkaG9jRmlsdGVyQ29udHJvbC5qc3g=) | `60.00% <ø> (ø)` | |
   | [...Control/AdhocFilterEditPopoverSimpleTabContent.jsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9GaWx0ZXJDb250cm9sL0FkaG9jRmlsdGVyRWRpdFBvcG92ZXJTaW1wbGVUYWJDb250ZW50LmpzeA==) | `74.83% <ø> (ø)` | |
   | ... and [39 more](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=footer). Last update [d54cc6d...6f61a6f](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
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.

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


[GitHub] [superset] yardz commented on a change in pull request #13888: test: SliceHeader

Posted by GitBox <gi...@apache.org>.
yardz commented on a change in pull request #13888:
URL: https://github.com/apache/superset/pull/13888#discussion_r608690492



##########
File path: superset-frontend/src/dashboard/components/SliceHeader/SliceHeader.test.tsx
##########
@@ -0,0 +1,399 @@
+/**
+ * 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 { Slice } from 'src/types/Chart';
+import React from 'react';
+import { render, screen } from 'spec/helpers/testing-library';
+import userEvent from '@testing-library/user-event';
+import SliceHeader from '.';
+
+jest.mock('src/dashboard/components/SliceHeaderControls', () => ({
+  __esModule: true,
+  default: (props: any) => (
+    <div
+      data-test="SliceHeaderControls"
+      data-slice={JSON.stringify(props.slice)}
+      data-is-cached={props.isCached}
+      data-is-expanded={props.isExpanded}
+      data-cached-dttm={props.cachedDttm}
+      data-updated-dttm={props.updatedDttm}
+      data-superset-can-explore={props.supersetCanExplore}
+      data-superset-can-csv={props.supersetCanCSV}
+      data-slice-can-edit={props.sliceCanEdit}
+      data-component-id={props.componentId}
+      data-dashboard-id={props.dashboardId}
+      data-is-full-size={props.isFullSize}
+      data-chart-status={props.chartStatus}
+    >
+      <button
+        type="button"
+        data-test="toggleExpandSlice"
+        onClick={props.toggleExpandSlice}
+      >
+        toggleExpandSlice
+      </button>
+      <button
+        type="button"
+        data-test="forceRefresh"
+        onClick={props.forceRefresh}
+      >
+        forceRefresh
+      </button>
+
+      <button
+        type="button"
+        data-test="exploreChart"
+        onClick={props.exploreChart}
+      >
+        exploreChart
+      </button>
+
+      <button type="button" data-test="exportCSV" onClick={props.exportCSV}>
+        exportCSV
+      </button>
+
+      <button
+        type="button"
+        data-test="handleToggleFullSize"
+        onClick={props.handleToggleFullSize}
+      >
+        handleToggleFullSize
+      </button>
+
+      <button
+        type="button"
+        data-test="addSuccessToast"
+        onClick={props.addSuccessToast}
+      >
+        addSuccessToast
+      </button>
+
+      <button
+        type="button"
+        data-test="addDangerToast"
+        onClick={props.addDangerToast}
+      >
+        addDangerToast
+      </button>
+    </div>
+  ),
+}));
+
+jest.mock('src/dashboard/containers/FiltersBadge', () => ({
+  __esModule: true,
+  default: (props: any) => (
+    <div data-test="FiltersBadge" data-chart-id={props.chartId} />
+  ),
+}));
+
+const createProps = () => ({
+  filters: {}, // is in typing but not being used
+  editMode: false,
+  annotationQuery: { param01: 'annotationQuery' } as any,
+  annotationError: { param01: 'annotationError' } as any,
+  cachedDttm: [] as string[],
+  updatedDttm: 1617207718004,
+  isCached: [false],
+  isExpanded: false,
+  sliceName: 'Vaccine Candidates per Phase',
+  supersetCanExplore: true,
+  supersetCanCSV: true,
+  sliceCanEdit: false,
+  slice: ({
+    slice_id: 312,
+    slice_url: '/superset/explore/?form_data=%7B%22slice_id%22%3A%20312%7D',
+    slice_name: 'Vaccine Candidates per Phase',
+    form_data: {
+      adhoc_filters: [],
+      bottom_margin: 'auto',
+      color_scheme: 'SUPERSET_DEFAULT',
+      columns: [],
+      datasource: '58__table',
+      groupby: ['clinical_stage'],
+      label_colors: {},
+      metrics: ['count'],
+      row_limit: 10000,
+      show_legend: false,
+      time_range: 'No filter',
+      time_range_endpoints: ['inclusive', 'exclusive'],
+      url_params: {},
+      viz_type: 'dist_bar',
+      x_ticks_layout: 'auto',
+      y_axis_format: 'SMART_NUMBER',
+      slice_id: 312,
+    },
+    viz_type: 'dist_bar',
+    datasource: '58__table',
+    description: null,
+    description_markeddown: '',
+    owners: [],
+    modified: '<span class="no-wrap">20 hours ago</span>',
+    changed_on: 1617143411366,
+  } as unknown) as Slice,
+  componentId: 'CHART-aGfmWtliqA',
+  dashboardId: 26,
+  isFullSize: false,
+  chartStatus: 'rendered',
+  addSuccessToast: jest.fn(),
+  addDangerToast: jest.fn(),
+  handleToggleFullSize: jest.fn(),
+  updateSliceName: jest.fn(),
+  toggleExpandSlice: jest.fn(),
+  forceRefresh: jest.fn(),
+  exploreChart: jest.fn(),
+  exportCSV: jest.fn(),
+});
+
+test('Should render', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByTestId('slice-header')).toBeInTheDocument();
+});
+
+test('Should render - default props', () => {
+  const props = createProps();
+
+  // @ts-ignore
+  delete props.forceRefresh;
+  // @ts-ignore
+  delete props.updateSliceName;
+  // @ts-ignore
+  delete props.toggleExpandSlice;
+  // @ts-ignore
+  delete props.exploreChart;
+  // @ts-ignore
+  delete props.exportCSV;
+  // @ts-ignore
+  delete props.innerRef;
+  // @ts-ignore
+  delete props.editMode;
+  // @ts-ignore
+  delete props.annotationQuery;
+  // @ts-ignore
+  delete props.annotationError;
+  // @ts-ignore
+  delete props.cachedDttm;
+  // @ts-ignore
+  delete props.updatedDttm;
+  // @ts-ignore
+  delete props.isCached;
+  // @ts-ignore
+  delete props.isExpanded;
+  // @ts-ignore
+  delete props.sliceName;
+  // @ts-ignore
+  delete props.supersetCanExplore;
+  // @ts-ignore
+  delete props.supersetCanCSV;
+  // @ts-ignore
+  delete props.sliceCanEdit;
+
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByTestId('slice-header')).toBeInTheDocument();
+});
+
+test('Should render default props and "call" actions', () => {
+  const props = createProps();
+
+  // @ts-ignore
+  delete props.forceRefresh;
+  // @ts-ignore
+  delete props.updateSliceName;
+  // @ts-ignore
+  delete props.toggleExpandSlice;
+  // @ts-ignore
+  delete props.exploreChart;
+  // @ts-ignore
+  delete props.exportCSV;
+  // @ts-ignore
+  delete props.innerRef;
+  // @ts-ignore
+  delete props.editMode;
+  // @ts-ignore
+  delete props.annotationQuery;
+  // @ts-ignore
+  delete props.annotationError;
+  // @ts-ignore
+  delete props.cachedDttm;
+  // @ts-ignore
+  delete props.updatedDttm;
+  // @ts-ignore
+  delete props.isCached;
+  // @ts-ignore
+  delete props.isExpanded;
+  // @ts-ignore
+  delete props.sliceName;
+  // @ts-ignore
+  delete props.supersetCanExplore;
+  // @ts-ignore
+  delete props.supersetCanCSV;
+  // @ts-ignore
+  delete props.sliceCanEdit;

Review comment:
       Same reasons. The default props have several things, including some optional ones.
   In this case I remove everything that is optional to test that the component does not break.




-- 
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.

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


[GitHub] [superset] codecov[bot] edited a comment on pull request #13888: test: SliceHeader

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #13888:
URL: https://github.com/apache/superset/pull/13888#issuecomment-811393256


   # [Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=h1) Report
   > Merging [#13888](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=desc) (c95e47a) into [master](https://codecov.io/gh/apache/superset/commit/d54cc6d82aa86444dff0eaff072ee9e8e9ea915f?el=desc) (d54cc6d) will **increase** coverage by `0.01%`.
   > The diff coverage is `53.84%`.
   
   > :exclamation: Current head c95e47a differs from pull request most recent head 5e5b7c7. Consider uploading reports for the commit 5e5b7c7 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/13888/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #13888      +/-   ##
   ==========================================
   + Coverage   77.55%   77.57%   +0.01%     
   ==========================================
     Files         935      935              
     Lines       47301    47319      +18     
     Branches     5907     5906       -1     
   ==========================================
   + Hits        36685    36707      +22     
   - Misses      10472    10473       +1     
   + Partials      144      139       -5     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | cypress | `56.02% <ø> (ø)` | |
   | javascript | `63.80% <100.00%> (+0.07%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [superset/viz.py](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdml6LnB5) | `55.90% <25.00%> (-0.17%)` | :arrow_down: |
   | [superset/examples/big\_data.py](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZXhhbXBsZXMvYmlnX2RhdGEucHk=) | `35.00% <40.00%> (+1.66%)` | :arrow_up: |
   | [superset/tasks/async\_queries.py](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdGFza3MvYXN5bmNfcXVlcmllcy5weQ==) | `91.07% <62.50%> (-4.93%)` | :arrow_down: |
   | [...end/src/dashboard/components/SliceHeader/index.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1NsaWNlSGVhZGVyL2luZGV4LnRzeA==) | `92.00% <100.00%> (ø)` | |
   | [superset/db\_engine\_specs/presto.py](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3ByZXN0by5weQ==) | `88.28% <0.00%> (-0.42%)` | :arrow_down: |
   | [...set-frontend/src/dashboard/util/getDropPosition.js](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2dldERyb3BQb3NpdGlvbi5qcw==) | `92.42% <0.00%> (+1.51%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=footer). Last update [d54cc6d...5e5b7c7](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
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.

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


[GitHub] [superset] codecov[bot] edited a comment on pull request #13888: test: SliceHeader

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #13888:
URL: https://github.com/apache/superset/pull/13888#issuecomment-811393256


   # [Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=h1) Report
   > Merging [#13888](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=desc) (c95e47a) into [master](https://codecov.io/gh/apache/superset/commit/d54cc6d82aa86444dff0eaff072ee9e8e9ea915f?el=desc) (d54cc6d) will **decrease** coverage by `1.02%`.
   > The diff coverage is `42.85%`.
   
   > :exclamation: Current head c95e47a differs from pull request most recent head 5e5b7c7. Consider uploading reports for the commit 5e5b7c7 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/13888/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #13888      +/-   ##
   ==========================================
   - Coverage   77.55%   76.53%   -1.03%     
   ==========================================
     Files         935      936       +1     
     Lines       47301    47358      +57     
     Branches     5907     5936      +29     
   ==========================================
   - Hits        36685    36246     -439     
   - Misses      10472    10936     +464     
   - Partials      144      176      +32     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | cypress | `50.93% <ø> (-5.10%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [...end/src/dashboard/components/SliceHeader/index.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1NsaWNlSGVhZGVyL2luZGV4LnRzeA==) | `41.02% <ø> (ø)` | |
   | [superset/viz.py](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdml6LnB5) | `55.90% <25.00%> (-0.17%)` | :arrow_down: |
   | [superset/examples/big\_data.py](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZXhhbXBsZXMvYmlnX2RhdGEucHk=) | `35.00% <40.00%> (+1.66%)` | :arrow_up: |
   | [superset/tasks/async\_queries.py](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdGFza3MvYXN5bmNfcXVlcmllcy5weQ==) | `91.07% <62.50%> (-4.93%)` | :arrow_down: |
   | [...t-frontend/src/dashboard/containers/SliceAdder.jsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb250YWluZXJzL1NsaWNlQWRkZXIuanN4) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...tend/src/visualizations/FilterBox/controlPanel.jsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3Zpc3VhbGl6YXRpb25zL0ZpbHRlckJveC9jb250cm9sUGFuZWwuanN4) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...rontend/src/dashboard/components/dnd/handleDrop.js](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2RuZC9oYW5kbGVEcm9wLmpz) | `0.00% <0.00%> (-96.16%)` | :arrow_down: |
   | [...ontend/src/dashboard/components/dnd/handleHover.js](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2RuZC9oYW5kbGVIb3Zlci5qcw==) | `11.11% <0.00%> (-88.89%)` | :arrow_down: |
   | [...rc/dashboard/components/dnd/dragDroppableConfig.js](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2RuZC9kcmFnRHJvcHBhYmxlQ29uZmlnLmpz) | `35.00% <0.00%> (-65.00%)` | :arrow_down: |
   | [...c/dashboard/components/dnd/AddSliceDragPreview.jsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2RuZC9BZGRTbGljZURyYWdQcmV2aWV3LmpzeA==) | `35.71% <0.00%> (-64.29%)` | :arrow_down: |
   | ... and [41 more](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=footer). Last update [d54cc6d...5e5b7c7](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
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.

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


[GitHub] [superset] rusackas commented on a change in pull request #13888: test: SliceHeader

Posted by GitBox <gi...@apache.org>.
rusackas commented on a change in pull request #13888:
URL: https://github.com/apache/superset/pull/13888#discussion_r608332843



##########
File path: superset-frontend/src/dashboard/components/SliceHeader/SliceHeader.test.tsx
##########
@@ -0,0 +1,399 @@
+/**
+ * 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 { Slice } from 'src/types/Chart';
+import React from 'react';
+import { render, screen } from 'spec/helpers/testing-library';
+import userEvent from '@testing-library/user-event';
+import SliceHeader from '.';
+
+jest.mock('src/dashboard/components/SliceHeaderControls', () => ({
+  __esModule: true,
+  default: (props: any) => (
+    <div
+      data-test="SliceHeaderControls"
+      data-slice={JSON.stringify(props.slice)}
+      data-is-cached={props.isCached}
+      data-is-expanded={props.isExpanded}
+      data-cached-dttm={props.cachedDttm}
+      data-updated-dttm={props.updatedDttm}
+      data-superset-can-explore={props.supersetCanExplore}
+      data-superset-can-csv={props.supersetCanCSV}
+      data-slice-can-edit={props.sliceCanEdit}
+      data-component-id={props.componentId}
+      data-dashboard-id={props.dashboardId}
+      data-is-full-size={props.isFullSize}
+      data-chart-status={props.chartStatus}
+    >
+      <button
+        type="button"
+        data-test="toggleExpandSlice"
+        onClick={props.toggleExpandSlice}
+      >
+        toggleExpandSlice
+      </button>
+      <button
+        type="button"
+        data-test="forceRefresh"
+        onClick={props.forceRefresh}
+      >
+        forceRefresh
+      </button>
+
+      <button
+        type="button"
+        data-test="exploreChart"
+        onClick={props.exploreChart}
+      >
+        exploreChart
+      </button>
+
+      <button type="button" data-test="exportCSV" onClick={props.exportCSV}>
+        exportCSV
+      </button>
+
+      <button
+        type="button"
+        data-test="handleToggleFullSize"
+        onClick={props.handleToggleFullSize}
+      >
+        handleToggleFullSize
+      </button>
+
+      <button
+        type="button"
+        data-test="addSuccessToast"
+        onClick={props.addSuccessToast}
+      >
+        addSuccessToast
+      </button>
+
+      <button
+        type="button"
+        data-test="addDangerToast"
+        onClick={props.addDangerToast}
+      >
+        addDangerToast
+      </button>
+    </div>
+  ),
+}));
+
+jest.mock('src/dashboard/containers/FiltersBadge', () => ({
+  __esModule: true,
+  default: (props: any) => (
+    <div data-test="FiltersBadge" data-chart-id={props.chartId} />
+  ),
+}));
+
+const createProps = () => ({
+  filters: {}, // is in typing but not being used
+  editMode: false,
+  annotationQuery: { param01: 'annotationQuery' } as any,
+  annotationError: { param01: 'annotationError' } as any,
+  cachedDttm: [] as string[],
+  updatedDttm: 1617207718004,
+  isCached: [false],
+  isExpanded: false,
+  sliceName: 'Vaccine Candidates per Phase',
+  supersetCanExplore: true,
+  supersetCanCSV: true,
+  sliceCanEdit: false,
+  slice: ({
+    slice_id: 312,
+    slice_url: '/superset/explore/?form_data=%7B%22slice_id%22%3A%20312%7D',
+    slice_name: 'Vaccine Candidates per Phase',
+    form_data: {
+      adhoc_filters: [],
+      bottom_margin: 'auto',
+      color_scheme: 'SUPERSET_DEFAULT',
+      columns: [],
+      datasource: '58__table',
+      groupby: ['clinical_stage'],
+      label_colors: {},
+      metrics: ['count'],
+      row_limit: 10000,
+      show_legend: false,
+      time_range: 'No filter',
+      time_range_endpoints: ['inclusive', 'exclusive'],
+      url_params: {},
+      viz_type: 'dist_bar',
+      x_ticks_layout: 'auto',
+      y_axis_format: 'SMART_NUMBER',
+      slice_id: 312,
+    },
+    viz_type: 'dist_bar',
+    datasource: '58__table',
+    description: null,
+    description_markeddown: '',
+    owners: [],
+    modified: '<span class="no-wrap">20 hours ago</span>',
+    changed_on: 1617143411366,
+  } as unknown) as Slice,
+  componentId: 'CHART-aGfmWtliqA',
+  dashboardId: 26,
+  isFullSize: false,
+  chartStatus: 'rendered',
+  addSuccessToast: jest.fn(),
+  addDangerToast: jest.fn(),
+  handleToggleFullSize: jest.fn(),
+  updateSliceName: jest.fn(),
+  toggleExpandSlice: jest.fn(),
+  forceRefresh: jest.fn(),
+  exploreChart: jest.fn(),
+  exportCSV: jest.fn(),
+});
+
+test('Should render', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByTestId('slice-header')).toBeInTheDocument();
+});
+
+test('Should render - default props', () => {
+  const props = createProps();
+
+  // @ts-ignore
+  delete props.forceRefresh;
+  // @ts-ignore
+  delete props.updateSliceName;
+  // @ts-ignore
+  delete props.toggleExpandSlice;
+  // @ts-ignore
+  delete props.exploreChart;
+  // @ts-ignore
+  delete props.exportCSV;
+  // @ts-ignore
+  delete props.innerRef;
+  // @ts-ignore
+  delete props.editMode;
+  // @ts-ignore
+  delete props.annotationQuery;
+  // @ts-ignore
+  delete props.annotationError;
+  // @ts-ignore
+  delete props.cachedDttm;
+  // @ts-ignore
+  delete props.updatedDttm;
+  // @ts-ignore
+  delete props.isCached;
+  // @ts-ignore
+  delete props.isExpanded;
+  // @ts-ignore
+  delete props.sliceName;
+  // @ts-ignore
+  delete props.supersetCanExplore;
+  // @ts-ignore
+  delete props.supersetCanCSV;
+  // @ts-ignore
+  delete props.sliceCanEdit;
+
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByTestId('slice-header')).toBeInTheDocument();
+});
+
+test('Should render default props and "call" actions', () => {
+  const props = createProps();
+
+  // @ts-ignore
+  delete props.forceRefresh;
+  // @ts-ignore
+  delete props.updateSliceName;
+  // @ts-ignore
+  delete props.toggleExpandSlice;
+  // @ts-ignore
+  delete props.exploreChart;
+  // @ts-ignore
+  delete props.exportCSV;
+  // @ts-ignore
+  delete props.innerRef;
+  // @ts-ignore
+  delete props.editMode;
+  // @ts-ignore
+  delete props.annotationQuery;
+  // @ts-ignore
+  delete props.annotationError;
+  // @ts-ignore
+  delete props.cachedDttm;
+  // @ts-ignore
+  delete props.updatedDttm;
+  // @ts-ignore
+  delete props.isCached;
+  // @ts-ignore
+  delete props.isExpanded;
+  // @ts-ignore
+  delete props.sliceName;
+  // @ts-ignore
+  delete props.supersetCanExplore;
+  // @ts-ignore
+  delete props.supersetCanCSV;
+  // @ts-ignore
+  delete props.sliceCanEdit;
+
+  render(<SliceHeader {...props} />, { useRedux: true });
+  userEvent.click(screen.getByTestId('toggleExpandSlice'));
+  userEvent.click(screen.getByTestId('forceRefresh'));
+  userEvent.click(screen.getByTestId('exploreChart'));
+  userEvent.click(screen.getByTestId('exportCSV'));
+  userEvent.click(screen.getByTestId('addSuccessToast'));
+  userEvent.click(screen.getByTestId('addDangerToast'));
+  userEvent.click(screen.getByTestId('handleToggleFullSize'));
+  expect(screen.getByTestId('slice-header')).toBeInTheDocument();
+});
+
+test('Should render title', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByText('Vaccine Candidates per Phase')).toBeInTheDocument();
+});
+
+test('Should render "annoationsLoading"', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(
+    screen.getByRole('img', {
+      name: 'Annotation layers are still loading.',
+    }),
+  ).toBeInTheDocument();
+});
+
+test('Should render "annoationsError"', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(
+    screen.getByRole('img', {
+      name: 'One ore more annotation layers failed loading.',
+    }),
+  ).toBeInTheDocument();
+});
+
+test('Should not render "annoationsError" and "annoationsLoading"', () => {
+  const props = createProps();
+  props.annotationQuery = {};
+  props.annotationError = {};
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(
+    screen.queryByRole('img', {
+      name: 'One ore more annotation layers failed loading.',
+    }),
+  ).not.toBeInTheDocument();
+  expect(
+    screen.queryByRole('img', {
+      name: 'Annotation layers are still loading.',
+    }),
+  ).not.toBeInTheDocument();
+});
+
+test('Correct props to "FiltersBadge"', () => {
+  const props = createProps();
+  render(<SliceHeader {...props} />, { useRedux: true });
+  expect(screen.getByTestId('FiltersBadge')).toHaveAttribute(
+    'data-chart-id',
+    '312',
+  );
+});
+
+test('Correct props to "SliceHeaderControls"', () => {

Review comment:
       @yardz did you intend to make any changes to this PR based on this discussion?




-- 
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.

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


[GitHub] [superset] rusackas merged pull request #13888: test: SliceHeader

Posted by GitBox <gi...@apache.org>.
rusackas merged pull request #13888:
URL: https://github.com/apache/superset/pull/13888


   


-- 
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.

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


[GitHub] [superset] codecov[bot] edited a comment on pull request #13888: test: SliceHeader

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #13888:
URL: https://github.com/apache/superset/pull/13888#issuecomment-811393256


   # [Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=h1) Report
   > Merging [#13888](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=desc) (d7e79b6) into [master](https://codecov.io/gh/apache/superset/commit/d54cc6d82aa86444dff0eaff072ee9e8e9ea915f?el=desc) (d54cc6d) will **decrease** coverage by `1.34%`.
   > The diff coverage is `67.56%`.
   
   > :exclamation: Current head d7e79b6 differs from pull request most recent head 6f61a6f. Consider uploading reports for the commit 6f61a6f to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/13888/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #13888      +/-   ##
   ==========================================
   - Coverage   77.55%   76.21%   -1.35%     
   ==========================================
     Files         935      939       +4     
     Lines       47301    47765     +464     
     Branches     5907     6068     +161     
   ==========================================
   - Hits        36685    36402     -283     
   - Misses      10472    11206     +734     
   - Partials      144      157      +13     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | cypress | `50.07% <100.00%> (-5.96%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [...frontend/src/components/DatabaseSelector/index.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvRGF0YWJhc2VTZWxlY3Rvci9pbmRleC50c3g=) | `92.70% <ø> (+1.04%)` | :arrow_up: |
   | [...et-frontend/src/components/TableSelector/index.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvVGFibGVTZWxlY3Rvci9pbmRleC50c3g=) | `84.92% <ø> (ø)` | |
   | [...end/src/dashboard/components/SliceHeader/index.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1NsaWNlSGVhZGVyL2luZGV4LnRzeA==) | `41.02% <ø> (ø)` | |
   | [...src/dashboard/components/dnd/handleScroll/index.ts](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2RuZC9oYW5kbGVTY3JvbGwvaW5kZXgudHM=) | `73.33% <ø> (ø)` | |
   | [...d/src/explore/components/DatasourcePanel/index.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9EYXRhc291cmNlUGFuZWwvaW5kZXgudHN4) | `87.93% <ø> (ø)` | |
   | [...rc/explore/components/DisplayQueryButton/index.jsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9EaXNwbGF5UXVlcnlCdXR0b24vaW5kZXguanN4) | `100.00% <ø> (ø)` | |
   | [...re/components/controls/DatasourceControl/index.jsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRhc291cmNlQ29udHJvbC9pbmRleC5qc3g=) | `86.84% <ø> (ø)` | |
   | [...controls/DndColumnSelectControl/DndSelectLabel.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EbmRDb2x1bW5TZWxlY3RDb250cm9sL0RuZFNlbGVjdExhYmVsLnRzeA==) | `35.00% <ø> (ø)` | |
   | [...trols/DndColumnSelectControl/components/Option.tsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EbmRDb2x1bW5TZWxlY3RDb250cm9sL2NvbXBvbmVudHMvT3B0aW9uLnRzeA==) | `50.00% <ø> (ø)` | |
   | [...ents/controls/FilterControl/AdhocFilterControl.jsx](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9GaWx0ZXJDb250cm9sL0FkaG9jRmlsdGVyQ29udHJvbC5qc3g=) | `60.00% <ø> (ø)` | |
   | ... and [106 more](https://codecov.io/gh/apache/superset/pull/13888/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=footer). Last update [d54cc6d...6f61a6f](https://codecov.io/gh/apache/superset/pull/13888?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
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.

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