This repository has been archived by the owner on Oct 8, 2022. It is now read-only.
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
2 changed files
with
26 additions
and
10 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
23 changes: 18 additions & 5 deletions
23
src/components/Board/components/Lane/components/Card/index.spec.js
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,30 +1,43 @@ | ||
import React from 'react' | ||
import { render } from 'react-testing-library' | ||
import Card from './' | ||
import { callbacks } from 'react-beautiful-dnd' | ||
|
||
describe('<Card />', () => { | ||
let subject | ||
|
||
beforeEach(() => { | ||
function mount () { | ||
const card = { | ||
id: 1, | ||
title: 'Card title', | ||
description: 'Card content' | ||
} | ||
|
||
subject = render(<Card>{card}</Card>) | ||
}) | ||
return subject | ||
} | ||
afterEach(() => { subject = undefined }) | ||
|
||
it('renders a card', () => { | ||
expect(subject.container).toBeInTheDocument() | ||
expect(mount().container).toBeInTheDocument() | ||
}) | ||
|
||
it("renders the card's title", () => { | ||
expect(subject.queryByText(/^Card title$/)).toBeInTheDocument() | ||
expect(mount().queryByText(/^Card title$/)).toBeInTheDocument() | ||
}) | ||
|
||
it("renders the card's description", () => { | ||
expect(subject.queryByText(/^Card content$/)).toBeInTheDocument() | ||
expect(mount().queryByText(/^Card content$/)).toBeInTheDocument() | ||
}) | ||
|
||
describe('when the card is being dragging', () => { | ||
beforeEach(() => { | ||
callbacks.isDragging(true) | ||
mount() | ||
}) | ||
|
||
it('shows the card with a box shadow', () => { | ||
expect(subject.queryByText(/^Card title$/).parentNode).toHaveStyle('box-shadow: 2px 2px grey') | ||
}) | ||
}) | ||
}) |