@progress/kendo-e2e
Version:
Kendo UI end-to-end test utilities.
73 lines • 3.2 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.TabStrip = void 0;
const const_1 = require("./const");
const ui_component_1 = require("./ui-component");
class TabStrip extends ui_component_1.UIComponent {
constructor(browser, locator = TabStrip.SELECTOR, parentElement) {
super(browser, locator, parentElement);
this.parentElement = parentElement;
}
getTabGroup() {
return __awaiter(this, void 0, void 0, function* () {
return yield this.findChild(`.k-tabstrip-items`);
});
}
getTabsCount() {
return __awaiter(this, arguments, void 0, function* ({ waitForTab = true } = {}) {
return (yield this.findChildren(`li.k-tabstrip-item`, { waitForChild: waitForTab })).length;
});
}
getTabByIndex(index) {
return __awaiter(this, void 0, void 0, function* () {
return yield this.findChild(`li.k-tabstrip-item:nth-of-type(${index})`);
});
}
getContentByIndex(index) {
return __awaiter(this, void 0, void 0, function* () {
const rootId = yield (yield this.root()).getAttribute('id');
const locator = rootId !== undefined
? `#${rootId}-${index}.k-content`
: `#tabstrip-${index}.k-content`;
return yield this.findChild(locator);
});
}
getTabContent(index) {
return __awaiter(this, void 0, void 0, function* () {
return (yield this.getContentByIndex(index)).getText();
});
}
selectTabByIndex(index) {
return __awaiter(this, void 0, void 0, function* () {
yield (yield this.getTabByIndex(index)).click();
});
}
isTabActive(index) {
return __awaiter(this, void 0, void 0, function* () {
return (yield (yield this.getTabByIndex(index)).getAttribute('class')).includes('k-active');
});
}
isTabFocused(index) {
return __awaiter(this, void 0, void 0, function* () {
return (yield (yield this.getTabByIndex(index)).getAttribute('class')).includes('k-focus');
});
}
isContentActive(index) {
return __awaiter(this, void 0, void 0, function* () {
const content = yield this.getContentByIndex(index);
return (yield content.getAttribute('class')).includes('k-active');
});
}
}
exports.TabStrip = TabStrip;
TabStrip.SELECTOR = const_1.SELECTORS.TABSTRIP;
//# sourceMappingURL=tabstrip.js.map