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>2021-03-09 15:08:52 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-09 15:08:52 +0300
commitb90d8b54a4d623e52cf1d4318023e3b18d13dd5b (patch)
tree19012dcd9dff32ef1c47182229bdabb6b078a7fc /spec/frontend/projects
parenta989894b49e6c72648485a82c570647c17a3763f (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/projects')
-rw-r--r--spec/frontend/projects/details/upload_button_spec.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/spec/frontend/projects/details/upload_button_spec.js b/spec/frontend/projects/details/upload_button_spec.js
new file mode 100644
index 00000000000..d7308963088
--- /dev/null
+++ b/spec/frontend/projects/details/upload_button_spec.js
@@ -0,0 +1,54 @@
+import { GlButton } from '@gitlab/ui';
+import { shallowMount } from '@vue/test-utils';
+import UploadButton from '~/projects/details/upload_button.vue';
+import UploadBlobModal from '~/repository/components/upload_blob_modal.vue';
+
+const MODAL_ID = 'details-modal-upload-blob';
+
+describe('UploadButton', () => {
+ let wrapper;
+ let glModalDirective;
+
+ const createComponent = () => {
+ glModalDirective = jest.fn();
+
+ return shallowMount(UploadButton, {
+ directives: {
+ glModal: {
+ bind(_, { value }) {
+ glModalDirective(value);
+ },
+ },
+ },
+ });
+ };
+
+ beforeEach(() => {
+ wrapper = createComponent();
+ });
+
+ afterEach(() => {
+ wrapper.destroy();
+ });
+
+ it('displays an upload button', () => {
+ expect(wrapper.find(GlButton).exists()).toBe(true);
+ });
+
+ it('contains a modal', () => {
+ const modal = wrapper.find(UploadBlobModal);
+
+ expect(modal.exists()).toBe(true);
+ expect(modal.props('modalId')).toBe(MODAL_ID);
+ });
+
+ describe('when clickinig the upload file button', () => {
+ beforeEach(() => {
+ wrapper.find(GlButton).vm.$emit('click');
+ });
+
+ it('opens the modal', () => {
+ expect(glModalDirective).toHaveBeenCalledWith(MODAL_ID);
+ });
+ });
+});