summaryrefslogtreecommitdiff
path: root/spec/frontend/pages
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-09-20 13:18:24 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-09-20 13:18:24 +0000
commit0653e08efd039a5905f3fa4f6e9cef9f5d2f799c (patch)
tree4dcc884cf6d81db44adae4aa99f8ec1233a41f55 /spec/frontend/pages
parent744144d28e3e7fddc117924fef88de5d9674fe4c (diff)
downloadgitlab-ce-0653e08efd039a5905f3fa4f6e9cef9f5d2f799c.tar.gz
Add latest changes from gitlab-org/gitlab@14-3-stable-eev14.3.0-rc42
Diffstat (limited to 'spec/frontend/pages')
-rw-r--r--spec/frontend/pages/dashboard/projects/index/components/customize_homepage_banner_spec.js2
-rw-r--r--spec/frontend/pages/projects/graphs/__snapshots__/code_coverage_spec.js.snap4
-rw-r--r--spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_b_spec.js.snap604
-rw-r--r--spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_spec.js.snap (renamed from spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_a_spec.js.snap)16
-rw-r--r--spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_b_spec.js38
-rw-r--r--spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_spec.js (renamed from spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_a_spec.js)6
-rw-r--r--spec/frontend/pages/projects/new/components/new_project_url_select_spec.js122
-rw-r--r--spec/frontend/pages/projects/pipeline_schedules/shared/components/interval_pattern_input_spec.js5
-rw-r--r--spec/frontend/pages/sessions/new/signin_tabs_memoizer_spec.js4
9 files changed, 140 insertions, 661 deletions
diff --git a/spec/frontend/pages/dashboard/projects/index/components/customize_homepage_banner_spec.js b/spec/frontend/pages/dashboard/projects/index/components/customize_homepage_banner_spec.js
index 63c1260560b..f84800d8266 100644
--- a/spec/frontend/pages/dashboard/projects/index/components/customize_homepage_banner_spec.js
+++ b/spec/frontend/pages/dashboard/projects/index/components/customize_homepage_banner_spec.js
@@ -65,7 +65,7 @@ describe('CustomizeHomepageBanner', () => {
await wrapper.vm.$nextTick();
const button = wrapper.find(`[href='${wrapper.vm.preferencesBehaviorPath}']`);
- expect(button.attributes('data-track-event')).toEqual(preferencesTrackingEvent);
+ expect(button.attributes('data-track-action')).toEqual(preferencesTrackingEvent);
expect(button.attributes('data-track-label')).toEqual(provide.trackLabel);
});
diff --git a/spec/frontend/pages/projects/graphs/__snapshots__/code_coverage_spec.js.snap b/spec/frontend/pages/projects/graphs/__snapshots__/code_coverage_spec.js.snap
index 4ba9120d196..417567c9f4c 100644
--- a/spec/frontend/pages/projects/graphs/__snapshots__/code_coverage_spec.js.snap
+++ b/spec/frontend/pages/projects/graphs/__snapshots__/code_coverage_spec.js.snap
@@ -11,8 +11,12 @@ exports[`Code Coverage when fetching data is successful matches the snapshot 1`]
<gl-dropdown-stub
category="primary"
+ clearalltext="Clear all"
headertext=""
hideheaderborder="true"
+ highlighteditemstitle="Selected"
+ highlighteditemstitleclass="gl-px-5"
+ showhighlighteditemstitle="true"
size="medium"
text="rspec"
variant="default"
diff --git a/spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_b_spec.js.snap b/spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_b_spec.js.snap
deleted file mode 100644
index 091edc7505c..00000000000
--- a/spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_b_spec.js.snap
+++ /dev/null
@@ -1,604 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Learn GitLab Design B renders correctly 1`] = `
-<div>
- <div
- class="row"
- >
- <div
- class="gl-mb-7 col-md-8 col-lg-7"
- >
- <h1
- class="gl-font-size-h1"
- >
- Learn GitLab
- </h1>
-
- <p
- class="gl-text-gray-700 gl-mb-0"
- >
- Ready to get started with GitLab? Follow these steps to set up your workspace, plan and commit changes, and deploy your project.
- </p>
- </div>
- </div>
-
- <div
- class="gl-mb-3"
- >
- <p
- class="gl-text-gray-500 gl-mb-2"
- data-testid="completion-percentage"
- >
- 22% completed
- </p>
-
- <div
- class="progress"
- max="9"
- value="2"
- >
- <div
- aria-valuemax="9"
- aria-valuemin="0"
- aria-valuenow="2"
- class="progress-bar"
- role="progressbar"
- style="width: 22.22222222222222%;"
- />
- </div>
- </div>
-
- <h2
- class="gl-font-lg gl-mb-3"
- >
- Set up your workspace
- </h2>
-
- <p
- class="gl-text-gray-700 gl-mb-6"
- >
- Complete these tasks first so you can enjoy GitLab's features to their fullest:
- </p>
-
- <div
- class="row row-cols-2 row-cols-md-3 row-cols-lg-4"
- >
- <div
- class="col gl-mb-6"
- >
- <div
- class="gl-card gl-pt-0"
- >
- <!---->
-
- <div
- class="gl-card-body"
- >
- <div
- class="gl-text-right gl-h-5"
- >
- <svg
- aria-hidden="true"
- class="gl-text-green-500 gl-icon s16"
- data-testid="completed-icon"
- role="img"
- >
- <use
- href="#check-circle-filled"
- />
- </svg>
- </div>
-
- <div
- class="gl-text-center gl-display-flex gl-justify-content-center gl-align-items-center gl-flex-direction-column learn-gitlab-info-card-content"
- >
- <img
- alt="Invite your colleagues"
- src="http://example.com/images/illustration.svg"
- />
-
- <h6>
- Invite your colleagues
- </h6>
-
- <p
- class="gl-font-sm gl-text-gray-700"
- >
- GitLab works best as a team. Invite your colleague to enjoy all features.
- </p>
-
- <a
- class="gl-link"
- data-track-action="click_link"
- data-track-label="Invite your colleagues"
- data-track-property="Growth::Activation::Experiment::LearnGitLabB"
- href="http://example.com/"
- rel="noopener noreferrer"
- target="_blank"
- >
- Invite your colleagues
- </a>
- </div>
- </div>
-
- <!---->
- </div>
- </div>
-
- <div
- class="col gl-mb-6"
- >
- <div
- class="gl-card gl-pt-0"
- >
- <!---->
-
- <div
- class="gl-card-body"
- >
- <div
- class="gl-text-right gl-h-5"
- >
- <svg
- aria-hidden="true"
- class="gl-text-green-500 gl-icon s16"
- data-testid="completed-icon"
- role="img"
- >
- <use
- href="#check-circle-filled"
- />
- </svg>
- </div>
-
- <div
- class="gl-text-center gl-display-flex gl-justify-content-center gl-align-items-center gl-flex-direction-column learn-gitlab-info-card-content"
- >
- <img
- alt="Create or import a repository"
- src="http://example.com/images/illustration.svg"
- />
-
- <h6>
- Create or import a repository
- </h6>
-
- <p
- class="gl-font-sm gl-text-gray-700"
- >
- Create or import your first repository into your new project.
- </p>
-
- <a
- class="gl-link"
- data-track-action="click_link"
- data-track-label="Create or import a repository"
- data-track-property="Growth::Activation::Experiment::LearnGitLabB"
- href="http://example.com/"
- rel="noopener noreferrer"
- target="_blank"
- >
- Create or import a repository
- </a>
- </div>
- </div>
-
- <!---->
- </div>
- </div>
-
- <div
- class="col gl-mb-6"
- >
- <div
- class="gl-card gl-pt-0"
- >
- <!---->
-
- <div
- class="gl-card-body"
- >
- <div
- class="gl-text-right gl-h-5"
- >
- <!---->
- </div>
-
- <div
- class="gl-text-center gl-display-flex gl-justify-content-center gl-align-items-center gl-flex-direction-column learn-gitlab-info-card-content"
- >
- <img
- alt="Set-up CI/CD"
- src="http://example.com/images/illustration.svg"
- />
-
- <h6>
- Set up CI/CD
- </h6>
-
- <p
- class="gl-font-sm gl-text-gray-700"
- >
- Save time by automating your integration and deployment tasks.
- </p>
-
- <a
- class="gl-link"
- data-track-action="click_link"
- data-track-label="Set-up CI/CD"
- data-track-property="Growth::Activation::Experiment::LearnGitLabB"
- href="http://example.com/"
- rel="noopener noreferrer"
- target="_blank"
- >
- Set-up CI/CD
- </a>
- </div>
- </div>
-
- <!---->
- </div>
- </div>
-
- <div
- class="col gl-mb-6"
- >
- <div
- class="gl-card gl-pt-0"
- >
- <!---->
-
- <div
- class="gl-card-body"
- >
- <div
- class="gl-text-right gl-h-5"
- >
- <!---->
- </div>
-
- <div
- class="gl-text-center gl-display-flex gl-justify-content-center gl-align-items-center gl-flex-direction-column learn-gitlab-info-card-content"
- >
- <img
- alt="Try GitLab Ultimate for free"
- src="http://example.com/images/illustration.svg"
- />
-
- <h6>
- Start a free Ultimate trial
- </h6>
-
- <p
- class="gl-font-sm gl-text-gray-700"
- >
- Try all GitLab features for 30 days, no credit card required.
- </p>
-
- <a
- class="gl-link"
- data-track-action="click_link"
- data-track-label="Try GitLab Ultimate for free"
- data-track-property="Growth::Activation::Experiment::LearnGitLabB"
- href="http://example.com/"
- rel="noopener noreferrer"
- target="_blank"
- >
- Try GitLab Ultimate for free
- </a>
- </div>
- </div>
-
- <!---->
- </div>
- </div>
-
- <div
- class="col gl-mb-6"
- >
- <div
- class="gl-card gl-pt-0"
- >
- <!---->
-
- <div
- class="gl-card-body"
- >
- <div
- class="gl-text-right gl-h-5"
- >
- <span
- class="gl-text-gray-500 gl-font-sm gl-font-style-italic"
- data-testid="trial-only"
- >
- Trial only
- </span>
- </div>
-
- <div
- class="gl-text-center gl-display-flex gl-justify-content-center gl-align-items-center gl-flex-direction-column learn-gitlab-info-card-content"
- >
- <img
- alt="Add code owners"
- src="http://example.com/images/illustration.svg"
- />
-
- <h6>
- Add code owners
- </h6>
-
- <p
- class="gl-font-sm gl-text-gray-700"
- >
- Prevent unexpected changes to important assets by assigning ownership of files and paths.
- </p>
-
- <a
- class="gl-link"
- data-track-action="click_link"
- data-track-label="Add code owners"
- data-track-property="Growth::Activation::Experiment::LearnGitLabB"
- href="http://example.com/"
- rel="noopener noreferrer"
- target="_blank"
- >
- Add code owners
- </a>
- </div>
- </div>
-
- <!---->
- </div>
- </div>
-
- <div
- class="col gl-mb-6"
- >
- <div
- class="gl-card gl-pt-0"
- >
- <!---->
-
- <div
- class="gl-card-body"
- >
- <div
- class="gl-text-right gl-h-5"
- >
- <span
- class="gl-text-gray-500 gl-font-sm gl-font-style-italic"
- data-testid="trial-only"
- >
- Trial only
- </span>
- </div>
-
- <div
- class="gl-text-center gl-display-flex gl-justify-content-center gl-align-items-center gl-flex-direction-column learn-gitlab-info-card-content"
- >
- <img
- alt="Enable require merge approvals"
- src="http://example.com/images/illustration.svg"
- />
-
- <h6>
- Add merge request approval
- </h6>
-
- <p
- class="gl-font-sm gl-text-gray-700"
- >
- Route code reviews to the right reviewers, every time.
- </p>
-
- <a
- class="gl-link"
- data-track-action="click_link"
- data-track-label="Enable require merge approvals"
- data-track-property="Growth::Activation::Experiment::LearnGitLabB"
- href="http://example.com/"
- rel="noopener noreferrer"
- target="_blank"
- >
- Enable require merge approvals
- </a>
- </div>
- </div>
-
- <!---->
- </div>
- </div>
- </div>
-
- <h2
- class="gl-font-lg gl-mb-3"
- >
- Plan and execute
- </h2>
-
- <p
- class="gl-text-gray-700 gl-mb-6"
- >
- Create a workflow for your new workspace, and learn how GitLab features work together:
- </p>
-
- <div
- class="row row-cols-2 row-cols-md-3 row-cols-lg-4"
- >
- <div
- class="col gl-mb-6"
- >
- <div
- class="gl-card gl-pt-0"
- >
- <!---->
-
- <div
- class="gl-card-body"
- >
- <div
- class="gl-text-right gl-h-5"
- >
- <!---->
- </div>
-
- <div
- class="gl-text-center gl-display-flex gl-justify-content-center gl-align-items-center gl-flex-direction-column learn-gitlab-info-card-content"
- >
- <img
- alt="Create an issue"
- src="http://example.com/images/illustration.svg"
- />
-
- <h6>
- Create an issue
- </h6>
-
- <p
- class="gl-font-sm gl-text-gray-700"
- >
- Create/import issues (tickets) to collaborate on ideas and plan work.
- </p>
-
- <a
- class="gl-link"
- data-track-action="click_link"
- data-track-label="Create an issue"
- data-track-property="Growth::Activation::Experiment::LearnGitLabB"
- href="http://example.com/"
- rel="noopener noreferrer"
- target="_blank"
- >
- Create an issue
- </a>
- </div>
- </div>
-
- <!---->
- </div>
- </div>
-
- <div
- class="col gl-mb-6"
- >
- <div
- class="gl-card gl-pt-0"
- >
- <!---->
-
- <div
- class="gl-card-body"
- >
- <div
- class="gl-text-right gl-h-5"
- >
- <!---->
- </div>
-
- <div
- class="gl-text-center gl-display-flex gl-justify-content-center gl-align-items-center gl-flex-direction-column learn-gitlab-info-card-content"
- >
- <img
- alt="Submit a merge request (MR)"
- src="http://example.com/images/illustration.svg"
- />
-
- <h6>
- Submit a merge request
- </h6>
-
- <p
- class="gl-font-sm gl-text-gray-700"
- >
- Review and edit proposed changes to source code.
- </p>
-
- <a
- class="gl-link"
- data-track-action="click_link"
- data-track-label="Submit a merge request (MR)"
- data-track-property="Growth::Activation::Experiment::LearnGitLabB"
- href="http://example.com/"
- rel="noopener noreferrer"
- target="_blank"
- >
- Submit a merge request (MR)
- </a>
- </div>
- </div>
-
- <!---->
- </div>
- </div>
- </div>
-
- <h2
- class="gl-font-lg gl-mb-3"
- >
- Deploy
- </h2>
-
- <p
- class="gl-text-gray-700 gl-mb-6"
- >
- Use your new GitLab workflow to deploy your application, monitor its health, and keep it secure:
- </p>
-
- <div
- class="row row-cols-2 row-cols-lg-4 g-2 g-lg-3"
- >
- <div
- class="col gl-mb-6"
- >
- <div
- class="gl-card gl-pt-0"
- >
- <!---->
-
- <div
- class="gl-card-body"
- >
- <div
- class="gl-text-right gl-h-5"
- >
- <!---->
- </div>
-
- <div
- class="gl-text-center gl-display-flex gl-justify-content-center gl-align-items-center gl-flex-direction-column learn-gitlab-info-card-content"
- >
- <img
- alt="Run a Security scan using CI/CD"
- src="http://example.com/images/illustration.svg"
- />
-
- <h6>
- Run a Security scan using CI/CD
- </h6>
-
- <p
- class="gl-font-sm gl-text-gray-700"
- >
- Scan your code to uncover vulnerabilities before deploying.
- </p>
-
- <a
- class="gl-link"
- data-track-action="click_link"
- data-track-label="Run a Security scan using CI/CD"
- data-track-property="Growth::Activation::Experiment::LearnGitLabB"
- href="http://example.com/"
- rel="noopener noreferrer"
- target="_blank"
- >
- Run a Security scan using CI/CD
- </a>
- </div>
- </div>
-
- <!---->
- </div>
- </div>
- </div>
-</div>
-`;
diff --git a/spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_a_spec.js.snap b/spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_spec.js.snap
index 59b42de2485..3aa0e99a858 100644
--- a/spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_a_spec.js.snap
+++ b/spec/frontend/pages/projects/learn_gitlab/components/__snapshots__/learn_gitlab_spec.js.snap
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`Learn GitLab Design A renders correctly 1`] = `
+exports[`Learn GitLab renders correctly 1`] = `
<div>
<div
class="row"
@@ -136,7 +136,7 @@ exports[`Learn GitLab Design A renders correctly 1`] = `
class="gl-link"
data-track-action="click_link"
data-track-label="Set up CI/CD"
- data-track-property="Growth::Conversion::Experiment::LearnGitLabA"
+ data-track-property="Growth::Conversion::Experiment::LearnGitLab"
href="http://example.com/"
rel="noopener noreferrer"
target="_blank"
@@ -157,7 +157,7 @@ exports[`Learn GitLab Design A renders correctly 1`] = `
class="gl-link"
data-track-action="click_link"
data-track-label="Start a free Ultimate trial"
- data-track-property="Growth::Conversion::Experiment::LearnGitLabA"
+ data-track-property="Growth::Conversion::Experiment::LearnGitLab"
href="http://example.com/"
rel="noopener noreferrer"
target="_blank"
@@ -178,7 +178,7 @@ exports[`Learn GitLab Design A renders correctly 1`] = `
class="gl-link"
data-track-action="click_link"
data-track-label="Add code owners"
- data-track-property="Growth::Conversion::Experiment::LearnGitLabA"
+ data-track-property="Growth::Conversion::Experiment::LearnGitLab"
href="http://example.com/"
rel="noopener noreferrer"
target="_blank"
@@ -206,7 +206,7 @@ exports[`Learn GitLab Design A renders correctly 1`] = `
class="gl-link"
data-track-action="click_link"
data-track-label="Add merge request approval"
- data-track-property="Growth::Conversion::Experiment::LearnGitLabA"
+ data-track-property="Growth::Conversion::Experiment::LearnGitLab"
href="http://example.com/"
rel="noopener noreferrer"
target="_blank"
@@ -270,7 +270,7 @@ exports[`Learn GitLab Design A renders correctly 1`] = `
class="gl-link"
data-track-action="click_link"
data-track-label="Create an issue"
- data-track-property="Growth::Conversion::Experiment::LearnGitLabA"
+ data-track-property="Growth::Conversion::Experiment::LearnGitLab"
href="http://example.com/"
rel="noopener noreferrer"
target="_blank"
@@ -291,7 +291,7 @@ exports[`Learn GitLab Design A renders correctly 1`] = `
class="gl-link"
data-track-action="click_link"
data-track-label="Submit a merge request"
- data-track-property="Growth::Conversion::Experiment::LearnGitLabA"
+ data-track-property="Growth::Conversion::Experiment::LearnGitLab"
href="http://example.com/"
rel="noopener noreferrer"
target="_blank"
@@ -348,7 +348,7 @@ exports[`Learn GitLab Design A renders correctly 1`] = `
class="gl-link"
data-track-action="click_link"
data-track-label="Run a Security scan using CI/CD"
- data-track-property="Growth::Conversion::Experiment::LearnGitLabA"
+ data-track-property="Growth::Conversion::Experiment::LearnGitLab"
href="http://example.com/"
rel="noopener noreferrer"
target="_blank"
diff --git a/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_b_spec.js b/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_b_spec.js
deleted file mode 100644
index 207944bfa1f..00000000000
--- a/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_b_spec.js
+++ /dev/null
@@ -1,38 +0,0 @@
-import { GlProgressBar } from '@gitlab/ui';
-import { mount } from '@vue/test-utils';
-import LearnGitlabB from '~/pages/projects/learn_gitlab/components/learn_gitlab_b.vue';
-import { testActions } from './mock_data';
-
-describe('Learn GitLab Design B', () => {
- let wrapper;
-
- const createWrapper = () => {
- wrapper = mount(LearnGitlabB, { propsData: { actions: testActions } });
- };
-
- beforeEach(() => {
- createWrapper();
- });
-
- afterEach(() => {
- wrapper.destroy();
- wrapper = null;
- });
-
- it('renders correctly', () => {
- expect(wrapper.element).toMatchSnapshot();
- });
-
- it('renders the progress percentage', () => {
- const text = wrapper.find('[data-testid="completion-percentage"]').text();
-
- expect(text).toBe('22% completed');
- });
-
- it('renders the progress bar with correct values', () => {
- const progressBar = wrapper.findComponent(GlProgressBar);
-
- expect(progressBar.attributes('value')).toBe('2');
- expect(progressBar.attributes('max')).toBe('9');
- });
-});
diff --git a/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_a_spec.js b/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_spec.js
index ac997c1f237..f8099d7e95a 100644
--- a/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_a_spec.js
+++ b/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_spec.js
@@ -1,13 +1,13 @@
import { GlProgressBar } from '@gitlab/ui';
import { mount } from '@vue/test-utils';
-import LearnGitlabA from '~/pages/projects/learn_gitlab/components/learn_gitlab_a.vue';
+import LearnGitlab from '~/pages/projects/learn_gitlab/components/learn_gitlab.vue';
import { testActions, testSections } from './mock_data';
-describe('Learn GitLab Design A', () => {
+describe('Learn GitLab', () => {
let wrapper;
const createWrapper = () => {
- wrapper = mount(LearnGitlabA, { propsData: { actions: testActions, sections: testSections } });
+ wrapper = mount(LearnGitlab, { propsData: { actions: testActions, sections: testSections } });
};
beforeEach(() => {
diff --git a/spec/frontend/pages/projects/new/components/new_project_url_select_spec.js b/spec/frontend/pages/projects/new/components/new_project_url_select_spec.js
new file mode 100644
index 00000000000..8a7f9229503
--- /dev/null
+++ b/spec/frontend/pages/projects/new/components/new_project_url_select_spec.js
@@ -0,0 +1,122 @@
+import { GlButton, GlDropdown, GlDropdownItem, GlDropdownSectionHeader } from '@gitlab/ui';
+import { createLocalVue, mount, shallowMount } from '@vue/test-utils';
+import VueApollo from 'vue-apollo';
+import createMockApollo from 'helpers/mock_apollo_helper';
+import { mockTracking, unmockTracking } from 'helpers/tracking_helper';
+import { getIdFromGraphQLId } from '~/graphql_shared/utils';
+import NewProjectUrlSelect from '~/pages/projects/new/components/new_project_url_select.vue';
+import searchQuery from '~/pages/projects/new/queries/search_namespaces_where_user_can_create_projects.query.graphql';
+
+describe('NewProjectUrlSelect component', () => {
+ let wrapper;
+
+ const data = {
+ currentUser: {
+ groups: {
+ nodes: [
+ {
+ id: 'gid://gitlab/Group/26',
+ fullPath: 'flightjs',
+ },
+ {
+ id: 'gid://gitlab/Group/28',
+ fullPath: 'h5bp',
+ },
+ ],
+ },
+ namespace: {
+ id: 'gid://gitlab/Namespace/1',
+ fullPath: 'root',
+ },
+ },
+ };
+
+ const localVue = createLocalVue();
+ localVue.use(VueApollo);
+
+ const requestHandlers = [[searchQuery, jest.fn().mockResolvedValue({ data })]];
+ const apolloProvider = createMockApollo(requestHandlers);
+
+ const provide = {
+ namespaceFullPath: 'h5bp',
+ namespaceId: '28',
+ rootUrl: 'https://gitlab.com/',
+ trackLabel: 'blank_project',
+ };
+
+ const mountComponent = ({ mountFn = shallowMount } = {}) =>
+ mountFn(NewProjectUrlSelect, { localVue, apolloProvider, provide });
+
+ const findButtonLabel = () => wrapper.findComponent(GlButton);
+ const findDropdown = () => wrapper.findComponent(GlDropdown);
+ const findHiddenInput = () => wrapper.find('input');
+
+ afterEach(() => {
+ wrapper.destroy();
+ });
+
+ it('renders the root url as a label', () => {
+ wrapper = mountComponent();
+
+ expect(findButtonLabel().text()).toBe(provide.rootUrl);
+ expect(findButtonLabel().props('label')).toBe(true);
+ });
+
+ it('renders a dropdown with the initial namespace full path as the text', () => {
+ wrapper = mountComponent();
+
+ expect(findDropdown().props('text')).toBe(provide.namespaceFullPath);
+ });
+
+ it('renders a dropdown with the initial namespace id in the hidden input', () => {
+ wrapper = mountComponent();
+
+ expect(findHiddenInput().attributes('value')).toBe(provide.namespaceId);
+ });
+
+ it('renders expected dropdown items', async () => {
+ wrapper = mountComponent({ mountFn: mount });
+
+ jest.runOnlyPendingTimers();
+ await wrapper.vm.$nextTick();
+
+ const listItems = wrapper.findAll('li');
+
+ expect(listItems.at(0).findComponent(GlDropdownSectionHeader).text()).toBe('Groups');
+ expect(listItems.at(1).text()).toBe(data.currentUser.groups.nodes[0].fullPath);
+ expect(listItems.at(2).text()).toBe(data.currentUser.groups.nodes[1].fullPath);
+ expect(listItems.at(3).findComponent(GlDropdownSectionHeader).text()).toBe('Users');
+ expect(listItems.at(4).text()).toBe(data.currentUser.namespace.fullPath);
+ });
+
+ it('updates hidden input with selected namespace', async () => {
+ wrapper = mountComponent();
+
+ jest.runOnlyPendingTimers();
+ await wrapper.vm.$nextTick();
+
+ wrapper.findComponent(GlDropdownItem).vm.$emit('click');
+
+ await wrapper.vm.$nextTick();
+
+ expect(findHiddenInput().attributes()).toMatchObject({
+ name: 'project[namespace_id]',
+ value: getIdFromGraphQLId(data.currentUser.groups.nodes[0].id).toString(),
+ });
+ });
+
+ it('tracks clicking on the dropdown', () => {
+ wrapper = mountComponent();
+
+ const trackingSpy = mockTracking(undefined, wrapper.element, jest.spyOn);
+
+ findDropdown().vm.$emit('show');
+
+ expect(trackingSpy).toHaveBeenCalledWith(undefined, 'activate_form_input', {
+ label: provide.trackLabel,
+ property: 'project_path',
+ });
+
+ unmockTracking();
+ });
+});
diff --git a/spec/frontend/pages/projects/pipeline_schedules/shared/components/interval_pattern_input_spec.js b/spec/frontend/pages/projects/pipeline_schedules/shared/components/interval_pattern_input_spec.js
index de0d70a07d7..f3d76ca2c1b 100644
--- a/spec/frontend/pages/projects/pipeline_schedules/shared/components/interval_pattern_input_spec.js
+++ b/spec/frontend/pages/projects/pipeline_schedules/shared/components/interval_pattern_input_spec.js
@@ -42,11 +42,6 @@ describe('Interval Pattern Input Component', () => {
wrapper = mount(IntervalPatternInput, {
propsData: { ...props },
- provide: {
- glFeatures: {
- ciDailyLimitForPipelineSchedules: true,
- },
- },
data() {
return {
randomHour: data?.hour || mockHour,
diff --git a/spec/frontend/pages/sessions/new/signin_tabs_memoizer_spec.js b/spec/frontend/pages/sessions/new/signin_tabs_memoizer_spec.js
index 6aa725fbd7d..601fcfedbe0 100644
--- a/spec/frontend/pages/sessions/new/signin_tabs_memoizer_spec.js
+++ b/spec/frontend/pages/sessions/new/signin_tabs_memoizer_spec.js
@@ -21,7 +21,7 @@ describe('SigninTabsMemoizer', () => {
beforeEach(() => {
loadFixtures(fixtureTemplate);
- jest.spyOn(AccessorUtilities, 'isLocalStorageAccessSafe').mockReturnValue(true);
+ jest.spyOn(AccessorUtilities, 'canUseLocalStorage').mockReturnValue(true);
});
it('does nothing if no tab was previously selected', () => {
@@ -90,7 +90,7 @@ describe('SigninTabsMemoizer', () => {
});
it('should set .isLocalStorageAvailable', () => {
- expect(AccessorUtilities.isLocalStorageAccessSafe).toHaveBeenCalled();
+ expect(AccessorUtilities.canUseLocalStorage).toHaveBeenCalled();
expect(memo.isLocalStorageAvailable).toBe(true);
});
});