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/02/11 12:05:27 UTC

[GitHub] [superset] villebro commented on a change in pull request #12918: feat(style): hide dashboard header by url parameter

villebro commented on a change in pull request #12918:
URL: https://github.com/apache/superset/pull/12918#discussion_r574448146



##########
File path: superset-frontend/spec/javascripts/explore/utils_spec.jsx
##########
@@ -32,6 +32,7 @@ import {
 } from 'src/explore/dateFilterUtils';
 import * as hostNamesConfig from 'src/utils/hostNamesConfig';
 import { getChartMetadataRegistry } from '@superset-ui/core';
+import { DashboardStandaloneMode } from '../../../src/dashboard/util/constants';

Review comment:
       ```suggestion
   import { DashboardStandaloneMode } from 'src/dashboard/util/constants';
   ```

##########
File path: superset-frontend/spec/javascripts/dashboard/util/getDashboardUrl_spec.js
##########
@@ -18,28 +18,51 @@
  */
 import getDashboardUrl from 'src/dashboard/util/getDashboardUrl';
 import { DASHBOARD_FILTER_SCOPE_GLOBAL } from 'src/dashboard/reducers/dashboardFilters';
+import { DashboardStandaloneMode } from '../../../../src/dashboard/util/constants';
 
 describe('getChartIdsFromLayout', () => {
+  const filters = {
+    '35_key': {
+      values: ['value'],
+      scope: DASHBOARD_FILTER_SCOPE_GLOBAL,
+    },
+  };
+
+  const globalLocation = window.location;
+  afterEach(() => {
+    window.location = globalLocation;
+  });
+
   it('should encode filters', () => {
-    const filters = {
-      '35_key': {
-        values: ['value'],
-        scope: DASHBOARD_FILTER_SCOPE_GLOBAL,
-      },
-    };
     const url = getDashboardUrl('path', filters);
     expect(url).toBe(
       'path?preselect_filters=%7B%2235%22%3A%7B%22key%22%3A%5B%22value%22%5D%7D%7D',
     );
+  });
 
+  it('should encode filters with hash', () => {
     const urlWithHash = getDashboardUrl('path', filters, 'iamhashtag');
     expect(urlWithHash).toBe(
       'path?preselect_filters=%7B%2235%22%3A%7B%22key%22%3A%5B%22value%22%5D%7D%7D#iamhashtag',
     );
+  });
 
-    const urlWithStandalone = getDashboardUrl('path', filters, '', true);
+  it('should encode filters with standalone', () => {
+    const urlWithStandalone = getDashboardUrl(
+      'path',
+      filters,
+      '',
+      DashboardStandaloneMode.HIDE_NAV,
+    );
     expect(urlWithStandalone).toBe(
-      'path?preselect_filters=%7B%2235%22%3A%7B%22key%22%3A%5B%22value%22%5D%7D%7D&standalone=true',
+      `path?preselect_filters=%7B%2235%22%3A%7B%22key%22%3A%5B%22value%22%5D%7D%7D&standalone=${DashboardStandaloneMode.HIDE_NAV}`,
+    );
+  });
+
+  it('should encode filters with missed standalone', () => {

Review comment:
       ```suggestion
     it('should encode filters with missing standalone', () => {
   ```

##########
File path: superset-frontend/spec/javascripts/explore/components/EmbedCodeButton_spec.jsx
##########
@@ -26,7 +26,8 @@ import configureStore from 'redux-mock-store';
 import fetchMock from 'fetch-mock';
 import EmbedCodeButton from 'src/explore/components/EmbedCodeButton';
 import * as exploreUtils from 'src/explore/exploreUtils';
-import * as common from 'src/utils/common';
+import * as urlUtils from 'src/utils/urlUtils';
+import { DashboardStandaloneMode } from '../../../../src/dashboard/util/constants';

Review comment:
       ```suggestion
   import { DashboardStandaloneMode } from 'src/dashboard/util/constants';
   ```




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