mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 11:16:31 -05:00
test: add tests for show-if
Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
a8673c9174
commit
f557901944
2 changed files with 29 additions and 0 deletions
|
@ -0,0 +1,9 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`ShowIf does not render child if condition is false 1`] = `<div />`;
|
||||
|
||||
exports[`ShowIf renders child if condition is true 1`] = `
|
||||
<div>
|
||||
test
|
||||
</div>
|
||||
`;
|
20
src/components/common/show-if/show-if.test.tsx
Normal file
20
src/components/common/show-if/show-if.test.tsx
Normal file
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { render } from '@testing-library/react'
|
||||
import { ShowIf } from './show-if'
|
||||
|
||||
describe('ShowIf', () => {
|
||||
it('renders child if condition is true', () => {
|
||||
const view = render(<ShowIf condition={true}>test</ShowIf>)
|
||||
expect(view.container).toMatchSnapshot()
|
||||
})
|
||||
|
||||
it('does not render child if condition is false', () => {
|
||||
const view = render(<ShowIf condition={false}>test</ShowIf>)
|
||||
expect(view.container).toMatchSnapshot()
|
||||
})
|
||||
})
|
Loading…
Reference in a new issue