Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
169 changes: 0 additions & 169 deletions core/src/components/UnifiedSearch/UnifiedSearchLocalSearchBar.vue

This file was deleted.

28 changes: 0 additions & 28 deletions core/src/components/UnifiedSearch/UnifiedSearchModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,6 @@
</NcButton>
</template>
</SearchableList>
<NcButton
v-if="localSearch"
variant="tertiary"
data-cy-unified-search-filter="current-view"
@click="searchLocally">
{{ t('core', 'Filter in current view') }}
<template #icon>
<IconFilter :size="20" />
</template>
</NcButton>
</div>
<div v-show="!detailCategory && hasAnyActiveFilter" class="unified-search-modal__filters-applied">
<FilterChip
Expand Down Expand Up @@ -280,7 +270,6 @@ import IconArrowRight from 'vue-material-design-icons/ArrowRight.vue'
import IconCalendarBlankOutline from 'vue-material-design-icons/CalendarBlankOutline.vue'
import IconClose from 'vue-material-design-icons/Close.vue'
import IconDotsHorizontal from 'vue-material-design-icons/DotsHorizontal.vue'
import IconFilter from 'vue-material-design-icons/Filter.vue'
import IconMagnify from 'vue-material-design-icons/Magnify.vue'
import IconShapeOutline from 'vue-material-design-icons/ShapeOutline.vue'
import CustomDateRangeModal from './CustomDateRangeModal.vue'
Expand Down Expand Up @@ -313,7 +302,6 @@ export default defineComponent({
IconCalendarBlankOutline,
IconClose,
IconDotsHorizontal,
IconFilter,
IconMagnify,
IconShapeOutline,

Expand Down Expand Up @@ -347,14 +335,6 @@ export default defineComponent({
default: '',
},

/**
* If the current page / app supports local search
*/
localSearch: {
type: Boolean,
default: false,
},

/**
* Reveal the filter row before the user has typed. Set by the header input's
* funnel button (relayed through the parent view) so filters can be opened on
Expand Down Expand Up @@ -944,14 +924,6 @@ export default defineComponent({
this.focusTrap = null
},

/**
* Only close the modal but keep the query for in-app search
*/
searchLocally() {
this.$emit('update:query', this.searchQuery)
this.$emit('update:open', false)
},

/**
* Blank the results, then queue the search. Every query and filter change comes through
* here. The results on screen answer the previous question, so holding them until the
Expand Down
24 changes: 12 additions & 12 deletions core/src/tests/components/UnifiedSearch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,28 +184,30 @@ describe('UnifiedSearch find shortcut (Ctrl+F) aligns with Ctrl+K', () => {
wrapper.destroy()
})

// Deck & co. own Ctrl+F for their in-app search bar; that must survive the alignment.
it('on local-search pages still toggles the local bar, not the global input', () => {
location.value = { pathname: '/apps/deck' }
it('stays out of the way on pages that own the search shortcut', () => {
location.value = { pathname: '/settings/users' }
const wrapper = mountWithShortcuts()
const focusInput = vi.spyOn(wrapper.vm, 'focusInput').mockImplementation(() => {})

pressCtrl('f')
const prevented = pressCtrl('f')

expect(wrapper.vm.showLocalSearch).toBe(true)
expect(focusInput).not.toHaveBeenCalled()
expect(prevented).not.toHaveBeenCalled()
wrapper.destroy()
})

it('stays out of the way on pages that own the search shortcut', () => {
location.value = { pathname: '/settings/users' }
// Deck filters cards in place and binds Ctrl+F to its own board input, so the header
// must not steal the key there. This replaces the local search bar we used to render.
it('leaves Ctrl+F to Deck, which filters in its own board input', () => {
location.value = { pathname: '/apps/deck' }
const wrapper = mountWithShortcuts()
const focusInput = vi.spyOn(wrapper.vm, 'focusInput').mockImplementation(() => {})

const prevented = pressCtrl('f')

expect(focusInput).not.toHaveBeenCalled()
expect(prevented).not.toHaveBeenCalled()
expect(wrapper.vm.showUnifiedSearch).toBe(false)
wrapper.destroy()
})

Expand Down Expand Up @@ -258,12 +260,10 @@ describe('UnifiedSearch find shortcut (Ctrl+F) aligns with Ctrl+K', () => {
})

describe('UnifiedSearch combobox expanded state', () => {
// The header input is the combobox for the unified results only. On local-search
// pages (e.g. deck) Ctrl+F opens just the local bar, so the input must report
// collapsed and not point aria-controls at an unrendered popover.
it('reports collapsed when only the local search bar is open', async () => {
// The header input is the combobox for the results popover, so while that popover is
// shut it must report collapsed rather than point aria-controls at an unrendered panel.
it('reports collapsed while the results popover is closed', async () => {
const wrapper = factory()
wrapper.vm.showLocalSearch = true
wrapper.vm.showUnifiedSearch = false
await wrapper.vm.$nextTick()

Expand Down
6 changes: 3 additions & 3 deletions core/src/tests/components/UnifiedSearchModal.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function loaded(entries: unknown[], hasMore = false) {

function factory(open = true) {
return shallowMount(UnifiedSearchModal, {
propsData: { open, query: '', localSearch: false },
propsData: { open, query: '' },
global: { mocks: { t: (_: string, s: string) => s, n: (_: string, s: string) => s } },
})
}
Expand Down Expand Up @@ -335,7 +335,7 @@ describe('UnifiedSearchModal reset on close', () => {
// The pending debounce must be cancelled on close so it can't dispatch for a shut modal.
const cancelPending = vi.spyOn(wrapper.vm.debouncedFind, 'clear')

// searchLocally-style close: keep the query, just shut the popover.
// Close without clearing: the query stays, only the popover shuts.
await wrapper.setProps({ open: false })

expect(cancelPending).toHaveBeenCalled()
Expand Down Expand Up @@ -489,7 +489,7 @@ describe('UnifiedSearchModal controller wiring (init)', () => {
// Open with a query already present: the open() handler starts the async provider
// fetch and calls find() before it resolves, so nothing is dispatched yet.
const wrapper = shallowMount(UnifiedSearchModal, {
propsData: { open: false, query: 'hello', localSearch: false },
propsData: { open: false, query: 'hello' },
global: { mocks: { t: (_: string, s: string) => s, n: (_: string, s: string) => s } },
})
// The focus trap needs a tabbable node the stubbed panel lacks; skip it here.
Expand Down
Loading
Loading