Update existing tests

This commit is contained in:
phntxx 2021-06-24 12:25:25 +02:00
parent ee30f05e72
commit 9cdd8da178
6 changed files with 73 additions and 38 deletions

View file

@ -4,8 +4,8 @@ import { IAppProps } from "./app";
import { Headline, ListContainer } from "./elements";
export interface IAppListProps {
categories: Array<IAppCategoryProps>;
apps: Array<IAppProps>;
categories?: Array<IAppCategoryProps>;
apps?: Array<IAppProps>;
}
/**
@ -13,17 +13,26 @@ export interface IAppListProps {
* @param {IAppListProps} props props of the given list of apps
* @returns {React.ReactNode} the app list component
*/
const AppList = ({ categories, apps }: IAppListProps) => (
<ListContainer>
<Headline>Applications</Headline>
{categories &&
categories.map(({ name, items }, idx) => (
<AppCategory key={[name, idx].join("")} name={name} items={items} />
))}
{apps && (
<AppCategory name={categories ? "Uncategorized apps" : ""} items={apps} />
)}
</ListContainer>
);
const AppList = ({ categories, apps }: IAppListProps) => {
if (apps || categories) {
return (
<ListContainer>
<Headline>Applications</Headline>
{categories &&
categories.map(({ name, items }, idx) => (
<AppCategory key={[name, idx].join("")} name={name} items={items} />
))}
{apps && (
<AppCategory
name={categories ? "Uncategorized apps" : ""}
items={apps}
/>
)}
</ListContainer>
);
} else {
return <></>;
}
};
export default AppList;

View file

@ -1,4 +1,3 @@
import React from "react";
import Modal from "./modal";
import styled from "styled-components";
import selectedTheme from "../lib/theme";
@ -63,6 +62,12 @@ export const ImprintField = ({ field }: IImprintFieldComponentProps) => (
<Link href={field.link}>{field.text}</Link>
);
export const onClose = () => {
if (window.location.href.endsWith("#imprint")) {
window.location.href = window.location.href.replace("#imprint", "");
}
};
/**
* Renders the imprint component
* @param {IImprintProps} props contents of the imprint
@ -80,14 +85,7 @@ const Imprint = ({ imprint }: IImprintComponentProps) => (
text="View Imprint"
title="Legal Disclosure"
condition={!window.location.href.endsWith("#imprint")}
onClose={() => {
if (window.location.href.endsWith("#imprint")) {
window.location.href = window.location.href.replace(
"#imprint",
"",
);
}
}}
onClose={onClose}
>
<div>
<ModalSubHeadline>