-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add userlists page and refactor LearningResourceCardTemplate (#650)
* add appropriate userlist api clients, url routes and frontend components, refactor LearningResourceCardTemplate to inherit CardTemplate * add User Lists to the UserMenu * fix typecheck issue * pass opts to useQuery in useUserListList * fix some language in test naming * remove stray console.log's * remove default on sortable and invariant call on UserListCardTemplate and LearningResourceCardTemplate * restrict the UserList listing route
- Loading branch information
Showing
26 changed files
with
618 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export * as learningResources from "./learningResources" | ||
|
||
export * as userLists from "./userLists" | ||
export * as articles from "./articles" | ||
export * as letters from "./programLetters" | ||
export * as fields from "./fields" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Factory, makePaginatedFactory } from "ol-test-utilities" | ||
import { UserList } from "api" | ||
import { faker } from "@faker-js/faker/locale/en" | ||
|
||
const userList: Factory<UserList> = (overrides = {}) => { | ||
const list: UserList = { | ||
id: faker.helpers.unique(faker.datatype.number), | ||
title: faker.helpers.unique(faker.lorem.words), | ||
item_count: 4, | ||
image: {}, | ||
author: faker.helpers.unique(faker.datatype.number), | ||
...overrides, | ||
} | ||
return list | ||
} | ||
const userLists = makePaginatedFactory(userList) | ||
|
||
export { userList, userLists } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
frontends/mit-open/src/page-components/CardTemplate/CardTemplate.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from "react" | ||
import { render, screen } from "@testing-library/react" | ||
import CardTemplate from "./CardTemplate" | ||
|
||
describe("CardTemplate", () => { | ||
it("renders title and cover image", () => { | ||
const title = "Test Title" | ||
render(<CardTemplate variant="column" title={title} />) | ||
const heading = screen.getByRole("heading", { name: title }) | ||
expect(heading).toHaveAccessibleName(title) | ||
}) | ||
}) |
Oops, something went wrong.