Skip to content

Commit

Permalink
fix header test
Browse files Browse the repository at this point in the history
  • Loading branch information
aepyornis committed Dec 14, 2022
1 parent fdbcb9f commit 4975e5a
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions test/components/Header.test.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
import { screen } from '@testing-library/react'
import Header from '../../app/components/Header'
import { wrapInThemeProvider } from '../helpers'
import { screen } from "@testing-library/react"
import Header from "../../app/components/Header"
import { wrapInThemeProvider } from "../helpers"

const attributes = {
const attributes = {
title: "Example Title",
subtitle: "Example Subtitle",
user: { id: "1", "name": "Bob", "url": "https://example.com/bob" },
owner: { id: "1", "name": "Bob", "url": "https://example.com/bob" }
user: { id: "1", name: "Bob", url: "https://example.com/bob" },
owner: { id: "1", name: "Bob", url: "https://example.com/bob" },
}


test('Shows title in Header', async () => {
const result = renderWithStore(wrapInThemeProvider(createElement(Header)), null, { attributes, settings: { noEditing: true} })
test("Shows title in Header", async () => {
const result = renderWithStore(wrapInThemeProvider(createElement(Header)), null, {
attributes,
settings: { noEditing: true },
})
expect(result.container.querySelector("#oligrapher-header")).toBeTruthy()
expect(result.container.querySelector("h1#oligrapher-title").textContent).toEqual("Example Title")
expect(screen.queryByTestId("oligrapher-header-toggler")).not.toBeInTheDocument()
expect(screen.queryByTestId("oligrapher-title-input")).not.toBeInTheDocument()
})


test('Shows toggler and input when editor', async () => {
const result = renderWithStore(wrapInThemeProvider(createElement(Header)), null, { attributes })
test("Shows toggler and input when editor", async () => {
const result = renderWithStore(wrapInThemeProvider(createElement(Header)), null, {
attributes,
settings: { startInEditMode: true },
})
expect(result.container.querySelector("#oligrapher-header")).toBeTruthy()
expect(screen.queryByTestId("oligrapher-header-toggler")).toBeInTheDocument()
expect(screen.queryByTestId("oligrapher-title-input")).toBeInTheDocument()
Expand Down

0 comments on commit 4975e5a

Please sign in to comment.