Skip to content

Commit

Permalink
Added tests for EditCover component.
Browse files Browse the repository at this point in the history
  • Loading branch information
mauteri committed Dec 28, 2023
1 parent 1d67e76 commit 3de6e4b
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions test/unit/js/src/components/EditCover.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* External dependencies.
*/
import { render } from '@testing-library/react';
import { expect, test } from '@jest/globals';
import '@testing-library/jest-dom';

/**
* Internal dependencies.
*/
import EditCover from '../../../../../src/components/EditCover';

/**
* Coverage for EditCover.
*/
test('EditCover is display block by default', () => {
const { container } = render(

Check failure on line 17 in test/unit/js/src/components/EditCover.test.js

View workflow job for this annotation

GitHub Actions / JavaScript Coding Standards

Replace `⏎↹↹<EditCover·/>⏎↹` with `<EditCover·/>`
<EditCover />
);

expect(container.children[0]).toHaveStyle('position: relative');
expect(container.children[0].children[0]).toHaveStyle('display: block');
});

test('EditCover is display block when isSelected is false', () => {
const { container } = render(

Check failure on line 26 in test/unit/js/src/components/EditCover.test.js

View workflow job for this annotation

GitHub Actions / JavaScript Coding Standards

Replace `⏎↹↹<EditCover·isSelected={false}·/>⏎↹` with `<EditCover·isSelected={false}·/>`
<EditCover isSelected={false} />
);

expect(container.children[0]).toHaveStyle('position: relative');
expect(container.children[0].children[0]).toHaveStyle('display: block');
});

test('EditCover is display none when isSelected is true', () => {
const { container } = render(

Check failure on line 35 in test/unit/js/src/components/EditCover.test.js

View workflow job for this annotation

GitHub Actions / JavaScript Coding Standards

Replace `⏎↹↹<EditCover·isSelected={true}·/>⏎↹` with `<EditCover·isSelected={true}·/>`
<EditCover isSelected={true} />
);

expect(container.children[0]).toHaveStyle('position: relative');
expect(container.children[0].children[0]).toHaveStyle('display: none');
});

0 comments on commit 3de6e4b

Please sign in to comment.