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