本文整理汇总了TypeScript中@angular/common.DeprecatedCurrencyPipe类的典型用法代码示例。如果您正苦于以下问题:TypeScript DeprecatedCurrencyPipe类的具体用法?TypeScript DeprecatedCurrencyPipe怎么用?TypeScript DeprecatedCurrencyPipe使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DeprecatedCurrencyPipe类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: describe
describe('DeprecatedCurrencyPipe', () => {
let pipe: DeprecatedCurrencyPipe;
beforeEach(() => { pipe = new DeprecatedCurrencyPipe('en-US'); });
describe('transform', () => {
it('should return correct value for numbers', () => {
// In old Chrome, default formatiing for USD is different
if (browserDetection.isOldChrome) {
expect(normalize(pipe.transform(123) !)).toEqual('USD123');
} else {
expect(normalize(pipe.transform(123) !)).toEqual('USD123.00');
}
expect(normalize(pipe.transform(12, 'EUR', false, '.1') !)).toEqual('EUR12.0');
expect(normalize(pipe.transform(5.1234, 'USD', false, '.0-3') !)).toEqual('USD5.123');
});
it('should not support other objects',
() => { expect(() => pipe.transform(new Object())).toThrowError(); });
});
});
示例2: it
it('should return correct value for numbers', () => {
// In old Chrome, default formatiing for USD is different
if (browserDetection.isOldChrome) {
expect(normalize(pipe.transform(123) !)).toEqual('USD123');
} else {
expect(normalize(pipe.transform(123) !)).toEqual('USD123.00');
}
expect(normalize(pipe.transform(12, 'EUR', false, '.1') !)).toEqual('EUR12.0');
expect(normalize(pipe.transform(5.1234, 'USD', false, '.0-3') !)).toEqual('USD5.123');
});
示例3: expect
() => { expect(() => pipe.transform(new Object())).toThrowError(); });