UNPKG

@awsui/components-react

Version:

AWS UI is a collection of [React](https://reactjs.org/) components that help create intuitive, responsive, and accessible user experiences for web applications. It is developed by Amazon Web Services (AWS). This work is available under the terms of the [A

62 lines (61 loc) 3.41 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); var dom_1 = require("@awsui/test-utils-core/dom"); var styles_selectors_js_1 = require("../../../button-dropdown/styles.selectors.js"); var styles_selectors_js_2 = require("../../../button-dropdown/item-element/styles.selectors.js"); var styles_selectors_js_3 = require("../../../button-dropdown/category-elements/styles.selectors.js"); var styles_selectors_js_4 = require("../../../button/styles.selectors.js"); var dropdown_1 = require("../internal/dropdown"); var ButtonDropdownWrapper = (function (_super) { __extends(ButtonDropdownWrapper, _super); function ButtonDropdownWrapper() { return _super !== null && _super.apply(this, arguments) || this; } ButtonDropdownWrapper.prototype.findNativeButton = function () { return this.find("button." + styles_selectors_js_4.default.button); }; ButtonDropdownWrapper.prototype.findOpenDropdown = function () { var dropdown = new dropdown_1.default(this.getElement()); return dropdown.findOpenDropdown(); }; ButtonDropdownWrapper.prototype.findItemById = function (id) { return this.find("." + styles_selectors_js_2.default['item-element'] + "[data-testid=\"" + id + "\"]"); }; ButtonDropdownWrapper.prototype.findExpandableCategoryById = function (id) { return this.find("." + styles_selectors_js_3.default['expandable-header'] + "[data-testid=\"" + id + "\"]"); }; ButtonDropdownWrapper.prototype.findHighlightedItem = function () { return this.find("." + styles_selectors_js_2.default['item-element'] + "." + styles_selectors_js_2.default.highlighted); }; ButtonDropdownWrapper.prototype.findItems = function () { return this.findAll("." + styles_selectors_js_2.default['item-element']); }; ButtonDropdownWrapper.prototype.openDropdown = function () { this.findNativeButton().click(); }; ButtonDropdownWrapper.rootSelector = styles_selectors_js_1.default['button-dropdown']; __decorate([ dom_1.usesDom ], ButtonDropdownWrapper.prototype, "openDropdown", null); return ButtonDropdownWrapper; }(dom_1.ComponentWrapper)); exports.default = ButtonDropdownWrapper;