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-04-15 00:09:52 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-15 00:09:52 +0300
commitae93b284016c07a8a4b47e2510789253d14870f3 (patch)
treec7dc8690b841dd7d3a4eeeca944969d14df582a6 /spec/javascripts
parentf697dc5e76dfc5894df006d53b2b7e751653cf05 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/ide/components/repo_commit_section_spec.js113
1 files changed, 0 insertions, 113 deletions
diff --git a/spec/javascripts/ide/components/repo_commit_section_spec.js b/spec/javascripts/ide/components/repo_commit_section_spec.js
deleted file mode 100644
index 0ba8c86a036..00000000000
--- a/spec/javascripts/ide/components/repo_commit_section_spec.js
+++ /dev/null
@@ -1,113 +0,0 @@
-import Vue from 'vue';
-import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
-import store from '~/ide/stores';
-import router from '~/ide/ide_router';
-import repoCommitSection from '~/ide/components/repo_commit_section.vue';
-import { file, resetStore } from '../helpers';
-
-describe('RepoCommitSection', () => {
- let vm;
-
- function createComponent() {
- const Component = Vue.extend(repoCommitSection);
-
- store.state.noChangesStateSvgPath = 'svg';
- store.state.committedStateSvgPath = 'commitsvg';
-
- vm = createComponentWithStore(Component, store);
-
- vm.$store.state.currentProjectId = 'abcproject';
- vm.$store.state.currentBranchId = 'master';
- vm.$store.state.projects.abcproject = {
- web_url: '',
- branches: {
- master: {
- workingReference: '1',
- },
- },
- };
-
- const files = [file('file1'), file('file2')].map(f =>
- Object.assign(f, {
- type: 'blob',
- content: 'orginal content',
- }),
- );
-
- vm.$store.state.rightPanelCollapsed = false;
- vm.$store.state.currentBranch = 'master';
- vm.$store.state.changedFiles = [];
- vm.$store.state.stagedFiles = [{ ...files[0] }, { ...files[1] }];
- vm.$store.state.stagedFiles.forEach(f =>
- Object.assign(f, {
- changed: true,
- content: 'testing',
- }),
- );
-
- files.forEach(f => {
- vm.$store.state.entries[f.path] = f;
- });
-
- return vm;
- }
-
- beforeEach(done => {
- spyOn(router, 'push');
-
- vm = createComponent();
-
- spyOn(vm, 'openPendingTab').and.callThrough();
-
- vm.$mount();
-
- Vue.nextTick(done);
- });
-
- afterEach(() => {
- vm.$destroy();
-
- resetStore(vm.$store);
- });
-
- describe('empty Stage', () => {
- it('renders no changes text', () => {
- resetStore(vm.$store);
- const Component = Vue.extend(repoCommitSection);
-
- store.state.noChangesStateSvgPath = 'nochangessvg';
- store.state.committedStateSvgPath = 'svg';
-
- vm.$destroy();
- vm = createComponentWithStore(Component, store).$mount();
-
- expect(vm.$el.querySelector('.js-empty-state').textContent.trim()).toContain('No changes');
- expect(vm.$el.querySelector('.js-empty-state img').getAttribute('src')).toBe('nochangessvg');
- });
- });
-
- it('renders a commit section', () => {
- const changedFileElements = [...vm.$el.querySelectorAll('.multi-file-commit-list > li')];
- const allFiles = vm.$store.state.changedFiles.concat(vm.$store.state.stagedFiles);
-
- expect(changedFileElements).toHaveLength(2);
-
- changedFileElements.forEach((changedFile, i) => {
- expect(changedFile.textContent.trim()).toContain(allFiles[i].path);
- });
- });
-
- describe('mounted', () => {
- it('opens last opened file', () => {
- expect(store.state.openFiles.length).toBe(1);
- expect(store.state.openFiles[0].pending).toBe(true);
- });
-
- it('calls openPendingTab', () => {
- expect(vm.openPendingTab).toHaveBeenCalledWith({
- file: vm.lastOpenedFile,
- keyPrefix: 'unstaged',
- });
- });
- });
-});