當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript harness.Harness類代碼示例

本文整理匯總了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'
			}, []));
		},
開發者ID:dylans,項目名稱:widgets,代碼行數:30,代碼來源:Tab.ts

示例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,
開發者ID:bitpshr,項目名稱:widgets,代碼行數:31,代碼來源:CalendarCell.ts

示例3:

	it('defaults max width to 100', () => {
		widget.setProperties({
			value: 50
		});

		widget.expectRender(expectedVDom({ width: 50, output: '50%', value: 50 }));
	});
開發者ID:dylans,項目名稱:widgets,代碼行數:7,代碼來源:Progress.ts

示例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);
	});
開發者ID:dylans,項目名稱:widgets,代碼行數:15,代碼來源:Progress.ts


注:本文中的@dojo/test-extras/harness.Harness類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。