forked from bvaughn/react-virtualized
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFlexColumn.test.js
More file actions
32 lines (27 loc) · 1.04 KB
/
FlexColumn.test.js
File metadata and controls
32 lines (27 loc) · 1.04 KB
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
import Immutable from 'immutable'
import { defaultCellDataGetter, defaultCellRenderer } from './FlexColumn'
describe('Column', () => {
const map = Immutable.Map({
foo: 'Foo',
bar: 1
})
describe('defaultCellDataGetter', () => {
it('should return a value for specified attributes', () => {
expect(defaultCellDataGetter('foo', map)).toEqual('Foo')
expect(defaultCellDataGetter('bar', map)).toEqual(1)
})
it('should return undefined for missing attributes', () => {
expect(defaultCellDataGetter('baz', map)).toEqual(undefined)
})
})
describe('defaultCellRenderer', () => {
it('should render a value for specified attributes', () => {
expect(defaultCellRenderer('Foo', 'foo', map, 0)).toEqual('Foo')
expect(defaultCellRenderer(1, 'bar', map, 0)).toEqual('1')
})
it('should render empty string for null or missing attributes', () => {
expect(defaultCellRenderer(null, 'baz', map, 0)).toEqual('')
expect(defaultCellRenderer(undefined, 'baz', map, 0)).toEqual('')
})
})
})