spec updates
This commit is contained in:
parent
5588efede3
commit
d14a06da4e
|
|
@ -10,18 +10,8 @@ export default {
|
||||||
directives: {
|
directives: {
|
||||||
tooltip,
|
tooltip,
|
||||||
},
|
},
|
||||||
props: {
|
|
||||||
noChangesStateSvgPath: {
|
|
||||||
type: String,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
committedStateSvgPath: {
|
|
||||||
type: String,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['lastCommitMsg']),
|
...mapState(['lastCommitMsg', 'noChangesStateSvgPath', 'committedStateSvgPath']),
|
||||||
statusSvg() {
|
statusSvg() {
|
||||||
return this.lastCommitMsg ? this.committedStateSvgPath : this.noChangesStateSvgPath;
|
return this.lastCommitMsg ? this.committedStateSvgPath : this.noChangesStateSvgPath;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ export default {
|
||||||
tooltip,
|
tooltip,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['changedFiles', 'stagedFiles', 'noChangesStateSvgPath', 'committedStateSvgPath']),
|
...mapState(['changedFiles', 'stagedFiles']),
|
||||||
...mapState('commit', ['commitMessage', 'submitCommitLoading']),
|
...mapState('commit', ['commitMessage', 'submitCommitLoading']),
|
||||||
...mapGetters('commit', ['commitButtonDisabled', 'discardDraftButtonDisabled', 'branchName']),
|
...mapGetters('commit', ['commitButtonDisabled', 'discardDraftButtonDisabled', 'branchName']),
|
||||||
},
|
},
|
||||||
|
|
@ -108,8 +108,6 @@ export default {
|
||||||
</template>
|
</template>
|
||||||
<empty-state
|
<empty-state
|
||||||
v-else
|
v-else
|
||||||
:no-changes-state-svg-path="noChangesStateSvgPath"
|
|
||||||
:committed-state-svg-path="committedStateSvgPath"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,10 @@ describe('IDE commit panel empty state', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
const Component = Vue.extend(emptyState);
|
const Component = Vue.extend(emptyState);
|
||||||
|
|
||||||
vm = createComponentWithStore(Component, store, {
|
Vue.set(store.state, 'noChangesStateSvgPath', 'no-changes');
|
||||||
noChangesStateSvgPath: 'no-changes',
|
Vue.set(store.state, 'committedStateSvgPath', 'committed-state');
|
||||||
committedStateSvgPath: 'committed-state',
|
|
||||||
});
|
vm = createComponentWithStore(Component, store);
|
||||||
|
|
||||||
vm.$mount();
|
vm.$mount();
|
||||||
});
|
});
|
||||||
|
|
@ -27,9 +27,7 @@ describe('IDE commit panel empty state', () => {
|
||||||
describe('statusSvg', () => {
|
describe('statusSvg', () => {
|
||||||
it('uses noChangesStateSvgPath when commit message is empty', () => {
|
it('uses noChangesStateSvgPath when commit message is empty', () => {
|
||||||
expect(vm.statusSvg).toBe('no-changes');
|
expect(vm.statusSvg).toBe('no-changes');
|
||||||
expect(vm.$el.querySelector('img').getAttribute('src')).toBe(
|
expect(vm.$el.querySelector('img').getAttribute('src')).toBe('no-changes');
|
||||||
'no-changes',
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('uses committedStateSvgPath when commit message exists', done => {
|
it('uses committedStateSvgPath when commit message exists', done => {
|
||||||
|
|
@ -37,9 +35,7 @@ describe('IDE commit panel empty state', () => {
|
||||||
|
|
||||||
Vue.nextTick(() => {
|
Vue.nextTick(() => {
|
||||||
expect(vm.statusSvg).toBe('committed-state');
|
expect(vm.statusSvg).toBe('committed-state');
|
||||||
expect(vm.$el.querySelector('img').getAttribute('src')).toBe(
|
expect(vm.$el.querySelector('img').getAttribute('src')).toBe('committed-state');
|
||||||
'committed-state',
|
|
||||||
);
|
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
@ -59,37 +55,4 @@ describe('IDE commit panel empty state', () => {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('toggle button', () => {
|
|
||||||
it('calls store action', () => {
|
|
||||||
spyOn(vm, 'toggleRightPanelCollapsed');
|
|
||||||
|
|
||||||
vm.$el.querySelector('.multi-file-commit-panel-collapse-btn').click();
|
|
||||||
|
|
||||||
expect(vm.toggleRightPanelCollapsed).toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('renders collapsed class', done => {
|
|
||||||
vm.$el.querySelector('.multi-file-commit-panel-collapse-btn').click();
|
|
||||||
|
|
||||||
Vue.nextTick(() => {
|
|
||||||
expect(vm.$el.querySelector('.is-collapsed')).not.toBeNull();
|
|
||||||
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('collapsed state', () => {
|
|
||||||
beforeEach(done => {
|
|
||||||
vm.$store.state.rightPanelCollapsed = true;
|
|
||||||
|
|
||||||
Vue.nextTick(done);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('does not render text & svg', () => {
|
|
||||||
expect(vm.$el.querySelector('img')).toBeNull();
|
|
||||||
expect(vm.$el.textContent).not.toContain('No changes');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -37,12 +37,6 @@ describe('IDE store getters', () => {
|
||||||
expect(modifiedFiles.length).toBe(1);
|
expect(modifiedFiles.length).toBe(1);
|
||||||
expect(modifiedFiles[0].name).toBe('changed');
|
expect(modifiedFiles[0].name).toBe('changed');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns angle left when collapsed', () => {
|
|
||||||
localState.rightPanelCollapsed = true;
|
|
||||||
|
|
||||||
expect(getters.collapseButtonIcon(localState)).toBe('angle-double-left');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('currentMergeRequest', () => {
|
describe('currentMergeRequest', () => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue