feat(editor): VariablesView Reskin - Add Filters for missing values (#12611)

This commit is contained in:
Raúl Gómez Morales
2025-01-20 10:59:15 +01:00
committed by GitHub
parent 652b8d170b
commit 1eeb788d32
16 changed files with 832 additions and 841 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);
});
});