Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add price sorts to Artist pages' artworks grid #3590

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ArtworkFilterContextProvider } from "Components/v2/ArtworkFilter/Artwor
import { updateUrl } from "Components/v2/ArtworkFilter/Utils/urlBuilder"
import { Match, RouterState, withRouter } from "found"
import React from "react"
import { createRefetchContainer, graphql, RelayRefetchProp } from "react-relay"
import { RelayRefetchProp, createRefetchContainer, graphql } from "react-relay"
import { ZeroState } from "./ZeroState"

interface ArtistArtworkFilterProps {
Expand All @@ -30,6 +30,8 @@ const ArtistArtworkFilter: React.FC<ArtistArtworkFilterProps> = props => {
filters={match && match.location.query}
sortOptions={[
{ value: "-decayed_merch", text: "Default" },
{ value: "-has_price,-prices", text: "Price (desc.)" },
{ value: "-has_price,prices", text: "Price (asc.)" },
{ value: "-partner_updated_at", text: "Recently updated" },
{ value: "-published_at", text: "Recently added" },
{ value: "-year", text: "Artwork year (desc.)" },
Expand Down
15 changes: 15 additions & 0 deletions src/Apps/Artist/Routes/Works/__tests__/Works.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,21 @@ describe("Works Route", () => {
expect(wrapper.html()).toContain("Mock ArtistRecommendations")
expect(wrapper.html()).toContain("Mock ArtistCollectionRail")
})
it("includes the correct sort options", () => {
const sortOptions = wrapper
.find("div[title='Sort'] select option")
.map(el => el.text())

expect(sortOptions).toEqual([
"Default",
"Price (desc.)",
"Price (asc.)",
"Recently updated",
"Recently added",
"Artwork year (desc.)",
"Artwork year (asc.)",
])
})
})

describe("Artist Recommendations", () => {
Expand Down