diff --git a/contentcuration/contentcuration/frontend/administration/pages/Users/EmailUsersDialog.vue b/contentcuration/contentcuration/frontend/administration/pages/Users/EmailUsersDialog.vue index 95aed56196..b01d127bf7 100644 --- a/contentcuration/contentcuration/frontend/administration/pages/Users/EmailUsersDialog.vue +++ b/contentcuration/contentcuration/frontend/administration/pages/Users/EmailUsersDialog.vue @@ -1,148 +1,129 @@ + + + {{ searchString }} + - + +
+ Add placeholder to message +
+
+ +
+ + + + + + +

Draft will be lost upon exiting this editor. Are you sure you want to continue?

+
+ @@ -150,15 +131,22 @@ + + + diff --git a/contentcuration/contentcuration/frontend/shared/views/__tests__/StudioChip.spec.js b/contentcuration/contentcuration/frontend/shared/views/__tests__/StudioChip.spec.js new file mode 100644 index 0000000000..efc172b6a2 --- /dev/null +++ b/contentcuration/contentcuration/frontend/shared/views/__tests__/StudioChip.spec.js @@ -0,0 +1,44 @@ +import { render, screen } from '@testing-library/vue'; +import userEvent from '@testing-library/user-event'; +import VueRouter from 'vue-router'; +import StudioChip from '../StudioChip.vue'; + +const mockRouter = new VueRouter(); + +const renderComponent = (props = {}) => { + const defaultProps = { + text: 'Test Chip', + close: false, + ...props, + }; + + return render(StudioChip, { + props: defaultProps, + routes: mockRouter, + }); +}; + +describe('StudioChip', () => { + test('renders with text prop', () => { + renderComponent({ text: 'Test Chip' }); + expect(screen.getByText('Test Chip')).toBeInTheDocument(); + }); + + test('renders close button when close prop is true', () => { + renderComponent({ close: true }); + expect(screen.getByRole('button', { name: 'Remove Test Chip' })).toBeInTheDocument(); + }); + + test('does not render close button when close prop is false', () => { + renderComponent({ close: false }); + expect(screen.queryByRole('button', { name: 'Remove Test Chip' })).not.toBeInTheDocument(); + }); + + test('emits close event when close button is clicked', async () => { + const user = userEvent.setup(); + const { emitted } = renderComponent({ close: true }); + + await user.click(screen.getByRole('button', { name: 'Remove Test Chip' })); + expect(emitted().close).toHaveLength(1); + }); +});