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>2020-04-08 12:09:43 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-08 12:09:43 +0300
commitf5050253469fc0961c02deec0e698ad62bdd9de5 (patch)
tree30bbd8f8b556fd5b730f0123921138ee1d6bdaa2 /spec/frontend
parentf6cdec670b9b757fc2225a2c6627ab79765e5b8a (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
-rw-r--r--spec/frontend/logs/components/environment_logs_spec.js15
-rw-r--r--spec/frontend/logs/stores/actions_spec.js37
-rw-r--r--spec/frontend/logs/stores/mutations_spec.js9
-rw-r--r--spec/frontend/repository/components/table/__snapshots__/row_spec.js.snap22
-rw-r--r--spec/frontend/repository/components/table/row_spec.js9
-rw-r--r--spec/frontend/vue_shared/components/file_icon_spec.js5
6 files changed, 54 insertions, 43 deletions
diff --git a/spec/frontend/logs/components/environment_logs_spec.js b/spec/frontend/logs/components/environment_logs_spec.js
index 4da987725a1..befcd462828 100644
--- a/spec/frontend/logs/components/environment_logs_spec.js
+++ b/spec/frontend/logs/components/environment_logs_spec.js
@@ -47,7 +47,7 @@ describe('EnvironmentLogs', () => {
const findLogControlButtons = () => wrapper.find({ name: 'log-control-buttons-stub' });
const findInfiniteScroll = () => wrapper.find({ ref: 'infiniteScroll' });
- const findLogTrace = () => wrapper.find('.js-log-trace');
+ const findLogTrace = () => wrapper.find({ ref: 'logTrace' });
const findLogFooter = () => wrapper.find({ ref: 'logFooter' });
const getInfiniteScrollAttr = attr => parseInt(findInfiniteScroll().attributes(attr), 10);
@@ -169,16 +169,12 @@ describe('EnvironmentLogs', () => {
expect(updateControlBtnsMock).not.toHaveBeenCalled();
});
- it('shows an infinite scroll with height and no content', () => {
- expect(getInfiniteScrollAttr('max-list-height')).toBeGreaterThan(0);
+ it('shows an infinite scroll with no content', () => {
expect(getInfiniteScrollAttr('fetched-items')).toBe(0);
});
- it('shows an infinite scroll container with equal height and max-height ', () => {
- const height = getInfiniteScrollAttr('max-list-height');
-
- expect(height).toEqual(expect.any(Number));
- expect(findInfiniteScroll().attributes('style')).toMatch(`height: ${height}px;`);
+ it('shows an infinite scroll container with no set max-height ', () => {
+ expect(findInfiniteScroll().attributes('max-list-height')).toBeUndefined();
});
it('shows a logs trace', () => {
@@ -270,8 +266,7 @@ describe('EnvironmentLogs', () => {
expect(findAdvancedFilters().exists()).toBe(true);
});
- it('shows infinite scroll with height and no content', () => {
- expect(getInfiniteScrollAttr('max-list-height')).toBeGreaterThan(0);
+ it('shows infinite scroll with content', () => {
expect(getInfiniteScrollAttr('fetched-items')).toBe(mockTrace.length);
});
diff --git a/spec/frontend/logs/stores/actions_spec.js b/spec/frontend/logs/stores/actions_spec.js
index 303737a11cd..882673af984 100644
--- a/spec/frontend/logs/stores/actions_spec.js
+++ b/spec/frontend/logs/stores/actions_spec.js
@@ -38,7 +38,7 @@ jest.mock('~/logs/utils');
const mockDefaultRange = {
start: '2020-01-10T18:00:00.000Z',
- end: '2020-01-10T10:00:00.000Z',
+ end: '2020-01-10T19:00:00.000Z',
};
const mockFixedRange = {
start: '2020-01-09T18:06:20.000Z',
@@ -145,9 +145,6 @@ describe('Logs Store actions', () => {
{ type: types.RECEIVE_ENVIRONMENTS_DATA_ERROR },
],
[],
- () => {
- expect(flash).toHaveBeenCalledTimes(1);
- },
);
});
});
@@ -186,6 +183,7 @@ describe('Logs Store actions', () => {
it('should commit logs and pod data when there is pod name defined', () => {
state.pods.current = mockPodName;
+ state.timeRange.current = mockFixedRange;
return testAction(fetchLogs, null, state, expectedMutations, expectedActions, () => {
expect(latestGetParams()).toMatchObject({
@@ -214,22 +212,26 @@ describe('Logs Store actions', () => {
state.search = mockSearch;
state.timeRange.current = 'INVALID_TIME_RANGE';
+ expectedMutations.splice(1, 0, {
+ type: types.SHOW_TIME_RANGE_INVALID_WARNING,
+ });
+
return testAction(fetchLogs, null, state, expectedMutations, expectedActions, () => {
expect(latestGetParams()).toEqual({
pod_name: mockPodName,
search: mockSearch,
});
- // Warning about time ranges was issued
- expect(flash).toHaveBeenCalledTimes(1);
- expect(flash).toHaveBeenCalledWith(expect.any(String), 'warning');
});
});
it('should commit logs and pod data when no pod name defined', () => {
- state.timeRange.current = mockDefaultRange;
+ state.timeRange.current = defaultTimeRange;
return testAction(fetchLogs, null, state, expectedMutations, expectedActions, () => {
- expect(latestGetParams()).toEqual({});
+ expect(latestGetParams()).toEqual({
+ start_time: expect.any(String),
+ end_time: expect.any(String),
+ });
});
});
});
@@ -249,6 +251,7 @@ describe('Logs Store actions', () => {
it('should commit logs and pod data when there is pod name defined', () => {
state.pods.current = mockPodName;
+ state.timeRange.current = mockFixedRange;
expectedActions = [];
@@ -293,6 +296,10 @@ describe('Logs Store actions', () => {
state.search = mockSearch;
state.timeRange.current = 'INVALID_TIME_RANGE';
+ expectedMutations.splice(1, 0, {
+ type: types.SHOW_TIME_RANGE_INVALID_WARNING,
+ });
+
return testAction(
fetchMoreLogsPrepend,
null,
@@ -304,15 +311,12 @@ describe('Logs Store actions', () => {
pod_name: mockPodName,
search: mockSearch,
});
- // Warning about time ranges was issued
- expect(flash).toHaveBeenCalledTimes(1);
- expect(flash).toHaveBeenCalledWith(expect.any(String), 'warning');
},
);
});
it('should commit logs and pod data when no pod name defined', () => {
- state.timeRange.current = mockDefaultRange;
+ state.timeRange.current = defaultTimeRange;
return testAction(
fetchMoreLogsPrepend,
@@ -321,7 +325,10 @@ describe('Logs Store actions', () => {
expectedMutations,
expectedActions,
() => {
- expect(latestGetParams()).toEqual({});
+ expect(latestGetParams()).toEqual({
+ start_time: expect.any(String),
+ end_time: expect.any(String),
+ });
},
);
});
@@ -357,6 +364,7 @@ describe('Logs Store actions', () => {
it('fetchLogs should commit logs and pod errors', () => {
state.environments.options = mockEnvironments;
state.environments.current = mockEnvName;
+ state.timeRange.current = defaultTimeRange;
return testAction(
fetchLogs,
@@ -377,6 +385,7 @@ describe('Logs Store actions', () => {
it('fetchMoreLogsPrepend should commit logs and pod errors', () => {
state.environments.options = mockEnvironments;
state.environments.current = mockEnvName;
+ state.timeRange.current = defaultTimeRange;
return testAction(
fetchMoreLogsPrepend,
diff --git a/spec/frontend/logs/stores/mutations_spec.js b/spec/frontend/logs/stores/mutations_spec.js
index 37db355af09..46561055a4a 100644
--- a/spec/frontend/logs/stores/mutations_spec.js
+++ b/spec/frontend/logs/stores/mutations_spec.js
@@ -67,6 +67,7 @@ describe('Logs Store Mutations', () => {
options: [],
isLoading: false,
current: null,
+ fetchError: true,
});
});
});
@@ -83,6 +84,7 @@ describe('Logs Store Mutations', () => {
expect(state.logs).toEqual({
lines: [],
cursor: null,
+ fetchError: false,
isLoading: true,
isComplete: false,
});
@@ -101,6 +103,7 @@ describe('Logs Store Mutations', () => {
isLoading: false,
cursor: mockCursor,
isComplete: false,
+ fetchError: false,
});
});
@@ -115,6 +118,7 @@ describe('Logs Store Mutations', () => {
isLoading: false,
cursor: null,
isComplete: true,
+ fetchError: false,
});
});
});
@@ -128,6 +132,7 @@ describe('Logs Store Mutations', () => {
isLoading: false,
cursor: null,
isComplete: false,
+ fetchError: true,
});
});
});
@@ -152,6 +157,7 @@ describe('Logs Store Mutations', () => {
isLoading: false,
cursor: mockCursor,
isComplete: false,
+ fetchError: false,
});
});
@@ -171,6 +177,7 @@ describe('Logs Store Mutations', () => {
isLoading: false,
cursor: mockNextCursor,
isComplete: false,
+ fetchError: false,
});
});
@@ -185,6 +192,7 @@ describe('Logs Store Mutations', () => {
isLoading: false,
cursor: null,
isComplete: true,
+ fetchError: false,
});
});
});
@@ -194,6 +202,7 @@ describe('Logs Store Mutations', () => {
mutations[types.RECEIVE_LOGS_DATA_PREPEND_ERROR](state);
expect(state.logs.isLoading).toBe(false);
+ expect(state.logs.fetchError).toBe(true);
});
});
diff --git a/spec/frontend/repository/components/table/__snapshots__/row_spec.js.snap b/spec/frontend/repository/components/table/__snapshots__/row_spec.js.snap
index 5b5c9fd714e..97597ed8063 100644
--- a/spec/frontend/repository/components/table/__snapshots__/row_spec.js.snap
+++ b/spec/frontend/repository/components/table/__snapshots__/row_spec.js.snap
@@ -7,17 +7,16 @@ exports[`Repository table row component renders table row 1`] = `
<td
class="tree-item-file-name cursor-default position-relative"
>
- <!---->
-
<a
class="tree-item-link str-truncated"
data-qa-selector="file_name_link"
href="https://test.com"
>
- <i
- aria-label="file"
- class="fa fa-fw mr-1 fa-file-text-o"
- role="img"
+ <file-icon-stub
+ class="mr-1 position-relative text-secondary"
+ cssclasses="position-relative file-icon"
+ filename="test"
+ size="16"
/>
<span
class="position-relative"
@@ -60,17 +59,16 @@ exports[`Repository table row component renders table row for path with special
<td
class="tree-item-file-name cursor-default position-relative"
>
- <!---->
-
<a
class="tree-item-link str-truncated"
data-qa-selector="file_name_link"
href="https://test.com"
>
- <i
- aria-label="file"
- class="fa fa-fw mr-1 fa-file-text-o"
- role="img"
+ <file-icon-stub
+ class="mr-1 position-relative text-secondary"
+ cssclasses="position-relative file-icon"
+ filename="test"
+ size="16"
/>
<span
class="position-relative"
diff --git a/spec/frontend/repository/components/table/row_spec.js b/spec/frontend/repository/components/table/row_spec.js
index 7bb7ad6e5dd..cb2193e1d9a 100644
--- a/spec/frontend/repository/components/table/row_spec.js
+++ b/spec/frontend/repository/components/table/row_spec.js
@@ -1,7 +1,7 @@
import { shallowMount, RouterLinkStub } from '@vue/test-utils';
-import { GlBadge, GlLink, GlLoadingIcon } from '@gitlab/ui';
+import { GlBadge, GlLink, GlIcon } from '@gitlab/ui';
import TableRow from '~/repository/components/table/row.vue';
-import Icon from '~/vue_shared/components/icon.vue';
+import FileIcon from '~/vue_shared/components/file_icon.vue';
let vm;
let $router;
@@ -188,7 +188,8 @@ describe('Repository table row component', () => {
vm.setData({ commit: { lockLabel: 'Locked by Root', committedDate: '2019-01-01' } });
return vm.vm.$nextTick().then(() => {
- expect(vm.find(Icon).exists()).toBe(true);
+ expect(vm.find(GlIcon).exists()).toBe(true);
+ expect(vm.find(GlIcon).props('name')).toBe('lock');
});
});
@@ -202,6 +203,6 @@ describe('Repository table row component', () => {
loadingPath: 'test',
});
- expect(vm.find(GlLoadingIcon).exists()).toBe(true);
+ expect(vm.find(FileIcon).props('loading')).toBe(true);
});
});
diff --git a/spec/frontend/vue_shared/components/file_icon_spec.js b/spec/frontend/vue_shared/components/file_icon_spec.js
index 7b7633a06d6..5a385eee60c 100644
--- a/spec/frontend/vue_shared/components/file_icon_spec.js
+++ b/spec/frontend/vue_shared/components/file_icon_spec.js
@@ -1,7 +1,6 @@
import { shallowMount } from '@vue/test-utils';
-import { GlLoadingIcon } from '@gitlab/ui';
+import { GlLoadingIcon, GlIcon } from '@gitlab/ui';
import FileIcon from '~/vue_shared/components/file_icon.vue';
-import Icon from '~/vue_shared/components/icon.vue';
describe('File Icon component', () => {
let wrapper;
@@ -48,7 +47,7 @@ describe('File Icon component', () => {
});
expect(findIcon().exists()).toBe(false);
- expect(wrapper.find(Icon).classes()).toContain('folder-icon');
+ expect(wrapper.find(GlIcon).classes()).toContain('folder-icon');
});
it('should render a loading icon', () => {