diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 19:05:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 19:05:49 +0300 |
commit | 43a25d93ebdabea52f99b05e15b06250cd8f07d7 (patch) | |
tree | dceebdc68925362117480a5d672bcff122fb625b /spec/frontend/add_context_commits_modal/components | |
parent | 20c84b99005abd1c82101dfeff264ac50d2df211 (diff) |
Add latest changes from gitlab-org/gitlab@16-0-stable-eev16.0.0-rc42
Diffstat (limited to 'spec/frontend/add_context_commits_modal/components')
3 files changed, 34 insertions, 19 deletions
diff --git a/spec/frontend/add_context_commits_modal/components/__snapshots__/add_context_commits_modal_spec.js.snap b/spec/frontend/add_context_commits_modal/components/__snapshots__/add_context_commits_modal_spec.js.snap index 2c2151bfb41..ddeab3e3b62 100644 --- a/spec/frontend/add_context_commits_modal/components/__snapshots__/add_context_commits_modal_spec.js.snap +++ b/spec/frontend/add_context_commits_modal/components/__snapshots__/add_context_commits_modal_spec.js.snap @@ -6,8 +6,9 @@ exports[`AddContextCommitsModal renders modal with 2 tabs 1`] = ` body-class="add-review-item pt-0" cancel-variant="light" dismisslabel="Close" - modalclass="" + modalclass="add-review-item-modal" modalid="add-review-item" + nofocusonshow="true" ok-disabled="true" ok-title="Save changes" scrollable="true" @@ -27,9 +28,14 @@ exports[`AddContextCommitsModal renders modal with 2 tabs 1`] = ` <div class="gl-mt-3" > - <gl-search-box-by-type-stub + <gl-filtered-search-stub + availabletokens="[object Object],[object Object],[object Object]" + class="flex-grow-1" clearbuttontitle="Clear" - placeholder="Search by commit title or SHA" + placeholder="Search or filter commits" + searchbuttonattributes="[object Object]" + searchinputattributes="[object Object]" + searchtextoptionlabel="Search for this text" value="" /> diff --git a/spec/frontend/add_context_commits_modal/components/add_context_commits_modal_spec.js b/spec/frontend/add_context_commits_modal/components/add_context_commits_modal_spec.js index 1d57473943b..27fe010c354 100644 --- a/spec/frontend/add_context_commits_modal/components/add_context_commits_modal_spec.js +++ b/spec/frontend/add_context_commits_modal/components/add_context_commits_modal_spec.js @@ -1,4 +1,4 @@ -import { GlModal, GlSearchBoxByType } from '@gitlab/ui'; +import { GlModal, GlFilteredSearch } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; import Vue, { nextTick } from 'vue'; import Vuex from 'vuex'; @@ -49,16 +49,12 @@ describe('AddContextCommitsModal', () => { }; const findModal = () => wrapper.findComponent(GlModal); - const findSearch = () => wrapper.findComponent(GlSearchBoxByType); + const findSearch = () => wrapper.findComponent(GlFilteredSearch); beforeEach(() => { wrapper = createWrapper(); }); - afterEach(() => { - wrapper.destroy(); - }); - it('renders modal with 2 tabs', () => { expect(wrapper.element).toMatchSnapshot(); }); @@ -72,12 +68,29 @@ describe('AddContextCommitsModal', () => { expect(findSearch().exists()).toBe(true); }); - it('when user starts entering text in search box, it calls action "searchCommits" after waiting for 500s', () => { - const searchText = 'abcd'; - findSearch().vm.$emit('input', searchText); - expect(searchCommits).not.toHaveBeenCalled(); - jest.advanceTimersByTime(500); - expect(searchCommits).toHaveBeenCalledWith(expect.anything(), searchText); + it('when user submits after entering filters in search box, then it calls action "searchCommits"', () => { + const search = [ + 'abcd', + { + type: 'author', + value: { operator: '=', data: 'abhi' }, + }, + { + type: 'committed-before-date', + value: { operator: '=', data: '2022-10-31' }, + }, + { + type: 'committed-after-date', + value: { operator: '=', data: '2022-10-28' }, + }, + ]; + findSearch().vm.$emit('submit', search); + expect(searchCommits).toHaveBeenCalledWith(expect.anything(), { + searchText: 'abcd', + author: 'abhi', + committed_before: '2022-10-31', + committed_after: '2022-10-28', + }); }); it('disabled ok button when no row is selected', () => { diff --git a/spec/frontend/add_context_commits_modal/components/review_tab_container_spec.js b/spec/frontend/add_context_commits_modal/components/review_tab_container_spec.js index f679576182f..975f115c4bb 100644 --- a/spec/frontend/add_context_commits_modal/components/review_tab_container_spec.js +++ b/spec/frontend/add_context_commits_modal/components/review_tab_container_spec.js @@ -26,10 +26,6 @@ describe('ReviewTabContainer', () => { createWrapper(); }); - afterEach(() => { - wrapper.destroy(); - }); - it('shows loading icon when commits are being loaded', () => { createWrapper({ isLoading: true }); expect(wrapper.findComponent(GlLoadingIcon).exists()).toBe(true); |