ohayolibs
Version:
Ohayo is a set of essential modules for ohayojp.
36 lines (29 loc) • 1.09 kB
text/typescript
import { Component, ViewChild } from '@angular/core';
import { fakeAsync } from '@angular/core/testing';
import { checkDelay, PageG2 } from '@ohayo/testing';
import { G2GaugeComponent } from './gauge.component';
import { G2GaugeModule } from './gauge.module';
describe('chart: gauge', () => {
let page: PageG2<TestComponent>;
describe('', () => {
beforeEach(fakeAsync(() => {
page = new PageG2<TestComponent>().makeModule(G2GaugeModule, TestComponent);
}));
afterEach(() => page.context.comp.ngOnDestroy());
it('should be working', () => {
expect(page.chart.geometries[0].data[0].value).toBe(10);
page.context.percent = 30;
page.dc();
expect(page.chart.geometries[0].data[0].value).toBe(30);
});
});
it('#delay', fakeAsync(() => checkDelay(G2GaugeModule, TestComponent)));
});
({
template: ` <g2-gauge #comp [title]="'核销率'" height="164" [percent]="percent" [delay]="delay"></g2-gauge> `,
})
class TestComponent {
('comp', { static: true }) comp: G2GaugeComponent;
percent = 10;
delay = 0;
}