@progress/kendo-e2e
Version:
Kendo UI end-to-end test utilities.
55 lines • 2.52 kB
JavaScript
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MultiSelect = void 0;
const selenium_1 = require("../selenium");
const const_1 = require("./const");
const dropdown_1 = require("./dropdown");
class MultiSelect extends dropdown_1.DropDown {
constructor(browser, locator = MultiSelect.SELECTOR, rootElement) {
super(browser, locator, rootElement);
}
type(text_1) {
return __awaiter(this, arguments, void 0, function* (text, { typeFromBeginning = false } = {}) {
const input = yield this.input();
if (typeFromBeginning) {
const rect = yield input.getRect();
yield this.browser.driver.actions({ async: false, bridge: true })
.move({ origin: input, x: 5 - rect.width / 2, y: 5 - rect.height / 2 })
.click()
.perform();
}
else {
yield input.click();
}
yield this.browser.wait(selenium_1.EC.hasFocus(input), { timeout: 3000, message: 'Failed to focus input.' });
yield this.browser.sendKey(text);
});
}
getChip(index) {
return __awaiter(this, void 0, void 0, function* () {
return yield this.findChild(`.k-chip-list .k-chip:nth-of-type(${index})`);
});
}
getChipText(index) {
return __awaiter(this, void 0, void 0, function* () {
return yield (yield this.getChip(index)).getText();
});
}
getChips() {
return __awaiter(this, void 0, void 0, function* () {
return yield this.findChildren('.k-chip-list .k-chip', { waitForChild: false });
});
}
}
exports.MultiSelect = MultiSelect;
MultiSelect.SELECTOR = const_1.SELECTORS.MULTISELECT;
//# sourceMappingURL=multiselect.js.map
;