This file contains hidden or 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
import React from "react"; | |
import ReactDOM from "react-dom"; | |
import App from "./index"; | |
ReactDOM.render(<App foo="Whats up bud" />, document.getElementById("root")); |
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Demo</title> | |
</head> | |
<body> | |
<div id="root"></div> | |
<script src="/script.js"></script> |
This file contains hidden or 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
import React from "react"; | |
import { screen, fireEvent, waitFor } from "@testing-library/react"; | |
import UIFormRelatedURL from "./RelatedURL"; | |
import { relatedUrlSchemeMock } from "../../Work/controlledVocabulary.gql.mock"; | |
import { renderWithReactHookForm } from "../../../services/testing-helpers"; | |
import userEvent from "@testing-library/user-event"; | |
const props = { | |
codeLists: relatedUrlSchemeMock, | |
name: "relatedUrl", |
This file contains hidden or 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
import React from "react"; | |
import { screen } from "@testing-library/react"; | |
import { | |
renderWithRouterApollo, | |
withReactHookForm, | |
} from "../../../services/testing-helpers"; | |
import ControlledMetadata from "./ControlledMetadata"; | |
describe("Some component", () => { | |
beforeEach(() => { |
This file contains hidden or 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
/** | |
* Higher order helper function which wraps a component w/ React Hook Form | |
* @param {React Component} WrappedComponent to pass into | |
* @param {*} restProps any other remaining props | |
* @returns {React Component} | |
*/ | |
export function withReactHookForm(WrappedComponent, restProps) { | |
const HOC = () => { | |
const methods = useForm(); |
This file contains hidden or 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
import React from "react"; | |
import { Router } from "react-router-dom"; | |
import { render } from "@testing-library/react"; | |
import { useForm, FormProvider } from "react-hook-form"; | |
/** | |
* Testing Library utility function to wrap tested component in React Hook Form | |
* @param {ReactElement} ui A React component | |
* @param objectParameters | |
* @param {Object} objectParameters.defaultValues Initial form values to pass into |
This file contains hidden or 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
import React from "react"; | |
import { screen } from "@testing-library/react"; | |
import { renderWithReactHookForm } from "./services/testing-helpers"; | |
import UIFormRelatedURL from "./RelatedURL"; | |
const props = { | |
name: "relatedUrl", | |
label: "Related URL", | |
}; |
This file contains hidden or 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
/** | |
* Testing Library utility function to wrap tested component in React Hook Form | |
* @param {ReactElement} ui A React component | |
* @param objectParameters | |
* @param {Object} objectParameters.defaultValues Initial form values to pass into | |
* React Hook Form, which you can then assert against | |
*/ | |
export function renderWithReactHookForm( | |
ui, | |
{ defaultValues = {} } = {} |
This file contains hidden or 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
// Very simplified version of a component | |
import React from "react" | |
import { Helmet } from "react-helmet" | |
import { useStaticQuery, graphql } from "gatsby" | |
import ogImage from "../images/og-image.png" | |
export default function SEO() { | |
return ( |