當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。