-
-
Notifications
You must be signed in to change notification settings - Fork 134
/
Copy pathColumnResizeHandlerSpec.tsx
41 lines (31 loc) · 1.18 KB
/
ColumnResizeHandlerSpec.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import React from 'react';
import ColumnResizeHandler from '../src/ColumnResizeHandler';
import { render, screen, fireEvent } from '@testing-library/react';
import { testStandardProps } from './utils';
const handlerLeft = -2;
describe('ColumnResizeHandler', () => {
testStandardProps(<ColumnResizeHandler />);
it('Should output a handler', () => {
render(<ColumnResizeHandler />);
expect(screen.getByRole('button')).to.have.class('rs-column-resize-spanner');
});
it('Should be 100 the `height` ', () => {
render(<ColumnResizeHandler height={100} />);
expect(screen.getByRole('button')).to.style('height', '100px');
});
it('Should have a `left` style', () => {
const columnWidth = 100;
const columnLeft = 100;
render(
<ColumnResizeHandler defaultColumnWidth={columnWidth} columnLeft={columnLeft} />
);
expect(screen.getByRole('button')).to.style('left', `${columnWidth + columnLeft + handlerLeft}px`);
});
it('Should call `onColumnResizeStart` callback ', done => {
const doneOp = () => {
done();
};
render(<ColumnResizeHandler onColumnResizeStart={doneOp} />);
fireEvent.mouseDown(screen.getByRole('button'));
});
});