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-05-08 21:09:55 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-08 21:09:55 +0300
commitc0c1433fa5a9f31c8eb4292d13de744aa74e9e83 (patch)
treed3d0092f22ceca3d97bf5d882081b1fa70524911 /spec/frontend
parent2e4dcef627009fa11836f6f624e7313843cb4a38 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
-rw-r--r--spec/frontend/alert_management/components/alert_management_detail_spec.js26
-rw-r--r--spec/frontend/static_site_editor/graphql/resolvers/file_spec.js25
-rw-r--r--spec/frontend/static_site_editor/pages/home_spec.js4
3 files changed, 52 insertions, 3 deletions
diff --git a/spec/frontend/alert_management/components/alert_management_detail_spec.js b/spec/frontend/alert_management/components/alert_management_detail_spec.js
index f5b5d669742..55ac62eccdf 100644
--- a/spec/frontend/alert_management/components/alert_management_detail_spec.js
+++ b/spec/frontend/alert_management/components/alert_management_detail_spec.js
@@ -3,16 +3,21 @@ import AlertDetails from '~/alert_management/components/alert_details.vue';
describe('AlertDetails', () => {
let wrapper;
+ const newIssuePath = 'root/alerts/-/issues/new';
- function mountComponent(alert = {}) {
+ function mountComponent(alert = {}, createIssueFromAlertEnabled = false) {
wrapper = shallowMount(AlertDetails, {
propsData: {
alertId: 'alertId',
projectPath: 'projectPath',
+ newIssuePath,
},
data() {
return { alert };
},
+ provide: {
+ glFeatures: { createIssueFromAlertEnabled },
+ },
});
}
@@ -22,6 +27,8 @@ describe('AlertDetails', () => {
}
});
+ const findCreatedIssueBtn = () => wrapper.find('[data-testid="createIssueBtn"]');
+
describe('Alert details', () => {
describe('when alert is null', () => {
beforeEach(() => {
@@ -60,5 +67,22 @@ describe('AlertDetails', () => {
it('renders a status dropdown containing three items', () => {
expect(wrapper.findAll('[data-testid="statusDropdownItem"]').length).toBe(3);
});
+
+ describe('Create issue from alert', () => {
+ describe('createIssueFromAlertEnabled feature flag enabled', () => {
+ it('should display a button that links to new issue page', () => {
+ mountComponent({}, true);
+ expect(findCreatedIssueBtn().exists()).toBe(true);
+ expect(findCreatedIssueBtn().attributes('href')).toBe(newIssuePath);
+ });
+ });
+
+ describe('createIssueFromAlertEnabled feature flag disabled', () => {
+ it('should display a button that links to a new issue page', () => {
+ mountComponent({}, false);
+ expect(findCreatedIssueBtn().exists()).toBe(false);
+ });
+ });
+ });
});
});
diff --git a/spec/frontend/static_site_editor/graphql/resolvers/file_spec.js b/spec/frontend/static_site_editor/graphql/resolvers/file_spec.js
new file mode 100644
index 00000000000..8504d09e0f1
--- /dev/null
+++ b/spec/frontend/static_site_editor/graphql/resolvers/file_spec.js
@@ -0,0 +1,25 @@
+import fileResolver from '~/static_site_editor/graphql/resolvers/file';
+import loadSourceContent from '~/static_site_editor/services/load_source_content';
+
+import {
+ projectId,
+ sourcePath,
+ sourceContentTitle as title,
+ sourceContent as content,
+} from '../../mock_data';
+
+jest.mock('~/static_site_editor/services/load_source_content', () => jest.fn());
+
+describe('static_site_editor/graphql/resolvers/file', () => {
+ it('returns file content and title when fetching file successfully', () => {
+ loadSourceContent.mockResolvedValueOnce({ title, content });
+
+ return fileResolver({ fullPath: projectId }, { path: sourcePath }).then(file => {
+ expect(file).toEqual({
+ __typename: 'File',
+ title,
+ content,
+ });
+ });
+ });
+});
diff --git a/spec/frontend/static_site_editor/pages/home_spec.js b/spec/frontend/static_site_editor/pages/home_spec.js
index ab1bcab3b59..69646abade5 100644
--- a/spec/frontend/static_site_editor/pages/home_spec.js
+++ b/spec/frontend/static_site_editor/pages/home_spec.js
@@ -66,7 +66,7 @@ describe('static_site_editor/pages/home', () => {
});
};
- const buildWrapper = (data = { isSupportedContent: true }) => {
+ const buildWrapper = (data = { appData: { isSupportedContent: true } }) => {
wrapper = shallowMount(Home, {
localVue,
store,
@@ -196,7 +196,7 @@ describe('static_site_editor/pages/home', () => {
});
it('displays invalid content message when content is not supported', () => {
- buildWrapper({ isSupportedContent: false });
+ buildWrapper({ appData: { isSupportedContent: false } });
expect(findInvalidContentMessage().exists()).toBe(true);
});