debian-mirror-gitlab/spec/frontend/ide/components/commit_sidebar/list_spec.js

53 lines
1.3 KiB
JavaScript
Raw Normal View History

2018-05-09 12:01:36 +05:30
import Vue from 'vue';
2020-04-22 19:07:51 +05:30
import { createComponentWithStore } from 'helpers/vue_mount_component_helper';
2018-05-09 12:01:36 +05:30
import store from '~/ide/stores';
import commitSidebarList from '~/ide/components/commit_sidebar/list.vue';
2018-10-15 14:42:47 +05:30
import { file, resetStore } from '../../helpers';
2018-05-09 12:01:36 +05:30
describe('Multi-file editor commit sidebar list', () => {
let vm;
beforeEach(() => {
const Component = Vue.extend(commitSidebarList);
vm = createComponentWithStore(Component, store, {
title: 'Staged',
fileList: [],
2018-10-15 14:42:47 +05:30
iconName: 'staged',
action: 'stageAllChanges',
actionBtnText: 'stage all',
2018-11-08 19:23:39 +05:30
actionBtnIcon: 'history',
activeFileKey: 'staged-testing',
keyPrefix: 'staged',
2018-05-09 12:01:36 +05:30
});
vm.$mount();
});
afterEach(() => {
vm.$destroy();
2018-10-15 14:42:47 +05:30
resetStore(vm.$store);
2018-05-09 12:01:36 +05:30
});
describe('with a list of files', () => {
beforeEach(done => {
const f = file('file name');
f.changed = true;
vm.fileList.push(f);
Vue.nextTick(done);
});
it('renders list', () => {
2018-11-08 19:23:39 +05:30
expect(vm.$el.querySelectorAll('.multi-file-commit-list > li').length).toBe(1);
2018-05-09 12:01:36 +05:30
});
});
2018-10-15 14:42:47 +05:30
describe('empty files array', () => {
it('renders no changes text when empty', () => {
expect(vm.$el.textContent).toContain('No changes');
2018-05-09 12:01:36 +05:30
});
});
});