Commit 4501eb59 authored by Tom Quirk's avatar Tom Quirk Committed by Paul Slaughter

Minor style improvements to design management

- align buttons in widget/design header
- simplify DOM by removing unnecessary nesting of DOM elements
- use data-testid where possible
parent 5c89c788
...@@ -73,21 +73,19 @@ export default { ...@@ -73,21 +73,19 @@ export default {
</script> </script>
<template> <template>
<div class="gl-display-flex gl-align-items-center gl-h-full"> <div>
<gl-modal <gl-modal
:modal-id="modalId" :modal-id="modalId"
:title="$options.modal.title" :title="$options.modal.title"
:action-primary="$options.modal.actionPrimary" :action-primary="$options.modal.actionPrimary"
:action-cancel="$options.modal.actionCancel" :action-cancel="$options.modal.actionCancel"
@ok="$emit('deleteSelectedDesigns')" @ok="$emit('delete-selected-designs')"
> >
<p> {{
{{ s__(
s__( 'DesignManagement|Archived designs will still be available in previous versions of the design collection.',
'DesignManagement|Archived designs will still be available in previous versions of the design collection.', )
) }}
}}
</p>
</gl-modal> </gl-modal>
<gl-button <gl-button
v-gl-modal-directive="modalId" v-gl-modal-directive="modalId"
......
...@@ -55,6 +55,7 @@ export default { ...@@ -55,6 +55,7 @@ export default {
iid, iid,
}" }"
:update="updateStoreAfterDelete" :update="updateStoreAfterDelete"
:tag="null"
v-on="$listeners" v-on="$listeners"
> >
<slot v-bind="{ mutate, loading, error }"></slot> <slot v-bind="{ mutate, loading, error }"></slot>
......
...@@ -130,7 +130,7 @@ export default { ...@@ -130,7 +130,7 @@ export default {
button-icon="archive" button-icon="archive"
button-category="secondary" button-category="secondary"
:title="s__('DesignManagement|Archive design')" :title="s__('DesignManagement|Archive design')"
@deleteSelectedDesigns="$emit('delete')" @delete-selected-designs="$emit('delete')"
/> />
</header> </header>
</template> </template>
...@@ -50,7 +50,7 @@ export default { ...@@ -50,7 +50,7 @@ export default {
type="file" type="file"
name="design_file" name="design_file"
:accept="$options.VALID_DESIGN_FILE_MIMETYPE.mimetype" :accept="$options.VALID_DESIGN_FILE_MIMETYPE.mimetype"
class="hide" class="gl-display-none"
multiple multiple
@change="onFileUploadChange" @change="onFileUploadChange"
/> />
......
...@@ -365,7 +365,8 @@ export default { ...@@ -365,7 +365,8 @@ export default {
v-if="isLatestVersion" v-if="isLatestVersion"
variant="link" variant="link"
size="small" size="small"
class="gl-mr-4 js-select-all" class="gl-mr-3"
data-testid="select-all-designs-button"
@click="toggleDesignsSelection" @click="toggleDesignsSelection"
>{{ selectAllButtonText }} >{{ selectAllButtonText }}
</gl-button> </gl-button>
...@@ -385,7 +386,7 @@ export default { ...@@ -385,7 +386,7 @@ export default {
data-qa-selector="archive_button" data-qa-selector="archive_button"
:loading="loading" :loading="loading"
:has-selected-designs="hasSelectedDesigns" :has-selected-designs="hasSelectedDesigns"
@deleteSelectedDesigns="mutate()" @delete-selected-designs="mutate()"
> >
{{ s__('DesignManagement|Archive selected') }} {{ s__('DesignManagement|Archive selected') }}
</delete-button> </delete-button>
......
---
title: Fix button alignment in design management header
merge_request: 48003
author:
type: fixed
...@@ -36,7 +36,7 @@ describe('Batch delete button component', () => { ...@@ -36,7 +36,7 @@ describe('Batch delete button component', () => {
expect(findButton().attributes('disabled')).toBeTruthy(); expect(findButton().attributes('disabled')).toBeTruthy();
}); });
it('emits `deleteSelectedDesigns` event on modal ok click', () => { it('emits `delete-selected-designs` event on modal ok click', () => {
createComponent(); createComponent();
findButton().vm.$emit('click'); findButton().vm.$emit('click');
return wrapper.vm return wrapper.vm
...@@ -46,7 +46,7 @@ describe('Batch delete button component', () => { ...@@ -46,7 +46,7 @@ describe('Batch delete button component', () => {
return wrapper.vm.$nextTick(); return wrapper.vm.$nextTick();
}) })
.then(() => { .then(() => {
expect(wrapper.emitted().deleteSelectedDesigns).toBeTruthy(); expect(wrapper.emitted('delete-selected-designs')).toBeTruthy();
}); });
}); });
......
...@@ -106,11 +106,11 @@ describe('Design management toolbar component', () => { ...@@ -106,11 +106,11 @@ describe('Design management toolbar component', () => {
}); });
}); });
it('emits `delete` event on deleteButton `deleteSelectedDesigns` event', () => { it('emits `delete` event on deleteButton `delete-selected-designs` event', () => {
createComponent(); createComponent();
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
wrapper.find(DeleteButton).vm.$emit('deleteSelectedDesigns'); wrapper.find(DeleteButton).vm.$emit('delete-selected-designs');
expect(wrapper.emitted().delete).toBeTruthy(); expect(wrapper.emitted().delete).toBeTruthy();
}); });
}); });
......
...@@ -19,7 +19,7 @@ exports[`Design management upload button component renders inverted upload desig ...@@ -19,7 +19,7 @@ exports[`Design management upload button component renders inverted upload desig
<input <input
accept="image/*" accept="image/*"
class="hide" class="gl-display-none"
multiple="multiple" multiple="multiple"
name="design_file" name="design_file"
type="file" type="file"
...@@ -44,7 +44,7 @@ exports[`Design management upload button component renders upload design button ...@@ -44,7 +44,7 @@ exports[`Design management upload button component renders upload design button
<input <input
accept="image/*" accept="image/*"
class="hide" class="gl-display-none"
multiple="multiple" multiple="multiple"
name="design_file" name="design_file"
type="file" type="file"
......
...@@ -97,7 +97,7 @@ describe('Design management index page', () => { ...@@ -97,7 +97,7 @@ describe('Design management index page', () => {
let moveDesignHandler; let moveDesignHandler;
const findDesignCheckboxes = () => wrapper.findAll('.design-checkbox'); const findDesignCheckboxes = () => wrapper.findAll('.design-checkbox');
const findSelectAllButton = () => wrapper.find('.js-select-all'); const findSelectAllButton = () => wrapper.find('[data-testid="select-all-designs-button"');
const findToolbar = () => wrapper.find('.qa-selector-toolbar'); const findToolbar = () => wrapper.find('.qa-selector-toolbar');
const findDesignCollectionIsCopying = () => const findDesignCollectionIsCopying = () =>
wrapper.find('[data-testid="design-collection-is-copying"'); wrapper.find('[data-testid="design-collection-is-copying"');
...@@ -542,7 +542,9 @@ describe('Design management index page', () => { ...@@ -542,7 +542,9 @@ describe('Design management index page', () => {
await nextTick(); await nextTick();
expect(findDeleteButton().exists()).toBe(true); expect(findDeleteButton().exists()).toBe(true);
expect(findSelectAllButton().text()).toBe('Deselect all'); expect(findSelectAllButton().text()).toBe('Deselect all');
findDeleteButton().vm.$emit('deleteSelectedDesigns');
findDeleteButton().vm.$emit('delete-selected-designs');
const [{ variables }] = mutate.mock.calls[0]; const [{ variables }] = mutate.mock.calls[0];
expect(variables.filenames).toStrictEqual([mockDesigns[0].filename, mockDesigns[1].filename]); expect(variables.filenames).toStrictEqual([mockDesigns[0].filename, mockDesigns[1].filename]);
}); });
......
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