1 | import { expect } from 'chai';
|
2 | import { countRowSpan } from '../src';
|
3 |
|
4 | describe('utils.countRowSpan', function () {
|
5 | it('returns one if there are no children', function () {
|
6 | const columns = [{
|
7 | foo: 'bar'
|
8 | }];
|
9 |
|
10 | expect(countRowSpan(columns)).to.equal(1);
|
11 | });
|
12 |
|
13 | it('returns two if there are only immediate children', function () {
|
14 | const childColumns = [{
|
15 | foo: 'bar'
|
16 | }];
|
17 | const columns = [{
|
18 | children: childColumns
|
19 | }];
|
20 |
|
21 | expect(countRowSpan(columns)).to.equal(2);
|
22 | });
|
23 |
|
24 | it('returns three if children have children', function () {
|
25 | const childColumns = [{
|
26 | foo: 'bar',
|
27 | children: [{
|
28 | bar: 'baz'
|
29 | }]
|
30 | }];
|
31 | const columns = [{
|
32 | children: childColumns
|
33 | }];
|
34 |
|
35 | expect(countRowSpan(columns)).to.equal(3);
|
36 | });
|
37 | });
|