本文整理匯總了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);
});