-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
61 additions
and
27 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,29 @@ | ||
import ReactDOM from 'react-dom' | ||
import { fireEvent, render, screen, act } from '@testing-library/react'; | ||
import { createRoot } from 'react-dom/client' | ||
import Feedbackify from './Feedbackify' | ||
import { composeStory } from '@storybook/react'; | ||
import Meta, { FeedbackifyBasic } from './Feedbackify.stories'; | ||
|
||
const BasicStory = composeStory(FeedbackifyBasic, Meta) | ||
|
||
describe('<Feedbackify />', () => { | ||
it('renders a feedback area', () => { | ||
const div = document.createElement('div') | ||
const root = ReactDOM.createRoot(div).render(<Feedbackify up={44} down={23} />) | ||
root.unmount(div) | ||
const root = createRoot(div) | ||
act(() => { | ||
root.render(<Feedbackify up={44} down={23} />) | ||
root.render(<Feedbackify up={0} down={1} />) | ||
root.render(<Feedbackify up={5} down={0} />) | ||
root.render(<Feedbackify up={0} down={0} />) | ||
root.render(<Feedbackify up={9999} down={9999} />) | ||
root.unmount() | ||
}) | ||
}) | ||
|
||
it('can display the basic story', () => { | ||
render(<BasicStory />) | ||
expect(screen.getByLabelText('arrow-up')).toBeInTheDocument() | ||
expect(screen.getByLabelText('arrow-down')).toBeInTheDocument() | ||
expect(screen.getAllByRole('button').length).toBe(2) | ||
}) | ||
}) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
import ReactDOM from 'react-dom' | ||
import { createRoot } from 'react-dom/client' | ||
import Health from './Health' | ||
|
||
describe('<Health />', () => { | ||
it('renders the Health area', () => { | ||
const div = document.createElement('div') | ||
const root = ReactDOM.createRoot(div).render(<Health char={{ | ||
const root = createRoot(div) | ||
root.render(<Health char={{ | ||
health: 50, | ||
totalHealth: 100 | ||
}} />) | ||
root.unmount(div) | ||
root.unmount() | ||
}) | ||
}) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import ReactDOM from 'react-dom' | ||
import { createRoot } from 'react-dom/client' | ||
import Logo from './Logo' | ||
|
||
describe('<Logo />', () => { | ||
it('renders the Logo area', () => { | ||
const div = document.createElement('div') | ||
const root = ReactDOM.createRoot(div).render(<Logo />) | ||
const root = createRoot(div) | ||
root.render(<Logo />) | ||
root.unmount(div) | ||
}) | ||
}) |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import { ThemeProvider } from '@material-ui/core/styles' | ||
import ReactDOM from 'react-dom' | ||
import { createRoot } from 'react-dom/client' | ||
import theme from '@/theme' | ||
import Typeset from './Typeset' | ||
|
||
describe('<Typeset />', () => { | ||
it('renders the Typeset area', () => { | ||
const div = document.createElement('div') | ||
const root = createRoot(div).render(<ThemeProvider theme={theme}><Typeset><div>Some random contents</div><div>Here are some more</div></Typeset></ThemeProvider>) | ||
const root = createRoot(div) | ||
root.render(<ThemeProvider theme={theme}><Typeset><div>Some random contents</div><div>Here are some more</div></Typeset></ThemeProvider>) | ||
root.unmount() | ||
}) | ||
}) |
This file contains 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
This file contains 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