Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-14 03:08:27 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-14 03:08:27 +0300
commitb7d58ff8b17623f64ac7835a590e79d916e758ac (patch)
tree4f75a8f9e0e30cf8c7e944ea2c4461be396c0d5f /spec/frontend
parent0e2fc1701bd0c87cc458cbbb34c618b0e0dc5a14 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
-rw-r--r--spec/frontend/monitoring/panel_type_spec.js76
-rw-r--r--spec/frontend/sidebar/components/assignees/assignee_avatar_link_spec.js6
-rw-r--r--spec/frontend/sidebar/user_data_mock.js6
3 files changed, 53 insertions, 35 deletions
diff --git a/spec/frontend/monitoring/panel_type_spec.js b/spec/frontend/monitoring/panel_type_spec.js
index 7adecc56d18..c869d77673e 100644
--- a/spec/frontend/monitoring/panel_type_spec.js
+++ b/spec/frontend/monitoring/panel_type_spec.js
@@ -20,6 +20,16 @@ describe('Panel Type component', () => {
const dashboardWidth = 100;
const exampleText = 'example_text';
+ const createWrapper = props =>
+ shallowMount(PanelType, {
+ propsData: {
+ ...props,
+ },
+ store,
+ sync: false,
+ attachToDocument: true,
+ });
+
beforeEach(() => {
setTestTimeout(1000);
axiosMock = new AxiosMockAdapter(axios);
@@ -36,14 +46,9 @@ describe('Panel Type component', () => {
graphDataNoResult.metrics[0].result = [];
beforeEach(() => {
- panelType = shallowMount(PanelType, {
- propsData: {
- clipboardText: 'dashboard_link',
- dashboardWidth,
- graphData: graphDataNoResult,
- },
- sync: false,
- attachToDocument: true,
+ panelType = createWrapper({
+ dashboardWidth,
+ graphData: graphDataNoResult,
});
});
@@ -68,41 +73,30 @@ describe('Panel Type component', () => {
});
});
- describe('when Graph data is available', () => {
- const propsData = {
- clipboardText: exampleText,
- dashboardWidth,
- graphData: graphDataPrometheusQueryRange,
- };
-
- beforeEach(done => {
+ describe('when graph data is available', () => {
+ beforeEach(() => {
store = createStore();
- panelType = shallowMount(PanelType, {
- propsData,
- store,
- sync: false,
- attachToDocument: true,
+ panelType = createWrapper({
+ dashboardWidth,
+ graphData: graphDataPrometheusQueryRange,
});
- panelType.vm.$nextTick(done);
});
afterEach(() => {
panelType.destroy();
});
+ it('sets no clipboard copy link on dropdown by default', () => {
+ const link = () => panelType.find('.js-chart-link');
+ expect(link().exists()).toBe(false);
+ });
+
describe('Time Series Chart panel type', () => {
it('is rendered', () => {
expect(panelType.find(TimeSeriesChart).isVueInstance()).toBe(true);
expect(panelType.find(TimeSeriesChart).exists()).toBe(true);
});
- it('sets clipboard text on the dropdown', () => {
- const link = () => panelType.find('.js-chart-link');
- const clipboardText = () => link().element.dataset.clipboardText;
-
- expect(clipboardText()).toBe(exampleText);
- });
-
it('includes a default group id', () => {
expect(panelType.vm.groupId).toBe('panel-type-chart');
});
@@ -123,6 +117,30 @@ describe('Panel Type component', () => {
});
});
+ describe('when cliboard data is available', () => {
+ const clipboardText = 'A value to copy.';
+
+ beforeEach(() => {
+ store = createStore();
+ panelType = createWrapper({
+ clipboardText,
+ dashboardWidth,
+ graphData: graphDataPrometheusQueryRange,
+ });
+ });
+
+ afterEach(() => {
+ panelType.destroy();
+ });
+
+ it('sets clipboard text on the dropdown', () => {
+ const link = () => panelType.find('.js-chart-link');
+
+ expect(link().exists()).toBe(true);
+ expect(link().element.dataset.clipboardText).toBe(clipboardText);
+ });
+ });
+
describe('when downloading metrics data as CSV', () => {
beforeEach(done => {
graphDataPrometheusQueryRange.y_label = 'metric';
diff --git a/spec/frontend/sidebar/components/assignees/assignee_avatar_link_spec.js b/spec/frontend/sidebar/components/assignees/assignee_avatar_link_spec.js
index d800649bc1d..9b2e2e38366 100644
--- a/spec/frontend/sidebar/components/assignees/assignee_avatar_link_spec.js
+++ b/spec/frontend/sidebar/components/assignees/assignee_avatar_link_spec.js
@@ -1,12 +1,11 @@
import { shallowMount } from '@vue/test-utils';
import { TEST_HOST } from 'helpers/test_constants';
-import { joinPaths } from '~/lib/utils/url_utility';
import AssigneeAvatarLink from '~/sidebar/components/assignees/assignee_avatar_link.vue';
import AssigneeAvatar from '~/sidebar/components/assignees/assignee_avatar.vue';
import userDataMock from '../../user_data_mock';
const TOOLTIP_PLACEMENT = 'bottom';
-const { name: USER_NAME, username: USER_USERNAME } = userDataMock();
+const { name: USER_NAME } = userDataMock();
const TEST_ISSUABLE_TYPE = 'merge_request';
describe('AssigneeAvatarLink component', () => {
@@ -38,9 +37,8 @@ describe('AssigneeAvatarLink component', () => {
it('has the root url present in the assigneeUrl method', () => {
createComponent();
- const assigneeUrl = joinPaths(TEST_HOST, USER_USERNAME);
- expect(wrapper.attributes().href).toEqual(assigneeUrl);
+ expect(wrapper.attributes().href).toEqual(userDataMock().web_url);
});
it('renders assignee avatar', () => {
diff --git a/spec/frontend/sidebar/user_data_mock.js b/spec/frontend/sidebar/user_data_mock.js
index 8ad70bb3499..df90a65f6f9 100644
--- a/spec/frontend/sidebar/user_data_mock.js
+++ b/spec/frontend/sidebar/user_data_mock.js
@@ -1,9 +1,11 @@
+import { TEST_HOST } from 'helpers/test_constants';
+
export default () => ({
- avatar_url: 'mock_path',
+ avatar_url: `${TEST_HOST}/avatar/root.png`,
id: 1,
name: 'Root',
state: 'active',
username: 'root',
- web_url: '',
+ web_url: `${TEST_HOST}/root`,
can_merge: true,
});