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-03-05 21:08:19 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-05 21:08:19 +0300
commita8de96bff51846e160b76506dc0ca0fe6f767f64 (patch)
tree1036f1ca75aba492eaaa3439c84a3109b4684896 /spec/frontend/blob/components/blob_edit_header_spec.js
parentafe2b984524ae4b0c8a0636db7ec5b2c452f0734 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/blob/components/blob_edit_header_spec.js')
-rw-r--r--spec/frontend/blob/components/blob_edit_header_spec.js50
1 files changed, 50 insertions, 0 deletions
diff --git a/spec/frontend/blob/components/blob_edit_header_spec.js b/spec/frontend/blob/components/blob_edit_header_spec.js
new file mode 100644
index 00000000000..db7d7d7d48d
--- /dev/null
+++ b/spec/frontend/blob/components/blob_edit_header_spec.js
@@ -0,0 +1,50 @@
+import { shallowMount } from '@vue/test-utils';
+import BlobEditHeader from '~/blob/components/blob_edit_header.vue';
+import { GlFormInput } from '@gitlab/ui';
+
+describe('Blob Header Editing', () => {
+ let wrapper;
+ const value = 'foo.md';
+
+ function createComponent() {
+ wrapper = shallowMount(BlobEditHeader, {
+ propsData: {
+ value,
+ },
+ });
+ }
+
+ beforeEach(() => {
+ createComponent();
+ });
+
+ afterEach(() => {
+ wrapper.destroy();
+ });
+
+ describe('rendering', () => {
+ it('matches the snapshot', () => {
+ expect(wrapper.element).toMatchSnapshot();
+ });
+
+ it('contains a form input field', () => {
+ expect(wrapper.contains(GlFormInput)).toBe(true);
+ });
+ });
+
+ describe('functionality', () => {
+ it('emits input event when the blob name is changed', () => {
+ const inputComponent = wrapper.find(GlFormInput);
+ const newValue = 'bar.txt';
+
+ wrapper.setData({
+ name: newValue,
+ });
+ inputComponent.vm.$emit('change');
+
+ return wrapper.vm.$nextTick().then(() => {
+ expect(wrapper.emitted().input[0]).toEqual([newValue]);
+ });
+ });
+ });
+});