Blame view
node_modules/table/test/calculateRowHeightIndex.js
1.69 KB
f7563de62
|
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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
/* eslint-disable max-nested-callbacks */ import { expect } from 'chai'; import calculateRowHeightIndex from './../src/calculateRowHeightIndex'; describe('calculateRowHeightIndex', () => { context('single column', () => { context('cell content width is lesser than column width', () => { it('is equal to 1', () => { const data = [ [ 'aaa' ] ]; const config = { columns: { 0: { width: 10, wrapWord: false } } }; const rowSpanIndex = calculateRowHeightIndex(data, config); expect(rowSpanIndex[0]).to.equal(1); }); }); context('cell content width is twice the size of the column width', () => { it('is equal to 2', () => { const data = [ [ 'aaabbb' ] ]; const config = { columns: { 0: { width: 3, wrapWord: false } } }; const rowSpanIndex = calculateRowHeightIndex(data, config); expect(rowSpanIndex[0]).to.equal(2); }); }); }); context('multiple columns', () => { context('multiple cell content width is greater than the column width', () => { it('uses the largest height', () => { const data = [ ['aaabbb'], ['aaabbb'] ]; const config = { columns: { 0: { width: 2, wrapWord: false } } }; const rowSpanIndex = calculateRowHeightIndex(data, config); expect(rowSpanIndex[0]).to.equal(3); }); }); }); }); |