Skip to content

Commit

Permalink
feat(rng-diff): enable custom suffic string
Browse files Browse the repository at this point in the history
  • Loading branch information
ElonH committed Jun 2, 2020
1 parent 2a927ee commit b2e6df3
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 5 deletions.
27 changes: 27 additions & 0 deletions src/app/components/diff/diff.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* tslint:disable:no-unused-variable */
import { DebugElement } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';

import { RngDiffComponent } from './diff.component';

describe('DiffComponent', () => {
let component: RngDiffComponent;
let fixture: ComponentFixture<RngDiffComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [RngDiffComponent],
}).compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(RngDiffComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { FormatBytes } from '../../utils/format-bytes';
@Component({
selector: 'app-rng-diff',
template: `
<span> {{ (val < 0 ? '-' + FormatBytes(-val) : FormatBytes(val)) + '/s' }} </span>
<span> {{ (val < 0 ? '-' + FormatBytes(-val) : FormatBytes(val)) + suffic }} </span>
<nb-icon
[icon]="'arrow-' + (val < 0 ? 'down' : 'up')"
[status]="val < 0 ? 'danger' : 'success'"
Expand All @@ -21,8 +21,9 @@ import { FormatBytes } from '../../utils/format-bytes';
],
})
export class RngDiffComponent implements OnInit {
@Input()
val = 0;
@Input() val = 0;

@Input() suffic = '';

FormatBytes = FormatBytes;

Expand Down
2 changes: 1 addition & 1 deletion src/app/components/rng.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { NgModule } from '@angular/core';
import { NbIconModule } from '@nebular/theme';
import { ChartsModule } from 'ng2-charts';
import { TableModule } from 'ngx-easy-table';
import { RngDiffComponent } from './diff/diff.component';
import { RngKeyValueTableComponent } from './key-value-table/key-value-table.component';
import { RngSpeedChartComponent } from './speed-chart/speed-chart.component';
import { RngDiffComponent } from './speed-chart/speed-diff.component';
import { RngSummaryComponent } from './summary/summary.component';

const RngComponents = [
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/speed-chart/speed-chart.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { FormatBytes } from '../../utils/format-bytes';
[colors]="lineChartColors"
chartType="line"
></canvas>
<app-rng-diff [val]="speedDiff"> </app-rng-diff>
<app-rng-diff [val]="speedDiff" [suffic]="'/s'"> </app-rng-diff>
</div>
`,
styles: [
Expand Down

0 comments on commit b2e6df3

Please sign in to comment.