12345678910111213141516171819202122232425262728293031 |
- /* eslint-disable no-undef */
- import React from 'react';
- import { cleanup } from '@testing-library/react';
- import testWrapper from '../helpers/testWrapper';
- import Drawer from '../components/Drawer';
- describe('Drawer component', () => {
- afterEach(cleanup);
- test('drawer content', () => {
- const { getByText } = testWrapper(<Drawer>content</Drawer>);
- expect(getByText('content').textContent).toBe('content');
- });
- test('close drawer', () => {
- const { getByTestId } = testWrapper(<Drawer>content</Drawer>);
- const ele = getByTestId('drawer');
- const style = window.getComputedStyle(ele as HTMLElement);
- expect(style.transform).toBe('translate(0,267px)');
- });
- test('open drawer', () => {
- const { getByTestId } = testWrapper(<Drawer open>content</Drawer>);
- const ele = getByTestId('drawer');
- const style = window.getComputedStyle(ele as HTMLElement);
- expect(style.transform).toBe('translate(0,0)');
- });
- });
|