Commit 0261917a authored by Savas Vedova's avatar Savas Vedova

Merge branch 'jlouw-display-rule-all-branches-as-monospace' into 'master'

Fix rule all branches not using monospace font

See merge request gitlab-org/gitlab!70943
parents 23bb155b fe0df34d
...@@ -15,7 +15,7 @@ export default { ...@@ -15,7 +15,7 @@ export default {
return protectedBranch?.name || __('All branches'); return protectedBranch?.name || __('All branches');
}, },
isAllBranches() { isAllBranches() {
return this.rule.protectedBranches?.length; return !this.rule.protectedBranches?.length;
}, },
}, },
}; };
......
...@@ -22,9 +22,12 @@ describe('Rule Branches', () => { ...@@ -22,9 +22,12 @@ describe('Rule Branches', () => {
wrapper = null; wrapper = null;
}); });
const findBranch = () => wrapper.find('div');
it('displays "All branches" if there are no protected branches', () => { it('displays "All branches" if there are no protected branches', () => {
createComponent(); createComponent();
expect(wrapper.text()).toContain('All branches'); expect(findBranch().text()).toContain('All branches');
expect(findBranch().classes('monospace')).toBe(true);
}); });
it('displays the branch name of the first protected branch', () => { it('displays the branch name of the first protected branch', () => {
...@@ -45,7 +48,8 @@ describe('Rule Branches', () => { ...@@ -45,7 +48,8 @@ describe('Rule Branches', () => {
rule, rule,
}); });
expect(wrapper.text()).toContain('main'); expect(findBranch().text()).toContain('main');
expect(wrapper.text()).not.toContain('hello'); expect(findBranch().text()).not.toContain('hello');
expect(findBranch().classes('monospace')).toBe(false);
}); });
}); });
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