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:
Diffstat (limited to 'spec/frontend/environments/empty_state_spec.js')
-rw-r--r--spec/frontend/environments/empty_state_spec.js69
1 files changed, 41 insertions, 28 deletions
diff --git a/spec/frontend/environments/empty_state_spec.js b/spec/frontend/environments/empty_state_spec.js
index 02cf2dc3c68..593200859e4 100644
--- a/spec/frontend/environments/empty_state_spec.js
+++ b/spec/frontend/environments/empty_state_spec.js
@@ -11,12 +11,17 @@ describe('~/environments/components/empty_state.vue', () => {
const findNewEnvironmentLink = () =>
wrapper.findByRole('link', {
- name: s__('Environments|New environment'),
+ name: s__('Environments|Create an environment'),
});
const findDocsLink = () =>
wrapper.findByRole('link', {
- name: s__('Environments|How do I create an environment?'),
+ name: 'Learn more',
+ });
+
+ const finfEnablingReviewButton = () =>
+ wrapper.findByRole('button', {
+ name: s__('Environments|Enable review apps'),
});
const createWrapper = ({ propsData = {} } = {}) =>
@@ -29,42 +34,44 @@ describe('~/environments/components/empty_state.vue', () => {
provide: { newEnvironmentPath: NEW_PATH },
});
- afterEach(() => {
- wrapper.destroy();
- });
+ describe('without search term', () => {
+ beforeEach(() => {
+ wrapper = createWrapper();
+ });
- it('shows an empty state for available environments', () => {
- wrapper = createWrapper();
+ it('shows an empty state environments', () => {
+ const title = wrapper.findByRole('heading', {
+ name: s__('Environments|Get started with environments'),
+ });
- const title = wrapper.findByRole('heading', {
- name: s__("Environments|You don't have any environments."),
+ expect(title.exists()).toBe(true);
});
- expect(title.exists()).toBe(true);
- });
-
- it('shows an empty state for stopped environments', () => {
- wrapper = createWrapper({ propsData: { scope: ENVIRONMENTS_SCOPE.STOPPED } });
+ it('shows a link to the the help path', () => {
+ const link = findDocsLink();
- const title = wrapper.findByRole('heading', {
- name: s__("Environments|You don't have any stopped environments."),
+ expect(link.attributes('href')).toBe(HELP_PATH);
});
- expect(title.exists()).toBe(true);
- });
+ it('shows a link to creating a new environment', () => {
+ const link = findNewEnvironmentLink();
- it('shows a link to the the help path', () => {
- wrapper = createWrapper();
+ expect(link.attributes('href')).toBe(NEW_PATH);
+ });
- const link = findDocsLink();
+ it('shows a button to enable review apps', () => {
+ const button = finfEnablingReviewButton();
- expect(link.attributes('href')).toBe(HELP_PATH);
- });
+ expect(button.exists()).toBe(true);
+ });
+
+ it('should emit enable review', () => {
+ const button = finfEnablingReviewButton();
- it('hides a link to creating a new environment', () => {
- const link = findNewEnvironmentLink();
+ button.vm.$emit('click');
- expect(link.exists()).toBe(false);
+ expect(wrapper.emitted('enable-review')).toBeDefined();
+ });
});
describe('with search term', () => {
@@ -90,10 +97,16 @@ describe('~/environments/components/empty_state.vue', () => {
expect(link.exists()).toBe(false);
});
- it('shows a link to create a new environment', () => {
+ it('hide a link to create a new environment', () => {
const link = findNewEnvironmentLink();
- expect(link.attributes('href')).toBe(NEW_PATH);
+ expect(link.exists()).toBe(false);
+ });
+
+ it('hide a button to enable review apps', () => {
+ const button = finfEnablingReviewButton();
+
+ expect(button.exists()).toBe(false);
});
});
});