feat: one-click copy chart and dashboard URL (#13037)

Closes #10328
This commit is contained in:
Michael S. Molina
2021-02-17 19:14:08 -03:00
committed by GitHub
parent 91db008d72
commit ad4ca2223e
22 changed files with 422 additions and 344 deletions

View File

@@ -20,11 +20,11 @@ import React from 'react';
import { shallow } from 'enzyme';
import { Menu, NoAnimationDropdown } from 'src/common/components';
import RefreshIntervalModal from 'src/dashboard/components/RefreshIntervalModal';
import URLShortLinkModal from 'src/components/URLShortLinkModal';
import HeaderActionsDropdown from 'src/dashboard/components/HeaderActionsDropdown';
import SaveModal from 'src/dashboard/components/SaveModal';
import CssEditor from 'src/dashboard/components/CssEditor';
import fetchMock from 'fetch-mock';
import ShareMenuItems from 'src/dashboard/components/menu/ShareMenuItems';
fetchMock.get('glob:*/csstemplateasyncmodelview/api/read', {});
@@ -79,9 +79,9 @@ describe('HeaderActionsDropdown', () => {
expect(menu.find(SaveModal)).not.toExist();
});
it('should render five Menu items', () => {
it('should render available Menu items', () => {
const { menu } = setup(overrideProps);
expect(menu.find(Menu.Item)).toHaveLength(5);
expect(menu.find(Menu.Item)).toHaveLength(4);
});
it('should render the RefreshIntervalModal', () => {
@@ -89,9 +89,9 @@ describe('HeaderActionsDropdown', () => {
expect(menu.find(RefreshIntervalModal)).toExist();
});
it('should render the URLShortLinkModal', () => {
it('should render the ShareMenuItems', () => {
const { menu } = setup(overrideProps);
expect(menu.find(URLShortLinkModal)).toExist();
expect(menu.find(ShareMenuItems)).toExist();
});
it('should not render the CssEditor', () => {
@@ -113,9 +113,9 @@ describe('HeaderActionsDropdown', () => {
expect(menu.find(SaveModal)).toExist();
});
it('should render six Menu items', () => {
it('should render available Menu items', () => {
const { menu } = setup(overrideProps);
expect(menu.find(Menu.Item)).toHaveLength(6);
expect(menu.find(Menu.Item)).toHaveLength(5);
});
it('should render the RefreshIntervalModal', () => {
@@ -123,9 +123,9 @@ describe('HeaderActionsDropdown', () => {
expect(menu.find(RefreshIntervalModal)).toExist();
});
it('should render the URLShortLinkModal', () => {
it('should render the ShareMenuItems', () => {
const { menu } = setup(overrideProps);
expect(menu.find(URLShortLinkModal)).toExist();
expect(menu.find(ShareMenuItems)).toExist();
});
it('should not render the CssEditor', () => {
@@ -147,9 +147,9 @@ describe('HeaderActionsDropdown', () => {
expect(menu.find(SaveModal)).toExist();
});
it('should render seven MenuItems', () => {
it('should render available MenuItems', () => {
const { menu } = setup(overrideProps);
expect(menu.find(Menu.Item)).toHaveLength(7);
expect(menu.find(Menu.Item)).toHaveLength(6);
});
it('should render the RefreshIntervalModal', () => {
@@ -157,9 +157,9 @@ describe('HeaderActionsDropdown', () => {
expect(menu.find(RefreshIntervalModal)).toExist();
});
it('should render the URLShortLinkModal', () => {
it('should render the ShareMenuItems', () => {
const { menu } = setup(overrideProps);
expect(menu.find(URLShortLinkModal)).toExist();
expect(menu.find(ShareMenuItems)).toExist();
});
it('should render the CssEditor', () => {

View File

@@ -57,6 +57,7 @@ describe('Chart', () => {
changeFilter() {},
setFocusedFilterField() {},
unsetFocusedFilterField() {},
addSuccessToast() {},
addDangerToast() {},
componentId: 'test',
dashboardId: 111,