当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript DataFormatter.DataFormatter类代码示例

本文整理汇总了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);
    });

  });
开发者ID:twosigma,项目名称:beaker-notebook,代码行数:28,代码来源:DataFormatter.spec.ts

示例2: it

 it('should return "html" function', () => {
   expect(dataFormatter.getFormatFnByDisplayType(ALL_TYPES.html)).to.equal(dataFormatter['html']);
 });
开发者ID:twosigma,项目名称:beaker-notebook,代码行数:3,代码来源:DataFormatter.spec.ts


注:本文中的@beakerx/tableDisplay/dataGrid/DataFormatter.DataFormatter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。