blob: df2f9697accbb3169221fd952458dde8525d50e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
import Vue from 'vue';
import repoEditButton from '~/repo/components/repo_edit_button.vue';
import RepoStore from '~/repo/stores/repo_store';
describe('RepoEditButton', () => {
function createComponent() {
const RepoEditButton = Vue.extend(repoEditButton);
return new RepoEditButton().$mount();
}
it('renders an edit button that toggles the view state', (done) => {
RepoStore.isCommitable = true;
RepoStore.changedFiles = [];
const vm = createComponent();
expect(vm.$el.tagName).toEqual('BUTTON');
expect(vm.$el.textContent).toMatch('Edit');
spyOn(vm, 'editClicked').and.callThrough();
vm.$el.click();
Vue.nextTick(() => {
expect(vm.editClicked).toHaveBeenCalled();
expect(vm.$el.textContent).toMatch('Cancel edit');
done();
});
});
it('does not render if not isCommitable', () => {
RepoStore.isCommitable = false;
const vm = createComponent();
expect(vm.$el.innerHTML).toBeUndefined();
});
describe('methods', () => {
describe('editClicked', () => {
it('sets dialog to open when there are changedFiles', () => {
});
it('toggles editMode and calls toggleBlobView', () => {
});
});
});
});
|