ohayolibs
Version:
Ohayo is a set of essential modules for ohayojp.
57 lines (51 loc) • 1.37 kB
text/typescript
import { DebugElement } from '@angular/core';
import { ComponentFixture, fakeAsync } from '@angular/core/testing';
import { createTestContext } from '@ohayo/testing';
import { configureSFTestSuite, SFPage, TestFormComponent } from '../../../spec/base.spec';
describe('form: widget: rate', () => {
let fixture: ComponentFixture<TestFormComponent>;
let dl: DebugElement;
let context: TestFormComponent;
let page: SFPage;
const widget = 'rate';
configureSFTestSuite();
beforeEach(() => {
({ fixture, dl, context } = createTestContext(TestFormComponent));
page = new SFPage(context.comp);
page.prop(dl, context, fixture);
});
it('should be working', fakeAsync(() => {
page
.newSchema({
properties: {
a: {
type: 'number',
title: '评级',
default: 2,
ui: {
widget,
},
},
},
})
.time()
.checkCount('.ant-rate-star-full', 2);
}));
it('should be show text', fakeAsync(() => {
page
.newSchema({
properties: {
a: {
type: 'number',
title: '评级',
default: 2,
ui: {
widget,
text: '{{value}} A',
},
},
},
})
.checkElText('.ant-rate-text', '2 A');
}));
});