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,52 @@
import ChatEmbedModal from '@/components/ChatEmbedModal.vue';
import { createTestingPinia } from '@pinia/testing';
import { CHAT_EMBED_MODAL_KEY, STORES, WEBHOOK_NODE_TYPE } from '@/constants';
import { createComponentRenderer } from '@/__tests__/render';
import { waitFor } from '@testing-library/vue';
import { cleanupAppModals, createAppModals } from '@/__tests__/utils';
const renderComponent = createComponentRenderer(ChatEmbedModal, {
props: {
teleported: false,
appendToBody: false,
},
pinia: createTestingPinia({
initialState: {
[STORES.UI]: {
modalsById: {
[CHAT_EMBED_MODAL_KEY]: { open: true },
},
},
[STORES.WORKFLOWS]: {
workflow: {
nodes: [{ type: WEBHOOK_NODE_TYPE }],
},
},
},
}),
});
describe('ChatEmbedModal', () => {
beforeEach(() => {
createAppModals();
});
afterEach(() => {
cleanupAppModals();
});
it('should render correctly', async () => {
const { getByTestId } = renderComponent();
await waitFor(() => expect(getByTestId('chatEmbed-modal')).toBeInTheDocument());
const modalContainer = getByTestId('chatEmbed-modal');
const tabs = modalContainer.querySelectorAll('.n8n-tabs .tab');
const activeTab = modalContainer.querySelector('.n8n-tabs .tab.activeTab');
const editor = modalContainer.querySelector('.cm-editor');
expect(tabs).toHaveLength(4);
expect(activeTab).toBeVisible();
expect(activeTab).toHaveTextContent('CDN Embed');
expect(editor).toBeVisible();
});
});