Commit 5f3c30cf authored by Illya Klymov's avatar Illya Klymov

Merge branch '320838-vulnerability-status-dropdown-actions-should-not-scroll' into 'master'

Move action buttons to footer

See merge request gitlab-org/gitlab!54767
parents 699bf74a 911e1201
...@@ -83,18 +83,20 @@ export default { ...@@ -83,18 +83,20 @@ export default {
<div class="pl-4">{{ stateItem.description }}</div> <div class="pl-4">{{ stateItem.description }}</div>
</li> </li>
<div class="text-right p-3"> <template #footer>
<gl-button ref="cancel-button" class="mr-2" @click="closeDropdown"> <div class="gl-text-right gl-px-3">
{{ __('Cancel') }} <gl-button ref="cancel-button" class="mr-2" @click="closeDropdown">
</gl-button> {{ __('Cancel') }}
<gl-button </gl-button>
ref="save-button" <gl-button
variant="success" ref="save-button"
:disabled="selected === initialStateItem" variant="success"
@click="saveState(selected)" :disabled="selected === initialStateItem"
> @click="saveState(selected)"
{{ s__('VulnerabilityManagement|Change status') }} >
</gl-button> {{ s__('VulnerabilityManagement|Change status') }}
</div> </gl-button>
</div>
</template>
</gl-dropdown> </gl-dropdown>
</template> </template>
---
title: Move action buttons to dropdown footer
merge_request: 54767
author:
type: fixed
import { GlDropdown } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import VulnerabilityStateDropdown from 'ee/vulnerabilities/components/vulnerability_state_dropdown.vue'; import VulnerabilityStateDropdown from 'ee/vulnerabilities/components/vulnerability_state_dropdown.vue';
import { VULNERABILITY_STATE_OBJECTS } from 'ee/vulnerabilities/constants'; import { VULNERABILITY_STATE_OBJECTS } from 'ee/vulnerabilities/constants';
...@@ -11,6 +12,9 @@ describe('Vulnerability state dropdown component', () => { ...@@ -11,6 +12,9 @@ describe('Vulnerability state dropdown component', () => {
// Create a dropdown that by default has the first vulnerability state selected. // Create a dropdown that by default has the first vulnerability state selected.
wrapper = shallowMount(VulnerabilityStateDropdown, { wrapper = shallowMount(VulnerabilityStateDropdown, {
propsData: { initialState }, propsData: { initialState },
stubs: {
GlDropdown,
},
}); });
// Mock out this function, it's called by some methods in the component. // Mock out this function, it's called by some methods in the component.
...@@ -142,7 +146,7 @@ describe('Vulnerability state dropdown component', () => { ...@@ -142,7 +146,7 @@ describe('Vulnerability state dropdown component', () => {
wrapper.setProps({ initialState: stateString }); // Change the state. wrapper.setProps({ initialState: stateString }); // Change the state.
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect(innerDropdown().attributes('text')).toBe(stateString); // Check that the dropdown button's value matches the initial state. expect(innerDropdown().props('text')).toBe(stateString); // Check that the dropdown button's value matches the initial state.
expect(selectedItem().text()).toMatch(new RegExp(`^${stateObject.action}`, 'i')); // Check that the selected item is the initial state. expect(selectedItem().text()).toMatch(new RegExp(`^${stateObject.action}`, 'i')); // Check that the selected item is the initial state.
expect(isDisabled(saveButton())).toBe(true); // Check that the save button is disabled. expect(isDisabled(saveButton())).toBe(true); // Check that the save button is disabled.
}); });
......
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