mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-12 03:50:22 +00:00
Reset reverse when clicking another column to sort
This commit is contained in:
committed by
Maikel Linke
parent
5179f7fd63
commit
47608525c6
@@ -13,3 +13,32 @@ describe "SortOptions service", ->
|
||||
describe "initialising reverse", ->
|
||||
it "sets reverse to true", ->
|
||||
expect(SortOptions.reverse).toBe true
|
||||
|
||||
describe "sorting by a column", ->
|
||||
describe "when selecting Column A once", ->
|
||||
it "sorts by Column A", ->
|
||||
SortOptions.toggle("column.a")
|
||||
expect(SortOptions.predicate).toEqual "column.a"
|
||||
expect(SortOptions.reverse).toBe false
|
||||
|
||||
describe "when selecting Column A twice", ->
|
||||
it "sorts by Column A in reverse order", ->
|
||||
SortOptions.toggle("column.a")
|
||||
SortOptions.toggle("column.a")
|
||||
expect(SortOptions.predicate).toEqual "column.a"
|
||||
expect(SortOptions.reverse).toBe true
|
||||
|
||||
describe "when selecting Column A once then selecting Column B once", ->
|
||||
it "sorts by Column B", ->
|
||||
SortOptions.toggle("column.a")
|
||||
SortOptions.toggle("column.b")
|
||||
expect(SortOptions.predicate).toEqual "column.b"
|
||||
expect(SortOptions.reverse).toBe false
|
||||
|
||||
describe "when selecting Column A twice then selecting Column B once", ->
|
||||
it "sorts by Column B in reverse order", ->
|
||||
SortOptions.toggle("column.a")
|
||||
SortOptions.toggle("column.a")
|
||||
SortOptions.toggle("column.b")
|
||||
expect(SortOptions.predicate).toEqual "column.b"
|
||||
expect(SortOptions.reverse).toBe false
|
||||
|
||||
Reference in New Issue
Block a user