Add "newTab" to bookmarks

This commit is contained in:
Bastian Meissner 2022-01-14 14:53:18 +01:00
parent 24d9e6f613
commit 46d001e7bf
4 changed files with 62 additions and 9 deletions

View file

@ -1,5 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`BookmarkGroup snapshot test 1`] = `[Function]`;
exports[`tests rendering of Bookmark with newTab=false 1`] = `[Function]`;
exports[`BookmarkList snapshot test 1`] = `[Function]`;
exports[`tests rendering of Bookmark with newTab=true 1`] = `[Function]`;
exports[`tests rendering of Bookmark without newTab 1`] = `[Function]`;
exports[`tests rendering of BookmarkGroup 1`] = `[Function]`;
exports[`tests rendering of BookmarkList 1`] = `[Function]`;

View file

@ -1,5 +1,6 @@
import { render } from "@testing-library/react";
import BookmarkList, {
Bookmark,
BookmarkGroup,
IBookmarkGroupProps,
IBookmarkListProps,
@ -19,7 +20,32 @@ const bookmarkListProps: IBookmarkListProps = {
groups: [bookmarkGroupProps, bookmarkGroupProps],
};
it("BookmarkGroup snapshot test", () => {
it("tests rendering of Bookmark with newTab=true", () => {
let props = bookmarkGroupProps.items[0];
const { asFragment } = render(
<Bookmark name={props.name} url={props.url} newTab={true} />,
);
expect(asFragment).toMatchSnapshot();
});
it("tests rendering of Bookmark with newTab=false", () => {
let props = bookmarkGroupProps.items[0];
const { asFragment } = render(
<Bookmark name={props.name} url={props.url} newTab={false} />,
);
expect(asFragment).toMatchSnapshot();
});
it("tests rendering of Bookmark without newTab", () => {
let props = bookmarkGroupProps.items[0];
const { asFragment } = render(<Bookmark name={props.name} url={props.url} />);
expect(asFragment).toMatchSnapshot();
});
it("tests rendering of BookmarkGroup", () => {
const { asFragment } = render(
<BookmarkGroup
name={bookmarkGroupProps.name}
@ -30,7 +56,7 @@ it("BookmarkGroup snapshot test", () => {
expect(asFragment).toMatchSnapshot();
});
it("BookmarkList snapshot test", () => {
it("tests rendering of BookmarkList", () => {
const { asFragment } = render(
<BookmarkList groups={bookmarkListProps.groups} />,
);