refactor(editor): Move editor-ui and design-system to frontend dir (no-changelog) (#13564)

This commit is contained in:
Alex Grozav
2025-02-28 14:28:30 +02:00
committed by GitHub
parent 684353436d
commit f5743176e5
1635 changed files with 805 additions and 1079 deletions

View File

@@ -0,0 +1,31 @@
import { createComponentRenderer } from '@/__tests__/render';
import VariablesUsageBadge from './VariablesUsageBadge.vue';
import userEvent from '@testing-library/user-event';
const renderComponent = createComponentRenderer(VariablesUsageBadge);
const showMessage = vi.fn();
vi.mock('@/composables/useToast', () => ({
useToast: () => ({ showMessage }),
}));
const copy = vi.fn();
vi.mock('@/composables/useClipboard', () => ({
useClipboard: () => ({ copy }),
}));
describe('VariablesUsageBadge', () => {
afterEach(() => {
vi.clearAllMocks();
});
it('should copy to the clipboard', async () => {
const name = 'myVar';
const output = `$vars.${name}`;
const { getByText } = renderComponent({ props: { name } });
await userEvent.click(getByText(output));
expect(showMessage).toHaveBeenCalledWith(expect.objectContaining({ type: 'success' }));
expect(copy).toHaveBeenCalledWith(output);
});
});