本文整理匯總了TypeScript中@ephox/agar.Waiter.sTryUntilPredicate方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Waiter.sTryUntilPredicate方法的具體用法?TypeScript Waiter.sTryUntilPredicate怎麽用?TypeScript Waiter.sTryUntilPredicate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@ephox/agar.Waiter
的用法示例。
在下文中一共展示了Waiter.sTryUntilPredicate方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: menu
//.........這裏部分代碼省略.........
)
]),
UiControls.sSetValue(input.element(), 'He'),
Step.sync(() => {
AlloyTriggers.emit(input, NativeEvents.input());
}),
Waiter.sTryUntil(
'Waiting for the menu to update',
Chain.asStep(sink, [
UiFinder.cFindAllIn('.tox-collection__item'),
Chain.op((menuItems) => {
if (menuItems.length > 2) {
throw Error('Menu hasn\'t been updated yet');
}
})
]),
100,
3000
),
Chain.asStep(sink, [
UiFinder.cFindIn('[role="menu"]'),
Assertions.cAssertStructure(
'Checking the menu shows items that match the input string',
ApproxStructure.build((s, str, arr) => {
return s.element('div', {
classes: [ arr.has('tox-menu'), arr.has('tox-collection--list'), arr.has('tox-collection') ],
children: [
s.element('div', {
classes: [ arr.has('tox-collection__group') ],
children: [
s.element('div', {
classes: [ arr.has('tox-collection__item')],
children: [
s.element('div', { html: str.is('Header1') })
]
}),
s.element('div', {
classes: [ arr.has('tox-collection__item')],
children: [
s.element('div', { html: str.is('Header2') })
]
})
]
})
]
});
})
)
]),
store.sAssertEq('nothing in store ... before selecting item', []),
Keyboard.sKeydown(doc, Keys.enter(), { }),
Step.sync(() => {
Assertions.assertEq('Checking Value.get', '#header', Value.get(input.element()));
const repValue = Representing.getValue(input);
Assertions.assertEq('Checking Rep.getValue',
{
value: '#header',
meta: { text: 'Header1' }
},
{
value: repValue.value,
meta: { text: repValue.meta.text }
}
);
}),
store.sAssertEq('addToHistory called ... before firing attach', [ 'addToHistory' ]),
Logger.t(
'Check that attach fires',
Step.sync(() => {
const repValue = Representing.getValue(input);
repValue.meta.attach();
})
),
store.sAssertEq('Attach should be in store ... after firing attach', [ 'addToHistory' , 'header1.attach' ]),
Mouse.sClickOn(component.element(), 'button'),
store.sAssertEq(
'URL picker should have been opened ... after clicking button',
[ 'addToHistory' , 'header1.attach', 'urlpicker' ]
),
Waiter.sTryUntilPredicate('Checking Value.get', () => {
return 'http://tiny.cloud' === Value.get(input.element());
}, 100, 4000),
Step.sync(() => {
const repValue = Representing.getValue(input);
Assertions.assertEq('Checking Rep.getValue', {
value: 'http://tiny.cloud',
meta: { before: '#header'}
}, repValue);
}),
TestHelpers.GuiSetup.mRemoveStyles
];
}, () => {