Commit af5de43f authored by Tom Quirk's avatar Tom Quirk

Add slot to delete button

And add tests for this, and default icon
parent 688e2042
...@@ -98,6 +98,7 @@ export default { ...@@ -98,6 +98,7 @@ export default {
:loading="loading" :loading="loading"
:icon="buttonIcon" :icon="buttonIcon"
:disabled="isDeleting || !hasSelectedDesigns" :disabled="isDeleting || !hasSelectedDesigns"
/> ><slot></slot
></gl-button>
</div> </div>
</template> </template>
---
title: Fix design management Archive Selected button label
merge_request: 40325
author:
type: fixed
...@@ -8,7 +8,7 @@ describe('Batch delete button component', () => { ...@@ -8,7 +8,7 @@ describe('Batch delete button component', () => {
const findButton = () => wrapper.find(GlButton); const findButton = () => wrapper.find(GlButton);
const findModal = () => wrapper.find(GlModal); const findModal = () => wrapper.find(GlModal);
function createComponent(isDeleting = false) { function createComponent({ isDeleting = false } = {}, { slots = {} } = {}) {
wrapper = shallowMount(BatchDeleteButton, { wrapper = shallowMount(BatchDeleteButton, {
propsData: { propsData: {
isDeleting, isDeleting,
...@@ -16,6 +16,7 @@ describe('Batch delete button component', () => { ...@@ -16,6 +16,7 @@ describe('Batch delete button component', () => {
directives: { directives: {
GlModalDirective, GlModalDirective,
}, },
slots,
}); });
} }
...@@ -31,7 +32,7 @@ describe('Batch delete button component', () => { ...@@ -31,7 +32,7 @@ describe('Batch delete button component', () => {
}); });
it('renders disabled button when design is deleting', () => { it('renders disabled button when design is deleting', () => {
createComponent(true); createComponent({ isDeleting: true });
expect(findButton().attributes('disabled')).toBeTruthy(); expect(findButton().attributes('disabled')).toBeTruthy();
}); });
...@@ -48,4 +49,18 @@ describe('Batch delete button component', () => { ...@@ -48,4 +49,18 @@ describe('Batch delete button component', () => {
expect(wrapper.emitted().deleteSelectedDesigns).toBeTruthy(); expect(wrapper.emitted().deleteSelectedDesigns).toBeTruthy();
}); });
}); });
it('renders slot content', () => {
const testText = 'Archive selected';
createComponent(
{},
{
slots: {
default: testText,
},
},
);
expect(findButton().text()).toBe(testText);
});
}); });
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