fix: restore spec filter in client side store (#24987)

* run ci - bring back specFilter in store

* restore test for saved search

Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
This commit is contained in:
Mark Noonan
2022-12-06 15:29:58 -05:00
committed by GitHub
parent 3205abd75a
commit 6933ef61ff
3 changed files with 6 additions and 2 deletions

View File

@@ -245,8 +245,7 @@ describe('App: Spec List (E2E)', () => {
cy.findByText('No specs matched your search:').should('not.be.visible')
})
// TODO: FIGURE OUT WHY THIS IS NOW FAILING CONSTANTLY
it.skip('saves the filter when navigating to a spec and back', function () {
it('saves the filter when navigating to a spec and back', function () {
const targetSpecFile = 'accounts_list.spec.js'
clearSearchAndType(targetSpecFile)

View File

@@ -25,6 +25,7 @@ export function useSpecFilter (savedFilter?: string) {
function setSpecFilter (specFilter: string) {
if (specStore.specFilter !== specFilter) {
specStore.setSpecFilter(specFilter)
saveSpecFilter.executeMutation({ value: JSON.stringify({ specFilter }) })
}
}

View File

@@ -12,6 +12,7 @@ export const useSpecStore = defineStore({
state (): SpecState {
return {
activeSpec: undefined,
specFilter: undefined,
}
},
@@ -19,5 +20,8 @@ export const useSpecStore = defineStore({
setActiveSpec (activeSpec: SpecFile | null) {
this.activeSpec = activeSpec
},
setSpecFilter (filter: string) {
this.specFilter = filter
},
},
})