• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript harness.default函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript harness.Harness类代码示例发布时间:2022-05-28
下一篇:
TypeScript Store.Store类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap