diff --git a/src/components/common/Footer.tsx b/src/components/common/Footer.tsx index 4235f1e..d7a7870 100644 --- a/src/components/common/Footer.tsx +++ b/src/components/common/Footer.tsx @@ -11,6 +11,7 @@ import React, { Suspense } from "react"; import { withTranslation } from "react-i18next"; import FooterUpdateStatus from "./FooterUpdateStatus"; +import FooterDonateLink from "./FooterDonateLink"; const Footer = (props: any) => { const { t } = props; @@ -20,10 +21,7 @@ const Footer = (props: any) => {
- -   - {t("Donate")} - + {" "} {t("if you found this useful")}
diff --git a/src/components/common/FooterDonateLink.tsx b/src/components/common/FooterDonateLink.tsx new file mode 100644 index 0000000..d5d6ada --- /dev/null +++ b/src/components/common/FooterDonateLink.tsx @@ -0,0 +1,28 @@ +/* Pi-hole: A black hole for Internet advertisements + * (c) 2019 Pi-hole, LLC (https://pi-hole.net) + * Network-wide ad blocking via your own hardware. + * + * Web Interface + * Footer Donate Link component + * + * This file is copyright under the latest version of the EUPL. + * Please see LICENSE file for your rights under this license. */ + +import React from "react"; + +const FooterDonateLink = (props: any) => { + const { t } = props; + return ( + +   + {t("Donate")} + + ); +}; + +export default FooterDonateLink; diff --git a/src/components/common/FooterUpdateStatus.tsx b/src/components/common/FooterUpdateStatus.tsx index 4a19ebf..f01c141 100644 --- a/src/components/common/FooterUpdateStatus.tsx +++ b/src/components/common/FooterUpdateStatus.tsx @@ -9,7 +9,7 @@ * Please see LICENSE file for your rights under this license. */ import React from "react"; -import { WithTranslation, withTranslation } from "react-i18next"; +import { WithTranslation } from "react-i18next"; import { Link } from "react-router-dom"; const FooterUpdateStatus = ({ @@ -27,4 +27,4 @@ const FooterUpdateStatus = ({ ); }; -export default withTranslation("footer")(FooterUpdateStatus); +export default FooterUpdateStatus; diff --git a/src/components/common/__tests__/FooterDonateLink.test.tsx b/src/components/common/__tests__/FooterDonateLink.test.tsx new file mode 100644 index 0000000..c5b814d --- /dev/null +++ b/src/components/common/__tests__/FooterDonateLink.test.tsx @@ -0,0 +1,25 @@ +/* Pi-hole: A black hole for Internet advertisements + * (c) 2019 Pi-hole, LLC (https://pi-hole.net) + * Network-wide ad blocking via your own hardware. + * + * Web Interface + * Footer component test + * + * This file is copyright under the latest version of the EUPL. + * Please see LICENSE file for your rights under this license. */ + +import React from "react"; +import { shallow } from "enzyme"; +import FooterDonateLink from "../FooterDonateLink"; + +it("opens a new tab", () => { + expect( + shallow( text} />).prop("target") + ).toEqual("_blank"); +}); + +it("opens new tab securely", () => { + expect( + shallow( text} />).prop("rel") + ).toEqual("noopener noreferrer"); +}); diff --git a/src/components/common/__tests__/FooterUpdateStatus.test.tsx b/src/components/common/__tests__/FooterUpdateStatus.test.tsx index aac5764..d3eb2fc 100644 --- a/src/components/common/__tests__/FooterUpdateStatus.test.tsx +++ b/src/components/common/__tests__/FooterUpdateStatus.test.tsx @@ -14,15 +14,15 @@ import * as React from "react"; import { Link } from "react-router-dom"; it("renders as null if no update is available", () => { - const wrapper = shallow( - - ).dive(); + const wrapper = shallow(); expect(wrapper).toBeEmptyRender(); }); it("renders a link to the versions page if there is an update", () => { - const wrapper = shallow().dive(); + const wrapper = shallow( + text} updateAvailable={true} /> + ); expect(wrapper.find(Link).props().to).toEqual("/settings/versions"); });