Commit e0ed769c authored by jboyson's avatar jboyson

Fix reference to `isSquashReadOnly`

Changelog: fixed
parent 7a406c41
...@@ -191,7 +191,7 @@ export default { ...@@ -191,7 +191,7 @@ export default {
}, },
squashIsSelected() { squashIsSelected() {
if (this.glFeatures.mergeRequestWidgetGraphql) { if (this.glFeatures.mergeRequestWidgetGraphql) {
return this.squashReadOnly ? this.state.squashOnMerge : this.state.squash; return this.isSquashReadOnly ? this.state.squashOnMerge : this.state.squash;
} }
return this.mr.squashIsSelected; return this.mr.squashIsSelected;
......
...@@ -59,12 +59,17 @@ const createTestService = () => ({ ...@@ -59,12 +59,17 @@ const createTestService = () => ({
}); });
let wrapper; let wrapper;
const createComponent = (customConfig = {}) => { const createComponent = (customConfig = {}, mergeRequestWidgetGraphql = false) => {
wrapper = shallowMount(ReadyToMerge, { wrapper = shallowMount(ReadyToMerge, {
propsData: { propsData: {
mr: createTestMr(customConfig), mr: createTestMr(customConfig),
service: createTestService(), service: createTestService(),
}, },
provide: {
glFeatures: {
mergeRequestWidgetGraphql,
},
},
}); });
}; };
...@@ -673,6 +678,34 @@ describe('ReadyToMerge', () => { ...@@ -673,6 +678,34 @@ describe('ReadyToMerge', () => {
expect(findCommitEditElements().length).toBe(2); expect(findCommitEditElements().length).toBe(2);
}); });
it('should have two edit components when squash is enabled and there is more than 1 commit and mergeRequestWidgetGraphql is enabled', async () => {
createComponent(
{
mr: {
commitsCount: 2,
squashIsSelected: true,
enableSquashBeforeMerge: true,
},
},
true,
);
wrapper.setData({
loading: false,
state: {
...createTestMr({}),
userPermissions: {},
squash: true,
mergeable: true,
commitCount: 2,
commitsWithoutMergeCommits: {},
},
});
await wrapper.vm.$nextTick();
expect(findCommitEditElements().length).toBe(2);
});
it('should have one edit components when squash is enabled and there is 1 commit only', () => { it('should have one edit components when squash is enabled and there is 1 commit only', () => {
createComponent({ createComponent({
mr: { mr: {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment