本文整理汇总了TypeScript中@theintern/leadfoot/Command.findByCssSelector函数的典型用法代码示例。如果您正苦于以下问题:TypeScript findByCssSelector函数的具体用法?TypeScript findByCssSelector怎么用?TypeScript findByCssSelector使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了findByCssSelector函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: resize
function resize(command: Command<Element | void>, x: number, y: number): Command<void> {
return command
.findByCssSelector(`.${css.divider}`)
.moveMouseTo()
.pressMouseButton(0)
.moveMouseTo(x, y)
.releaseMouseButton(0)
.sleep(DELAY)
.end();
}
开发者ID:bryanforbes,项目名称:widgets,代码行数:10,代码来源:SplitPane.ts
示例2: testResizes
function testResizes(command: Command<Element | void>, resizes: Coord[], expected: CoordTest[]) {
assert.strictEqual(resizes.length, expected.length, 'Resizes array should match expected array.');
let currentX: number;
let currentY: number;
command = command
.findByCssSelector(`.${css.divider}`)
.getPosition()
.then(({ x, y }) => {
currentX = x;
currentY = y;
})
.end();
for (let i = 0; i < resizes.length; i++) {
const move = resizes[i];
const delta = expected[i];
command = resize(command, move.x, move.y)
.findByCssSelector(`.${css.divider}`)
.getPosition()
.then(({ x, y }) => {
if (typeof delta.x === 'function') {
assert.isTrue(delta.x(x), `Resize ${i} should pass x test.`);
}
else {
assert.closeTo(x, currentX + delta.x, ERROR_MARGIN, `Resize ${i} should move x by ${move.x}.`);
}
if (typeof delta.y === 'function') {
assert.isTrue(delta.y(y), `Resize ${i} should pass y test.`);
}
else {
assert.closeTo(y, currentY + delta.y, ERROR_MARGIN, `Resize ${i} should move y by ${move.y}.`);
}
currentX = x;
currentY = y;
})
.end();
}
return command;
}
开发者ID:bryanforbes,项目名称:widgets,代码行数:41,代码来源:SplitPane.ts
注:本文中的@theintern/leadfoot/Command.findByCssSelector函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论