diff options
Diffstat (limited to 'spec/frontend/import_entities/import_groups/components/import_table_spec.js')
-rw-r--r-- | spec/frontend/import_entities/import_groups/components/import_table_spec.js | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/spec/frontend/import_entities/import_groups/components/import_table_spec.js b/spec/frontend/import_entities/import_groups/components/import_table_spec.js index 0279ad454d2..cdc508a0033 100644 --- a/spec/frontend/import_entities/import_groups/components/import_table_spec.js +++ b/spec/frontend/import_entities/import_groups/components/import_table_spec.js @@ -50,13 +50,13 @@ describe('import table', () => { const findPaginationDropdownText = () => findPaginationDropdown().find('button').text(); const findSelectionCount = () => wrapper.find('[data-test-id="selection-count"]'); - const triggerSelectAllCheckbox = () => - wrapper.find('thead input[type=checkbox]').trigger('click'); + const triggerSelectAllCheckbox = (checked = true) => + wrapper.find('thead input[type=checkbox]').setChecked(checked); const selectRow = (idx) => - wrapper.findAll('tbody td input[type=checkbox]').at(idx).trigger('click'); + wrapper.findAll('tbody td input[type=checkbox]').at(idx).setChecked(true); - const createComponent = ({ bulkImportSourceGroups, importGroups }) => { + const createComponent = ({ bulkImportSourceGroups, importGroups, defaultTargetNamespace }) => { apolloProvider = createMockApollo([], { Query: { availableNamespaces: () => availableNamespacesFixture, @@ -73,6 +73,7 @@ describe('import table', () => { jobsPath: '/fake_job_path', sourceUrl: SOURCE_URL, historyPath: '/fake_history_path', + defaultTargetNamespace, }, apolloProvider, }); @@ -165,6 +166,27 @@ describe('import table', () => { expect(targetNamespaceDropdownButton.text()).toBe('No parent'); }); + it('respects default namespace if provided', async () => { + const targetNamespace = availableNamespacesFixture[1]; + + createComponent({ + bulkImportSourceGroups: () => ({ + nodes: FAKE_GROUPS, + pageInfo: FAKE_PAGE_INFO, + versionValidation: FAKE_VERSION_VALIDATION, + }), + defaultTargetNamespace: targetNamespace.id, + }); + + await waitForPromises(); + + const firstRow = wrapper.find('tbody tr'); + const targetNamespaceDropdownButton = findTargetNamespaceDropdown(firstRow).find( + '[aria-haspopup]', + ); + expect(targetNamespaceDropdownButton.text()).toBe(targetNamespace.fullPath); + }); + it('does not render status string when result list is empty', async () => { createComponent({ bulkImportSourceGroups: jest.fn().mockResolvedValue({ @@ -388,7 +410,7 @@ describe('import table', () => { expect(findSelectionCount().text()).toMatchInterpolatedText('0 selected'); await triggerSelectAllCheckbox(); expect(findSelectionCount().text()).toMatchInterpolatedText('2 selected'); - await triggerSelectAllCheckbox(); + await triggerSelectAllCheckbox(false); expect(findSelectionCount().text()).toMatchInterpolatedText('0 selected'); }); |