本文整理匯總了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,