Skip to content
代码片段 群组 项目
未验证 提交 8c185c6a 编辑于 作者: Phil Hughes's avatar Phil Hughes
浏览文件

Fixes filtered_search_bar_root failing Vue 3 specs

上级 465ca6dc
No related branches found
No related tags found
无相关合并请求
...@@ -268,7 +268,6 @@ spec/frontend/vue_shared/components/design_management/design_note_pin_spec.js ...@@ -268,7 +268,6 @@ spec/frontend/vue_shared/components/design_management/design_note_pin_spec.js
spec/frontend/vue_shared/components/diff_stats_dropdown_spec.js spec/frontend/vue_shared/components/diff_stats_dropdown_spec.js
spec/frontend/vue_shared/components/file_finder/index_spec.js spec/frontend/vue_shared/components/file_finder/index_spec.js
spec/frontend/vue_shared/components/file_tree_spec.js spec/frontend/vue_shared/components/file_tree_spec.js
spec/frontend/vue_shared/components/filtered_search_bar/filtered_search_bar_root_spec.js
spec/frontend/vue_shared/components/filtered_search_bar/tokens/date_token_spec.js spec/frontend/vue_shared/components/filtered_search_bar/tokens/date_token_spec.js
spec/frontend/vue_shared/components/markdown/header_spec.js spec/frontend/vue_shared/components/markdown/header_spec.js
spec/frontend/vue_shared/components/markdown/markdown_editor_spec.js spec/frontend/vue_shared/components/markdown/markdown_editor_spec.js
......
...@@ -4,6 +4,8 @@ import { nextTick } from 'vue'; ...@@ -4,6 +4,8 @@ import { nextTick } from 'vue';
import { useLocalStorageSpy } from 'helpers/local_storage_helper'; import { useLocalStorageSpy } from 'helpers/local_storage_helper';
import waitForPromises from 'helpers/wait_for_promises'; import waitForPromises from 'helpers/wait_for_promises';
import { markRaw } from '~/lib/utils/vue3compat/mark_raw';
import RecentSearchesService from '~/filtered_search/services/recent_searches_service'; import RecentSearchesService from '~/filtered_search/services/recent_searches_service';
import { import {
FILTERED_SEARCH_TERM, FILTERED_SEARCH_TERM,
...@@ -60,7 +62,7 @@ jest.mock('~/filtered_search/services/recent_searches_service', () => { ...@@ -60,7 +62,7 @@ jest.mock('~/filtered_search/services/recent_searches_service', () => {
const defaultProps = { const defaultProps = {
namespace: 'gitlab-org/gitlab-test', namespace: 'gitlab-org/gitlab-test',
recentSearchesStorageKey: 'issues', recentSearchesStorageKey: 'issues',
tokens: mockAvailableTokens, tokens: markRaw(mockAvailableTokens),
initialFilterValue: [], initialFilterValue: [],
showCheckbox: false, showCheckbox: false,
checkboxChecked: false, checkboxChecked: false,
...@@ -255,7 +257,7 @@ describe('FilteredSearchBarRoot', () => { ...@@ -255,7 +257,7 @@ describe('FilteredSearchBarRoot', () => {
findGlSorting().vm.$emit('sortByChange', mockSortOptions[1].id); findGlSorting().vm.$emit('sortByChange', mockSortOptions[1].id);
await nextTick(); await nextTick();
expect(wrapper.vm.selectedSortOption).toBe(mockSortOptions[1]); expect(wrapper.vm.selectedSortOption).toEqual(mockSortOptions[1]);
expect(wrapper.emitted('onSort')[0]).toEqual([mockSortOptions[1].sortDirection.descending]); expect(wrapper.emitted('onSort')[0]).toEqual([mockSortOptions[1].sortDirection.descending]);
}); });
}); });
...@@ -386,7 +388,7 @@ describe('FilteredSearchBarRoot', () => { ...@@ -386,7 +388,7 @@ describe('FilteredSearchBarRoot', () => {
it('renders search history items dropdown with formatting done using token symbols', async () => { it('renders search history items dropdown with formatting done using token symbols', async () => {
createComponent({ propsData: { sortOptions: mockSortOptions }, shallow: false }); createComponent({ propsData: { sortOptions: mockSortOptions }, shallow: false });
wrapper.vm.recentSearchesStore.addRecentSearch(mockHistoryItems[0]); wrapper.vm.recentSearchesStore.addRecentSearch(mockHistoryItems[0]);
await nextTick(); await waitForPromises();
expect(findGlDisclosureDropdownItems().at(0).text()).toBe( expect(findGlDisclosureDropdownItems().at(0).text()).toBe(
'Author := @rootLabel := ~bugMilestone := %v1.0"duo"', 'Author := @rootLabel := ~bugMilestone := %v1.0"duo"',
...@@ -404,12 +406,12 @@ describe('FilteredSearchBarRoot', () => { ...@@ -404,12 +406,12 @@ describe('FilteredSearchBarRoot', () => {
}); });
wrapper.vm.recentSearchesStore.addRecentSearch([tokenValueMembership]); wrapper.vm.recentSearchesStore.addRecentSearch([tokenValueMembership]);
await nextTick(); await waitForPromises();
expect(findGlDisclosureDropdownItem().text()).toBe('Membership := Direct'); expect(findGlDisclosureDropdownItem().text()).toBe('Membership := Direct');
}); });
}); });
describe('when token options have do not have `title` attribute defined', () => { describe('when token options do not have `title` attribute defined', () => {
it('renders search history items using the provided `value` attribute', async () => { it('renders search history items using the provided `value` attribute', async () => {
createComponent({ createComponent({
propsData: { propsData: {
...@@ -419,7 +421,7 @@ describe('FilteredSearchBarRoot', () => { ...@@ -419,7 +421,7 @@ describe('FilteredSearchBarRoot', () => {
shallow: false, shallow: false,
}); });
wrapper.vm.recentSearchesStore.addRecentSearch([tokenValueMembership]); wrapper.vm.recentSearchesStore.addRecentSearch([tokenValueMembership]);
await nextTick(); await waitForPromises();
expect(findGlDisclosureDropdownItem().text()).toBe('Membership := exclude'); expect(findGlDisclosureDropdownItem().text()).toBe('Membership := exclude');
}); });
}); });
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册