@nova-ui/bits
Version:
SolarWinds Nova Framework
67 lines • 4.48 kB
JavaScript
"use strict";
// © 2022 SolarWinds Worldwide, LLC. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ComboboxAtom = void 0;
const tslib_1 = require("tslib");
const protractor_1 = require("protractor");
const atom_1 = require("../../atom");
const button_atom_1 = require("../button/button.atom");
const icon_atom_1 = require("../icon/icon.atom");
const popup_atom_1 = require("../popup/popup.atom");
const basic_select_atom_1 = require("../select/basic-select.atom");
const textbox_atom_1 = require("../textbox/textbox.atom");
class ComboboxAtom extends basic_select_atom_1.BasicSelectAtom {
constructor() {
super(...arguments);
this.root = this.getElement();
this.containerFinder = this.root
.all(protractor_1.by.className("nui-combobox__container"))
.first();
this.textboxFinder = this.containerFinder
.all(protractor_1.by.className("nui-combobox__input"))
.first();
this.iconAtom = atom_1.Atom.findIn(icon_atom_1.IconAtom, this.root.all(protractor_1.by.className("nui-combobox__icon")).first());
this.textbox = atom_1.Atom.findIn(textbox_atom_1.TextboxAtom, this.textboxFinder);
this.clearButton = atom_1.Atom.findIn(button_atom_1.ButtonAtom, this.containerFinder
.all(protractor_1.by.className("nui-combobox__remove-value"))
.first());
this.toggleButton = atom_1.Atom.findIn(button_atom_1.ButtonAtom, this.containerFinder.all(protractor_1.by.className("nui-combobox__toggle")).first());
this.popup = atom_1.Atom.findIn(popup_atom_1.PopupAtom, protractor_1.browser.element(protractor_1.by.className("nui-combobox-popup-host")));
this.getIconName = () => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.iconAtom.getName(); });
this.getContainer = () => this.containerFinder;
this.toggleMenu = () => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.toggleButton.click(); });
this.getComboboxPlaceholder = () => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.textbox.input.getAttribute("placeholder"); });
this.getInput = () => this.textbox.input;
this.acceptText = (text) => tslib_1.__awaiter(this, void 0, void 0, function* () {
yield this.textbox.clearText();
return this.textbox.acceptText(text);
});
this.getInputValue = () => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.textbox.getValue(); });
this.clearText = () => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.textbox.clearText(); });
this.acceptInput = (input) => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.textbox.acceptText(input); });
this.getLayoutBlock = () => this.getElementByClass("nui-combobox__layout-block");
this.isRequiredStyleDisplayed = () => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.elementHasClass("nui-combobox__container", "has-error"); });
this.getHighlightedItemsCount = () => tslib_1.__awaiter(this, void 0, void 0, function* () { return this.root.all(protractor_1.by.className("nui-highlighted")).count(); });
}
}
exports.ComboboxAtom = ComboboxAtom;
ComboboxAtom.CSS_CLASS = "nui-combobox";
//# sourceMappingURL=combobox.atom.js.map