This commit is contained in:
Tom Moor 2021-10-21 21:23:58 -07:00
parent 63c0daf483
commit c79a22b857
6 changed files with 18 additions and 9 deletions

View File

@ -13,7 +13,7 @@ import PlaceholderList from "components/List/Placeholder";
import { dateToHeading } from "utils/dates";
type Props = {
fetch?: (options: ?Object) => Promise<void>,
fetch?: (options: ?Object) => Promise<any>,
options?: Object,
heading?: React.Node,
empty?: React.Node,

View File

@ -2,15 +2,21 @@
import "../stores";
import { shallow } from "enzyme";
import * as React from "react";
import AuthStore from "stores/AuthStore";
import { DEFAULT_PAGINATION_LIMIT } from "stores/BaseStore";
import RootStore from "stores/RootStore";
import { runAllPromises } from "../test/support";
import { Component as PaginatedList } from "./PaginatedList";
describe("PaginatedList", () => {
const render = () => null;
const rootStore = new RootStore();
const props = { auth: new AuthStore(rootStore), t: (string) => "test" };
it("with no items renders nothing", () => {
const list = shallow(<PaginatedList items={[]} renderItem={render} />);
const list = shallow(
<PaginatedList items={[]} renderItem={render} {...props} />
);
expect(list).toEqual({});
});
@ -20,6 +26,7 @@ describe("PaginatedList", () => {
items={[]}
empty={<p>Sorry, no results</p>}
renderItem={render}
{...props}
/>
);
expect(list.text()).toEqual("Sorry, no results");
@ -35,6 +42,7 @@ describe("PaginatedList", () => {
fetch={fetch}
options={options}
renderItem={render}
{...props}
/>
);
expect(fetch).toHaveBeenCalledWith({
@ -46,7 +54,7 @@ describe("PaginatedList", () => {
it("calls fetch when options prop changes", async () => {
const fetchedItems = Array(DEFAULT_PAGINATION_LIMIT).fill();
const fetch = jest.fn().mockReturnValue(fetchedItems);
const fetch = jest.fn().mockReturnValue(Promise.resolve(fetchedItems));
const list = shallow(
<PaginatedList
@ -54,6 +62,7 @@ describe("PaginatedList", () => {
fetch={fetch}
options={{ id: "one" }}
renderItem={render}
{...props}
/>
);

View File

@ -112,7 +112,6 @@ function Collections({ onCreateCollection }: Props) {
<SidebarLink
label={t("Collections")}
icon={<Disclosure expanded={expanded} color="currentColor" />}
disabled
/>
<PlaceholderCollections />
</Flex>

View File

@ -27,7 +27,7 @@ const joinClassnames = (...classnames) => {
return classnames.filter((i) => i).join(" ");
};
type Props = {|
export type Props = {|
activeClassName?: String,
activeStyle?: Object,
className?: string,

View File

@ -4,15 +4,15 @@ import * as React from "react";
import styled, { useTheme } from "styled-components";
import breakpoint from "styled-components-breakpoint";
import EventBoundary from "components/EventBoundary";
import NavLink from "./NavLink";
import NavLink, { type Props as NavLinkProps } from "./NavLink";
type Props = {|
...NavLinkProps,
to?: string | Object,
href?: string | Object,
innerRef?: (?HTMLElement) => void,
onClick?: (SyntheticEvent<>) => void,
onClick?: (SyntheticEvent<>) => mixed,
onMouseEnter?: (SyntheticEvent<>) => void,
className?: string,
children?: React.Node,
icon?: React.Node,
label?: React.Node,
@ -20,7 +20,6 @@ type Props = {|
showActions?: boolean,
active?: boolean,
isActiveDrop?: boolean,
exact?: boolean,
depth?: number,
scrollIntoViewIfNeeded?: boolean,
|};

View File

@ -152,6 +152,7 @@
"Starred": "Starred",
"Show more": "Show more",
"Show less": "Show less",
"Toggle sidebar": "Toggle sidebar",
"Delete {{ documentName }}": "Delete {{ documentName }}",
"Home": "Home",
"Settings": "Settings",
@ -597,6 +598,7 @@
"Are you sure? Deleting your account will destroy identifying data associated with your user and cannot be undone. You will be immediately logged out of Outline and all your API tokens will be revoked.": "Are you sure? Deleting your account will destroy identifying data associated with your user and cannot be undone. You will be immediately logged out of Outline and all your API tokens will be revoked.",
"<em>Note:</em> Signing back in will cause a new account to be automatically reprovisioned.": "<em>Note:</em> Signing back in will cause a new account to be automatically reprovisioned.",
"Delete My Account": "Delete My Account",
"Profile picture": "Profile picture",
"You joined": "You joined",
"Joined": "Joined",
"{{ time }} ago.": "{{ time }} ago.",