Skip to content

Commit

Permalink
fix: change to pipes in site
Browse files Browse the repository at this point in the history
  • Loading branch information
chensimeng committed Sep 17, 2020
1 parent 01e2bc3 commit f332fc6
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 43 deletions.
50 changes: 25 additions & 25 deletions components/pipes/nz-bytes.pipe.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@ describe('NzBytesPipe', () => {
pipe = new NzBytesPipe();
});

it('Should return 120 B', () => {
const result = pipe.transform(120, 0);
expect(result).toEqual('120 B');
it('Should return 150 B', () => {
const result = pipe.transform(150, 0);
expect(result).toEqual('150 B');
});

it('Should return 465 B', () => {
const result = pipe.transform(465.56791, 2);
expect(result).toEqual('465 B');
it('Should return 155 B', () => {
const result = pipe.transform(155, 2);
expect(result).toEqual('155 B');
});

it('Should return 50 B', () => {
const result = pipe.transform(55.5, 1);
expect(result).toEqual('50 B');
it('Should return 155 B', () => {
const result = pipe.transform(155, 1);
expect(result).toEqual('155 B');
});

it('Should return 9 kB', () => {
it('Should return 1 kB', () => {
const result = pipe.transform(1024, 0);
expect(result).toEqual('9 kB');
expect(result).toEqual('1 kB');
});

it('Should return 1 kB', () => {
it('Should return 1 kB #2', () => {
const result = pipe.transform(1, 0, 'kB');
expect(result).toEqual('1 kB');
});
Expand All @@ -37,20 +37,20 @@ describe('NzBytesPipe', () => {
expect(result).toEqual('1 kB');
});

it('Should return 345 kB, #1', () => {
const kB = 1024 * 345;
it('Should return 890 kB', () => {
const kB = 1024 * 890;
const result = pipe.transform(kB, 0);
expect(result).toEqual('345 kB');
expect(result).toEqual('890 kB');
});

it('Should return 345 kB, #2', () => {
const result = pipe.transform(345, 0, 'kB');
expect(result).toEqual('345 kB');
it('Should return 890 kB #2', () => {
const result = pipe.transform(890, 0, 'kB');
expect(result).toEqual('890 kB');
});

it('Should return 666 kB, #3', () => {
const result = pipe.transform(666, 0, 'KB');
expect(result).toEqual('666 kB');
it('Should return 890 kB #3', () => {
const result = pipe.transform(890, 0, 'KB');
expect(result).toEqual('890 kB');
});

it('Should return 1023 kB', () => {
Expand All @@ -59,13 +59,13 @@ describe('NzBytesPipe', () => {
expect(result).toEqual('1023 kB');
});

it('Should return 241 MB, #1', () => {
it('Should return 241 MB', () => {
const mb = 1024 * 1024 * 240.5691;
const result = pipe.transform(mb, 0);
expect(result).toEqual('241 MB');
});

it('Should return 241 MB, #2', () => {
it('Should return 241 MB', () => {
const mb = 240.5691 / 1024;
const result = pipe.transform(mb, 0, 'GB');
expect(result).toEqual('241 MB');
Expand All @@ -77,13 +77,13 @@ describe('NzBytesPipe', () => {
expect(result).toEqual('240.54 MB');
});

it('Should return 1023 MB, #1', () => {
it('Should return 1023 MB', () => {
const mb = 1024 * 1024 * 1023;
const result = pipe.transform(mb, 2);
expect(result).toEqual('1023 MB');
});

it('Should return 1023 MB, #2', () => {
it('Should return 1023 MB #2', () => {
const kB = 1024 * 1023;
const result = pipe.transform(kB, 2, 'kB');
expect(result).toEqual('1023 MB');
Expand Down
36 changes: 18 additions & 18 deletions components/pipes/nz-css-unit.pipe.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@ describe('NzToCssUnitPipe', () => {
pipe = new NzToCssUnitPipe();
});

it('Should ToCssUnit', () => {
expect(pipe.transform('100')).toEqual('100px');
});
describe('number', () => {
it('Should ToCssUnit', () => {
expect(pipe.transform(100)).toEqual('100px');
});

it('Should ToCssUnit but typeof value is String', () => {
expect(pipe.transform('100px')).toEqual('100px');
});
it('Should ToCssUnit', () => {
expect(pipe.transform(100, 'px')).toEqual('100px');
});

it('Should ToCssUnit but defaultUnit is defined', () => {
expect(pipe.transform('100', 'pt')).toEqual('100pt');
it('Should ToCssUnit but defaultUnit is defined', () => {
expect(pipe.transform(100, 'pt')).toEqual('100pt');
});
});

it('Should ToCssUnit but defaultUnit is defined and typeof value is String', () => {
expect(pipe.transform('100px', 'pt')).toEqual('100px');
});
describe('string', () => {
it('Should ToCssUnit but typeof value is String', () => {
expect(pipe.transform('100px')).toEqual('100px');
});

// it('Should ToCssUnit but typeof value is null', () => {
// expect(pipe.transform(null)).toEqual('0px');
// });
//
// it('Should ToCssUnit but typeof value is undefined', () => {
// expect(pipe.transform(undefined)).toEqual(undefined);
// });
it('Should ToCssUnit but defaultUnit is defined and typeof value is String', () => {
expect(pipe.transform('100px', 'pt')).toEqual('100px');
});
});
});

0 comments on commit f332fc6

Please sign in to comment.