本文整理汇总了TypeScript中@beakerx/tableDisplay/dataGrid/DataFormatter.DataFormatter类的典型用法代码示例。如果您正苦于以下问题:TypeScript DataFormatter类的具体用法?TypeScript DataFormatter怎么用?TypeScript DataFormatter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DataFormatter类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: describe
describe('dataFormatter.string', () => {
const stringFormatFn = dataFormatter.getFormatFnByDisplayType(ALL_TYPES.string);
it('should return empty string', () => {
expect(stringFormatFn({ ...cellConfig, value: '' })).to.equal('');
});
it('should not escape html characters', () => {
expect(stringFormatFn({ ...cellConfig, value: '&test<>"Works"Ok/<>' }))
.to.equal('&test<>"Works"Ok/<>');
});
/*
it('should convert to date', () => {
expect(stringFormatFn({ ...cellConfig, value: { timestamp: 1516697673043, type: 'Date' }}))
.to.equal('20180123 03:54:33.043 -0500');
});
*/
it('should return given value', () => {
expect(stringFormatFn({ ...cellConfig, value: 1 })).to.equal(1);
expect(stringFormatFn({ ...cellConfig, value: null })).to.equal('');
expect(stringFormatFn({ ...cellConfig, value: '' })).to.equal('');
expect(stringFormatFn({ ...cellConfig, value: 0 })).to.equal(0);
expect(stringFormatFn({ ...cellConfig, value: false })).to.equal(false);
});
});
示例2: it
it('should return "html" function', () => {
expect(dataFormatter.getFormatFnByDisplayType(ALL_TYPES.html)).to.equal(dataFormatter['html']);
});