summaryrefslogtreecommitdiff
path: root/spec/frontend/pipeline_editor/components
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-05-05 15:10:05 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-05-05 15:10:05 +0000
commitcf05fd7f3956f0b1a17caf313e89bb7b3315d947 (patch)
tree8d847ad538180a03a6a25e7ee81605d2f86358d5 /spec/frontend/pipeline_editor/components
parent023e050d82ed11d9060ce5bdaec99c3871b98164 (diff)
downloadgitlab-ce-cf05fd7f3956f0b1a17caf313e89bb7b3315d947.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/pipeline_editor/components')
-rw-r--r--spec/frontend/pipeline_editor/components/drawer/pipeline_editor_drawer_spec.js74
1 files changed, 74 insertions, 0 deletions
diff --git a/spec/frontend/pipeline_editor/components/drawer/pipeline_editor_drawer_spec.js b/spec/frontend/pipeline_editor/components/drawer/pipeline_editor_drawer_spec.js
new file mode 100644
index 00000000000..587373c99b4
--- /dev/null
+++ b/spec/frontend/pipeline_editor/components/drawer/pipeline_editor_drawer_spec.js
@@ -0,0 +1,74 @@
+import { shallowMount } from '@vue/test-utils';
+import PipelineEditorDrawer from '~/pipeline_editor/components/drawer/pipeline_editor_drawer.vue';
+
+describe('Pipeline editor drawer', () => {
+ let wrapper;
+
+ const createComponent = () => {
+ wrapper = shallowMount(PipelineEditorDrawer);
+ };
+
+ const findToggleBtn = () => wrapper.find('[data-testid="toggleBtn"]');
+ const findArrowIcon = () => wrapper.find('[data-testid="toggle-icon"]');
+ const findCollapseText = () => wrapper.find('[data-testid="collapse-text"]');
+ const findDrawerContent = () => wrapper.find('[data-testid="drawer-content"]');
+
+ const clickToggleBtn = async () => findToggleBtn().vm.$emit('click');
+
+ afterEach(() => {
+ wrapper.destroy();
+ });
+
+ describe('when the drawer is collapsed', () => {
+ beforeEach(() => {
+ createComponent();
+ });
+
+ it('show the left facing arrow icon', () => {
+ expect(findArrowIcon().props('name')).toBe('chevron-double-lg-left');
+ });
+
+ it('does not show the collapse text', () => {
+ expect(findCollapseText().exists()).toBe(false);
+ });
+
+ it('does not show the drawer content', () => {
+ expect(findDrawerContent().exists()).toBe(false);
+ });
+
+ it('can open the drawer by clicking on the toggle button', async () => {
+ expect(findDrawerContent().exists()).toBe(false);
+
+ await clickToggleBtn();
+
+ expect(findDrawerContent().exists()).toBe(true);
+ });
+ });
+
+ describe('when the drawer is expanded', () => {
+ beforeEach(async () => {
+ createComponent();
+ await clickToggleBtn();
+ });
+
+ it('show the right facing arrow icon', () => {
+ expect(findArrowIcon().props('name')).toBe('chevron-double-lg-right');
+ });
+
+ it('shows the collapse text', () => {
+ expect(findCollapseText().exists()).toBe(true);
+ });
+
+ it('show the drawer content', () => {
+ expect(findDrawerContent().exists()).toBe(true);
+ });
+
+ it('can close the drawer by clicking on the toggle button', async () => {
+ expect(findDrawerContent().exists()).toBe(true);
+
+ await clickToggleBtn();
+
+ expect(findDrawerContent().exists()).toBe(false);
+ });
+ });
+});