当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript harness.default函数代码示例

本文整理汇总了TypeScript中@dojo/test-extras/harness.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了default函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: it

	it('with tags', () => {
		const fetchFeed = stub();
		const h = harness(() => w(Tags, { tags: ['first', 'second'], fetchFeed }));
		h.expect(() => v('div', { classes: 'col-md-3' }, [
			v('div', { classes: 'sidebar' }, [
				v('p', ['Popular Tags']),
				v('div', { classes: 'tag-list' }, [
					v('a', { href: '', onclick: () => {}, key: '0', classes: ['tag-pill', 'tag-default'] }, [
						'first'
					]),
					v('a', { href: '', onclick: () => {}, key: '1', classes: ['tag-pill', 'tag-default'] }, [
						'second'
					])
				])
			])
		]));

		h.trigger('@0', 'onclick', mockEvent);
		assert.isTrue(fetchFeed.calledOnce);
	});
开发者ID:agubler,项目名称:examples,代码行数:20,代码来源:Tags.ts

示例2: registerSuite

		id: 'foo',
		key: 'tab-button',
		lang: null,
		onclick: widget.listener,
		onkeydown: widget.listener,
		role: 'tab',
		tabIndex: -1
	}, children);
};

let widget: Harness<TabButton>;

registerSuite('TabButton', {

	beforeEach() {
		widget = harness(TabButton);
	},

	afterEach() {
		widget.destroy();
	},

	tests: {
		'default properties'() {
			widget.setProperties(props());
			widget.expectRender(expected(widget));
		},

		'custom properties'() {
			widget.setProperties(props({
				closeable: true,
开发者ID:dylans,项目名称:widgets,代码行数:31,代码来源:TabButton.ts

示例3: v

			label: 'foo',
			theme: undefined
		}, [ checkboxVdom ]);
	}
	else {
		return v('div', {
			classes: [ css.root, null, null, null, null, null, null, null, null ]
		}, [ checkboxVdom ]);
	}
};

let widget: Harness<Checkbox>;

registerSuite('Checkbox', {
	beforeEach() {
		widget = harness(Checkbox);
	},

	afterEach() {
		widget.destroy();
	},

	tests: {
		'default properties'() {
			widget.expectRender(expected(widget));
		},

		'custom properties'() {
			widget.setProperties({
				checked: true,
				describedBy: 'foo',
开发者ID:bitpshr,项目名称:widgets,代码行数:31,代码来源:Checkbox.ts

示例4: registerSuite

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

示例5: Promise

	it('should request data when the bottom is visible', () => {
		const loadStub = () => {
			return Promise.resolve([v('div', {}, ['test'])]);
		};

		intersectionGetStub = () => {
			return {
				isIntersecting: true
			};
		};

		const h = harness(() => w(TestWidget, {
			onRequestItems: loadStub
		}));

		h.expect(() =>
			v('div', {}, [
				v('div', { key: 'bottom', classes: css.bottom })
			])
		);

		return new Promise(resolve => {
			setTimeout(() => {
				h.expect(() =>
					v('div', {}, [
						v('div', {}, ['test']),
						v('div', { key: 'bottom', classes: css.bottom })
					])
				);

				resolve();
			}, 10);
		});
	});
开发者ID:agubler,项目名称:examples,代码行数:34,代码来源:InfiniteList.ts

示例6: stub

	it('no tags', () => {
		const fetchFeed = stub();
		const h = harness(() => w(Tags, { fetchFeed }));
		const expected = v('div', { classes: 'col-md-3' }, [
			v('div', { classes: 'sidebar' }, [v('p', ['Popular Tags']), v('div', { classes: 'tag-list' }, [])])
		]);

		h.expect(() => expected);
	});
开发者ID:agubler,项目名称:examples,代码行数:9,代码来源:Tags.ts

示例7: harness

	it('should render', () => {
		const h = harness(() => w(TestWidget, {
			onRequestItems: (index: number) => Promise.resolve([])
		}));
		h.expect(() =>
			v('div', {}, [
				v('div', { key: 'bottom', classes: css.bottom })
			])
		);
	});
开发者ID:agubler,项目名称:examples,代码行数:10,代码来源:InfiniteList.ts

示例8: getData

	it('should render', () => {
		function getData(startIndex: number) {
			return Promise.resolve([]);
		}

		const h = harness(() => w(App, {}));
		h.expect(() =>
			v('div', { classes: css.root }, [
				v('h1', { classes: css.title }, ['Infinite Scrolling List']),
				w(InfiniteList, { onRequestItems: getData }, [])
			])
		);
	});
开发者ID:agubler,项目名称:examples,代码行数:13,代码来源:App.ts

示例9: harness

const { registerSuite } = intern.getInterface('object');

import { v } from '@dojo/widget-core/d';
import harness, { Harness } from '@dojo/test-extras/harness';

import Tooltip, { Orientation } from './../../Tooltip';
import * as css from './../../styles/tooltip.m.css';

let widget: Harness<Tooltip>;

registerSuite('Tooltip', {
	beforeEach() {
		widget = harness(Tooltip);
	},

	afterEach() {
		widget.destroy();
	},

	tests: {
		'should construct Tooltip'() {
			widget.expectRender(v('div', {
				classes: [ css.right, css.rootFixed, css.rightFixed ]
			}, [
				v('div', { key: 'target' }, []),
				null
			]));
		},

		'should render content if open'() {
			widget.setProperties({
开发者ID:bitpshr,项目名称:widgets,代码行数:31,代码来源:Tooltip.ts

示例10: harness

const { registerSuite } = intern.getInterface('object');

import harness, { Harness } from '@dojo/test-extras/harness';
import { v } from '@dojo/widget-core/d';

import Label from '../../Label';
import * as css from '../../../theme/label/label.m.css';
import * as baseCss from '../../../common/styles/base.m.css';

let widget: Harness<Label>;

registerSuite('Label', {

	beforeEach() {
		widget = harness(Label);
	},

	afterEach() {
		widget.destroy();
	},

	tests: {
		simple() {
			widget.setChildren([ 'baz' ]);

			widget.expectRender(v('label', {
				classes: [
					css.root,
					null,
					null,
					null,
开发者ID:dylans,项目名称:widgets,代码行数:31,代码来源:Label.ts


注:本文中的@dojo/test-extras/harness.default函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。