mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 11:01:15 +00:00
refactor(editor): Move editor-ui and design-system to frontend dir (no-changelog) (#13564)
This commit is contained in:
@@ -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();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user