Commit 1ec67ecd authored by eugielimpin's avatar eugielimpin Committed by Douglas Barbosa Alexandre

Disable the dropdown instead of not showing it

To make the screen more stable. This prevents the tabs from being
pushed down when the dropdown is rendered and making the popover
anchor wrong.
parent 2ab23a78
...@@ -112,7 +112,7 @@ export default { ...@@ -112,7 +112,7 @@ export default {
isBranchesLoading() { isBranchesLoading() {
return this.$apollo.queries.availableBranches.loading || this.isSearchingBranches; return this.$apollo.queries.availableBranches.loading || this.isSearchingBranches;
}, },
showBranchSwitcher() { enableBranchSwitcher() {
return this.branches.length > 0 || this.searchTerm.length > 0; return this.branches.length > 0 || this.searchTerm.length > 0;
}, },
}, },
...@@ -230,11 +230,11 @@ export default { ...@@ -230,11 +230,11 @@ export default {
<template> <template>
<gl-dropdown <gl-dropdown
v-if="showBranchSwitcher"
v-gl-tooltip.hover v-gl-tooltip.hover
:title="$options.i18n.dropdownHeader" :title="$options.i18n.dropdownHeader"
:header-text="$options.i18n.dropdownHeader" :header-text="$options.i18n.dropdownHeader"
:text="currentBranch" :text="currentBranch"
:disabled="!enableBranchSwitcher"
icon="branch" icon="branch"
data-qa-selector="branch_selector_button" data-qa-selector="branch_selector_button"
data-testid="branch-selector" data-testid="branch-selector"
......
...@@ -141,8 +141,8 @@ describe('Pipeline editor branch switcher', () => { ...@@ -141,8 +141,8 @@ describe('Pipeline editor branch switcher', () => {
createComponentWithApollo(); createComponentWithApollo();
}); });
it('does not render dropdown', () => { it('disables the dropdown', () => {
expect(findDropdown().exists()).toBe(false); expect(findDropdown().props('disabled')).toBe(true);
}); });
}); });
...@@ -189,7 +189,7 @@ describe('Pipeline editor branch switcher', () => { ...@@ -189,7 +189,7 @@ describe('Pipeline editor branch switcher', () => {
}); });
it('does not render dropdown', () => { it('does not render dropdown', () => {
expect(findDropdown().exists()).toBe(false); expect(findDropdown().props('disabled')).toBe(true);
}); });
it('shows an error message', () => { it('shows an error message', () => {
......
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