diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-06 06:19:30 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-06 06:19:30 +0000 |
commit | c5d8b7e6909eb0478c4b2165689004051cdc7ac5 (patch) | |
tree | ad3366728bb559feaa889434d9de3b560fc1e636 /spec | |
parent | 975e98bc4b507e8d11e116dad72e0a3f2ecf7a88 (diff) | |
download | gitlab-ce-c5d8b7e6909eb0478c4b2165689004051cdc7ac5.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
5 files changed, 79 insertions, 35 deletions
diff --git a/spec/factories/group_members.rb b/spec/factories/group_members.rb index 702db45554e..c8ee52019a4 100644 --- a/spec/factories/group_members.rb +++ b/spec/factories/group_members.rb @@ -30,6 +30,12 @@ FactoryBot.define do after(:build) { |group_member, _| group_member.user.block! } end + trait :banned do + after(:create) do |member| + create(:namespace_ban, namespace: member.member_namespace.root_ancestor, user: member.user) unless member.owner? + end + end + trait :minimal_access do to_create { |instance| instance.save!(validate: false) } diff --git a/spec/factories/project_members.rb b/spec/factories/project_members.rb index 57f228650a1..fb62b2ed951 100644 --- a/spec/factories/project_members.rb +++ b/spec/factories/project_members.rb @@ -26,6 +26,12 @@ FactoryBot.define do after(:build) { |project_member, _| project_member.user.block! } end + trait :banned do + after(:create) do |member| + create(:namespace_ban, namespace: member.member_namespace.root_ancestor, user: member.user) unless member.owner? + end + end + trait :awaiting do after(:create) do |member| member.update!(state: ::Member::STATE_AWAITING) diff --git a/spec/frontend/ci/ci_variable_list/ci_variable_list/ci_variable_list_spec.js b/spec/frontend/ci/ci_variable_list/ci_variable_list/ci_variable_list_spec.js index e4abedb412f..8990a70d4ef 100644 --- a/spec/frontend/ci/ci_variable_list/ci_variable_list/ci_variable_list_spec.js +++ b/spec/frontend/ci/ci_variable_list/ci_variable_list/ci_variable_list_spec.js @@ -1,5 +1,7 @@ import $ from 'jquery'; -import { loadHTMLFixture, resetHTMLFixture } from 'helpers/fixtures'; +import htmlPipelineSchedulesEdit from 'test_fixtures/pipeline_schedules/edit.html'; +import htmlPipelineSchedulesEditWithVariables from 'test_fixtures/pipeline_schedules/edit_with_variables.html'; +import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures'; import VariableList from '~/ci/ci_variable_list/ci_variable_list'; const HIDE_CLASS = 'hide'; @@ -11,7 +13,7 @@ describe('VariableList', () => { describe('with only key/value inputs', () => { describe('with no variables', () => { beforeEach(() => { - loadHTMLFixture('pipeline_schedules/edit.html'); + setHTMLFixture(htmlPipelineSchedulesEdit); $wrapper = $('.js-ci-variable-list-section'); variableList = new VariableList({ @@ -69,7 +71,7 @@ describe('VariableList', () => { describe('with persisted variables', () => { beforeEach(() => { - loadHTMLFixture('pipeline_schedules/edit_with_variables.html'); + setHTMLFixture(htmlPipelineSchedulesEditWithVariables); $wrapper = $('.js-ci-variable-list-section'); variableList = new VariableList({ @@ -106,7 +108,7 @@ describe('VariableList', () => { describe('toggleEnableRow method', () => { beforeEach(() => { - loadHTMLFixture('pipeline_schedules/edit_with_variables.html'); + setHTMLFixture(htmlPipelineSchedulesEditWithVariables); $wrapper = $('.js-ci-variable-list-section'); variableList = new VariableList({ diff --git a/spec/frontend/packages_and_registries/package_registry/components/details/__snapshots__/package_title_spec.js.snap b/spec/frontend/packages_and_registries/package_registry/components/details/__snapshots__/package_title_spec.js.snap index 54f5ad67d07..047fa04947c 100644 --- a/spec/frontend/packages_and_registries/package_registry/components/details/__snapshots__/package_title_spec.js.snap +++ b/spec/frontend/packages_and_registries/package_registry/components/details/__snapshots__/package_title_spec.js.snap @@ -53,7 +53,7 @@ exports[`PackageTitle renders with tags 1`] = ` </div> <div - class="gl-display-flex gl-flex-wrap-wrap gl-align-items-center gl-mt-3" + class="gl-display-flex gl-flex-wrap gl-align-items-center gl-mt-3" > <div class="gl-display-flex gl-align-items-center gl-mr-5" @@ -150,7 +150,7 @@ exports[`PackageTitle renders without tags 1`] = ` </div> <div - class="gl-display-flex gl-flex-wrap-wrap gl-align-items-center gl-mt-3" + class="gl-display-flex gl-flex-wrap gl-align-items-center gl-mt-3" > <div class="gl-display-flex gl-align-items-center gl-mr-5" diff --git a/spec/frontend/super_sidebar/super_sidebar_collapsed_state_manager_spec.js b/spec/frontend/super_sidebar/super_sidebar_collapsed_state_manager_spec.js index 59faa4484eb..36b14a6451f 100644 --- a/spec/frontend/super_sidebar/super_sidebar_collapsed_state_manager_spec.js +++ b/spec/frontend/super_sidebar/super_sidebar_collapsed_state_manager_spec.js @@ -73,37 +73,67 @@ describe('Super Sidebar Collapsed State Manager', () => { }, ); - describe('focus', () => { - it.each` - collapsed | isUserAction - ${false} | ${true} - ${false} | ${false} - ${true} | ${true} - ${true} | ${false} - `( - 'when collapsed is $collapsed, isUserAction is $isUserAction', - ({ collapsed, isUserAction }) => { - const sidebar = findSidebar(); - const toggle = findToggle(); - jest.spyOn(toggle, 'focus'); - jest.spyOn(sidebar, 'focus'); - toggleSuperSidebarCollapsed(collapsed, false, isUserAction); - - if (isUserAction) { - if (collapsed) { - jest.runAllTimers(); - expect(sidebar.classList).toContain('gl-visibility-hidden'); - expect(toggle.focus).toHaveBeenCalled(); - } else { - expect(sidebar.classList).not.toContain('gl-visibility-hidden'); - expect(sidebar.focus).toHaveBeenCalled(); - } - } else { + describe('toggling the super sidebar', () => { + let sidebar; + let toggle; + + beforeEach(() => { + sidebar = findSidebar(); + toggle = findToggle(); + jest.spyOn(toggle, 'focus'); + jest.spyOn(sidebar, 'focus'); + }); + + afterEach(() => { + sidebar = null; + toggle = null; + }); + + describe('collapsing the sidebar', () => { + const collapse = true; + + describe('on user action', () => { + it('hides the sidebar, then focuses the toggle', () => { + toggleSuperSidebarCollapsed(collapse, false, true); + jest.runAllTimers(); + + expect(sidebar.classList).toContain('gl-visibility-hidden'); + expect(toggle.focus).toHaveBeenCalled(); + }); + }); + + describe('on programmatic toggle', () => { + it('hides the sidebar, but does not focus the toggle', () => { + toggleSuperSidebarCollapsed(collapse, false, false); + jest.runAllTimers(); + + expect(sidebar.classList).toContain('gl-visibility-hidden'); expect(toggle.focus).not.toHaveBeenCalled(); + }); + }); + }); + + describe('expanding the sidebar', () => { + const collapse = false; + + describe('on user action', () => { + it('shows the sidebar, then focuses it', () => { + toggleSuperSidebarCollapsed(collapse, false, true); + + expect(sidebar.classList).not.toContain('gl-visibility-hidden'); + expect(sidebar.focus).toHaveBeenCalled(); + }); + }); + + describe('on programmatic toggle', () => { + it('shows the sidebar, but does not focus it', () => { + toggleSuperSidebarCollapsed(collapse, false, false); + + expect(sidebar.classList).not.toContain('gl-visibility-hidden'); expect(sidebar.focus).not.toHaveBeenCalled(); - } - }, - ); + }); + }); + }); }); }); |