本文整理汇总了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);
});
示例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,
示例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',
示例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'
}, []));
},
示例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);
});
});
示例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);
});
示例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 })
])
);
});
示例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 }, [])
])
);
});
示例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({
示例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,