Commit db4f38e1 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch 'gl-modal-action-update' into 'master'

Update gl-modal action buttons in user status modal

See merge request gitlab-org/gitlab!59460
parents 96a9c5a9 3ca36aec
...@@ -236,6 +236,8 @@ export default { ...@@ -236,6 +236,8 @@ export default {
}, },
statusTimeRanges, statusTimeRanges,
safeHtmlConfig: { ADD_TAGS: ['gl-emoji'] }, safeHtmlConfig: { ADD_TAGS: ['gl-emoji'] },
actionPrimary: { text: s__('SetStatusModal|Set status') },
actionSecondary: { text: s__('SetStatusModal|Remove status') },
}; };
</script> </script>
...@@ -243,14 +245,13 @@ export default { ...@@ -243,14 +245,13 @@ export default {
<gl-modal <gl-modal
:title="s__('SetStatusModal|Set a status')" :title="s__('SetStatusModal|Set a status')"
:modal-id="modalId" :modal-id="modalId"
:ok-title="s__('SetStatusModal|Set status')" :action-primary="$options.actionPrimary"
:cancel-title="s__('SetStatusModal|Remove status')" :action-secondary="$options.actionSecondary"
ok-variant="success"
modal-class="set-user-status-modal" modal-class="set-user-status-modal"
@shown="setupEmojiListAndAutocomplete" @shown="setupEmojiListAndAutocomplete"
@hide="hideEmojiMenu" @hide="hideEmojiMenu"
@ok="setStatus" @primary="setStatus"
@cancel="removeStatus" @secondary="removeStatus"
> >
<div> <div>
<input <input
......
...@@ -198,7 +198,7 @@ describe('SetStatusModalWrapper', () => { ...@@ -198,7 +198,7 @@ describe('SetStatusModalWrapper', () => {
}); });
it('clicking "removeStatus" clears the emoji and message fields', async () => { it('clicking "removeStatus" clears the emoji and message fields', async () => {
findModal().vm.$emit('cancel'); findModal().vm.$emit('secondary');
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(findFormField('message').element.value).toBe(''); expect(findFormField('message').element.value).toBe('');
...@@ -206,7 +206,7 @@ describe('SetStatusModalWrapper', () => { ...@@ -206,7 +206,7 @@ describe('SetStatusModalWrapper', () => {
}); });
it('clicking "setStatus" submits the user status', async () => { it('clicking "setStatus" submits the user status', async () => {
findModal().vm.$emit('ok'); findModal().vm.$emit('primary');
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
// set the availability status // set the availability status
...@@ -215,7 +215,7 @@ describe('SetStatusModalWrapper', () => { ...@@ -215,7 +215,7 @@ describe('SetStatusModalWrapper', () => {
// set the currentClearStatusAfter to 30 minutes // set the currentClearStatusAfter to 30 minutes
wrapper.find('[data-testid="thirtyMinutes"]').vm.$emit('click'); wrapper.find('[data-testid="thirtyMinutes"]').vm.$emit('click');
findModal().vm.$emit('ok'); findModal().vm.$emit('primary');
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
const commonParams = { const commonParams = {
...@@ -237,7 +237,7 @@ describe('SetStatusModalWrapper', () => { ...@@ -237,7 +237,7 @@ describe('SetStatusModalWrapper', () => {
}); });
it('calls the "onUpdateSuccess" handler', async () => { it('calls the "onUpdateSuccess" handler', async () => {
findModal().vm.$emit('ok'); findModal().vm.$emit('primary');
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(wrapper.vm.onUpdateSuccess).toHaveBeenCalled(); expect(wrapper.vm.onUpdateSuccess).toHaveBeenCalled();
...@@ -253,7 +253,7 @@ describe('SetStatusModalWrapper', () => { ...@@ -253,7 +253,7 @@ describe('SetStatusModalWrapper', () => {
}); });
it('displays a toast success message', async () => { it('displays a toast success message', async () => {
findModal().vm.$emit('ok'); findModal().vm.$emit('primary');
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect($toast.show).toHaveBeenCalledWith('Status updated'); expect($toast.show).toHaveBeenCalledWith('Status updated');
...@@ -270,7 +270,7 @@ describe('SetStatusModalWrapper', () => { ...@@ -270,7 +270,7 @@ describe('SetStatusModalWrapper', () => {
}); });
it('calls the "onUpdateFail" handler', async () => { it('calls the "onUpdateFail" handler', async () => {
findModal().vm.$emit('ok'); findModal().vm.$emit('primary');
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(wrapper.vm.onUpdateFail).toHaveBeenCalled(); expect(wrapper.vm.onUpdateFail).toHaveBeenCalled();
...@@ -286,7 +286,7 @@ describe('SetStatusModalWrapper', () => { ...@@ -286,7 +286,7 @@ describe('SetStatusModalWrapper', () => {
}); });
it('flashes an error message', async () => { it('flashes an error message', async () => {
findModal().vm.$emit('ok'); findModal().vm.$emit('primary');
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(createFlash).toHaveBeenCalledWith({ expect(createFlash).toHaveBeenCalledWith({
......
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