summaryrefslogtreecommitdiff
path: root/spec/frontend/import_entities/import_groups
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-07-20 15:40:28 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-07-20 15:40:28 +0000
commitb595cb0c1dec83de5bdee18284abe86614bed33b (patch)
tree8c3d4540f193c5ff98019352f554e921b3a41a72 /spec/frontend/import_entities/import_groups
parent2f9104a328fc8a4bddeaa4627b595166d24671d0 (diff)
downloadgitlab-ce-b595cb0c1dec83de5bdee18284abe86614bed33b.tar.gz
Add latest changes from gitlab-org/gitlab@15-2-stable-eev15.2.0-rc42
Diffstat (limited to 'spec/frontend/import_entities/import_groups')
-rw-r--r--spec/frontend/import_entities/import_groups/components/import_table_spec.js32
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');
});