mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 09:46:30 -05:00
test: add tests for internal-link
Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
572f200c99
commit
5025d50e9e
2 changed files with 95 additions and 0 deletions
|
@ -0,0 +1,62 @@
|
||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`InternalLink renders an internal link correctly 1`] = `
|
||||||
|
<div>
|
||||||
|
<a
|
||||||
|
class="text-light"
|
||||||
|
href="/test"
|
||||||
|
>
|
||||||
|
testText
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`InternalLink renders an internal link with a title 1`] = `
|
||||||
|
<div>
|
||||||
|
<a
|
||||||
|
class="text-light"
|
||||||
|
href="/test"
|
||||||
|
title="testTitle"
|
||||||
|
>
|
||||||
|
testText
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`InternalLink renders an internal link with additional className 1`] = `
|
||||||
|
<div>
|
||||||
|
<a
|
||||||
|
class="testClass"
|
||||||
|
href="/test"
|
||||||
|
>
|
||||||
|
testText
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`InternalLink renders an internal link with an icon 1`] = `
|
||||||
|
<div>
|
||||||
|
<a
|
||||||
|
class="text-light"
|
||||||
|
href="/test"
|
||||||
|
>
|
||||||
|
<i
|
||||||
|
class="fa fa-fw fa-heart "
|
||||||
|
/>
|
||||||
|
|
||||||
|
testText
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`InternalLink renders an internal link with an id 1`] = `
|
||||||
|
<div>
|
||||||
|
<a
|
||||||
|
class="text-light"
|
||||||
|
href="/test"
|
||||||
|
id="testId"
|
||||||
|
>
|
||||||
|
testText
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
`;
|
33
src/components/common/links/internal-link.test.tsx
Normal file
33
src/components/common/links/internal-link.test.tsx
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { render } from '@testing-library/react'
|
||||||
|
import { InternalLink } from './internal-link'
|
||||||
|
|
||||||
|
describe('InternalLink', () => {
|
||||||
|
const href = '/test'
|
||||||
|
const text = 'testText'
|
||||||
|
it('renders an internal link correctly', () => {
|
||||||
|
const view = render(<InternalLink text={text} href={href} />)
|
||||||
|
expect(view.container).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
it('renders an internal link with an icon', () => {
|
||||||
|
const view = render(<InternalLink text={text} href={href} icon={'heart'} />)
|
||||||
|
expect(view.container).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
it('renders an internal link with an id', () => {
|
||||||
|
const view = render(<InternalLink text={text} href={href} id={'testId'} />)
|
||||||
|
expect(view.container).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
it('renders an internal link with additional className', () => {
|
||||||
|
const view = render(<InternalLink text={text} href={href} className={'testClass'} />)
|
||||||
|
expect(view.container).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
it('renders an internal link with a title', () => {
|
||||||
|
const view = render(<InternalLink text={text} href={href} title={'testTitle'} />)
|
||||||
|
expect(view.container).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
})
|
Loading…
Reference in a new issue