mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-30 21:27:17 +00:00
Merge pull request #7211 from jibees/4207-add-query-params-in-url
Orders list : save filters params
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
describe "Test KeyValueMapStore service", ->
|
||||
|
||||
KeyValueMapStore = null
|
||||
|
||||
beforeEach ->
|
||||
module "ofn.admin"
|
||||
|
||||
beforeEach inject (_KeyValueMapStore_) ->
|
||||
KeyValueMapStore = _KeyValueMapStore_
|
||||
|
||||
it "set and restore filters", ->
|
||||
KeyValueMapStore.localStorageKey = 'localStorageKey'
|
||||
KeyValueMapStore.storableKeys = ["a", "b", "c"]
|
||||
source =
|
||||
a: "1",
|
||||
b: "2",
|
||||
d: "4"
|
||||
KeyValueMapStore.setStoredValues(source)
|
||||
source = {}
|
||||
restored = KeyValueMapStore.restoreValues(source)
|
||||
expect(restored).toEqual true
|
||||
expect(source).toEqual {a: '1', b: '2'}
|
||||
|
||||
it "clear filters", ->
|
||||
KeyValueMapStore.storageKey = 'localStorageKey'
|
||||
KeyValueMapStore.storableFilters = ["a", "b", "c"]
|
||||
source =
|
||||
a: "1",
|
||||
b: "2",
|
||||
d: "4"
|
||||
KeyValueMapStore.setStoredValues(source)
|
||||
KeyValueMapStore.clearKeyValueMap()
|
||||
source = {}
|
||||
restored = KeyValueMapStore.restoreValues(source)
|
||||
expect(restored).toEqual false
|
||||
expect(source).toEqual {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user