當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Command.findByCssSelector函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。