-
-
Notifications
You must be signed in to change notification settings - Fork 77
/
Copy pathvalidateSpanningCellConfig.ts
60 lines (53 loc) · 1.25 KB
/
validateSpanningCellConfig.ts
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import {
expect,
} from 'chai';
import {
validateSpanningCellConfig,
} from '../src/validateSpanningCellConfig';
import {
baseRows,
} from './spanningCellFixtures';
describe('validateSpanningCellConfig', () => {
it('colSpan = 0', () => {
expect(() => {
validateSpanningCellConfig(baseRows, [{col: 1,
colSpan: 0,
row: 0}]);
}).to.be.throw();
});
it('rowSpan = 0', () => {
expect(() => {
validateSpanningCellConfig(baseRows, [{col: 1,
row: 0,
rowSpan: 0}]);
}).to.be.throw();
});
it('no given colSpan and rowSpan', () => {
expect(() => {
validateSpanningCellConfig(baseRows, [{col: 1,
row: 0}]);
}).to.be.throw();
});
it('topLeft is out of range', () => {
expect(() => {
validateSpanningCellConfig(baseRows, [{col: 4,
row: 0}]);
}).to.be.throw();
});
it('bottomRight is out of range', () => {
expect(() => {
validateSpanningCellConfig(baseRows, [{col: 2,
colSpan: 3,
row: 0}]);
}).to.be.throw();
});
it('overlap', () => {
expect(() => {
validateSpanningCellConfig(baseRows, [{col: 0,
row: 0,
rowSpan: 2}, {col: 0,
colSpan: 2,
row: 1}]);
}).to.be.throw();
});
});