本文整理汇总了TypeScript中@dojo/test-extras/harness.Harness类的典型用法代码示例。如果您正苦于以下问题:TypeScript Harness类的具体用法?TypeScript Harness怎么用?TypeScript Harness使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Harness类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: harness
const { registerSuite } = intern.getInterface('object');
import harness, { Harness } from '@dojo/test-extras/harness';
import { v } from '@dojo/widget-core/d';
import Tab from '../../Tab';
import * as css from '../../../theme/tabcontroller/tabController.m.css';
let widget: Harness<Tab>;
registerSuite('Tab', {
beforeEach() {
widget = harness(Tab);
},
afterEach() {
widget.destroy();
},
tests: {
'default properties'() {
widget.setProperties({ key: 'foo' });
widget.expectRender(v('div', {
'aria-labelledby': undefined,
classes: css.tab,
id: undefined,
role: 'tabpanel'
}, []));
},
示例2: harness
const { registerSuite } = intern.getInterface('object');
const { assert } = intern.getPlugin('chai');
import harness, { Harness } from '@dojo/test-extras/harness';
import { v } from '@dojo/widget-core/d';
import CalendarCell from '../../CalendarCell';
import * as css from '../../styles/calendar.m.css';
let widget: Harness<CalendarCell>;
registerSuite('CalendarCell', {
beforeEach() {
widget = harness(CalendarCell);
},
afterEach() {
widget.destroy();
},
tests: {
'Calendar cell with default properties'() {
widget.setProperties({
date: 1
});
widget.expectRender(v('td', {
key: 'root',
role: 'gridcell',
'aria-selected': 'false',
tabIndex: -1,
示例3:
it('defaults max width to 100', () => {
widget.setProperties({
value: 50
});
widget.expectRender(expectedVDom({ width: 50, output: '50%', value: 50 }));
});
示例4: expectedVDom
it('accepts aria properties', () => {
widget.setProperties({
value: 50,
aria: {
describedBy: 'foo',
valueNow: 'overridden'
}
});
const expected = expectedVDom({ width: 50, output: '50%', value: 50 });
assignChildProperties(expected, '0', {
'aria-describedby': 'foo'
});
widget.expectRender(expected);
});