@awsui/components-react
Version:
On July 19th, 2022, we launched [Cloudscape Design System](https://cloudscape.design). Cloudscape is an evolution of AWS-UI. It consists of user interface guidelines, front-end components, design resources, and development tools for building intuitive, en
57 lines • 2.52 kB
JavaScript
;
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
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 });
const dom_1 = require("@awsui/test-utils-core/dom");
const utils_dom_1 = require("@awsui/test-utils-core/utils-dom");
const styles_selectors_js_1 = require("../../../prompt-input/test-classes/styles.selectors.js");
class PromptInputWrapper extends dom_1.ComponentWrapper {
findNativeTextarea() {
return this.findByClassName(styles_selectors_js_1.default.textarea);
}
findActionButton() {
return this.findByClassName(styles_selectors_js_1.default['action-button']);
}
findSecondaryActions() {
return this.findByClassName(styles_selectors_js_1.default['secondary-actions']);
}
findSecondaryContent() {
return this.findByClassName(styles_selectors_js_1.default['secondary-content']);
}
/**
* Gets the value of the component.
*
* Returns the current value of the textarea.
*/
getTextareaValue() {
return this.findNativeTextarea().getElement().value;
}
/**
* Sets the value of the component and calls the onChange handler.
*
* @param value value to set the textarea to.
*/
setTextareaValue(value) {
const element = this.findNativeTextarea().getElement();
(0, utils_dom_1.act)(() => {
const event = new Event('change', { bubbles: true, cancelable: false });
(0, utils_dom_1.setNativeValue)(element, value);
element.dispatchEvent(event);
});
}
}
PromptInputWrapper.rootSelector = styles_selectors_js_1.default.root;
__decorate([
dom_1.usesDom
], PromptInputWrapper.prototype, "getTextareaValue", null);
__decorate([
dom_1.usesDom
], PromptInputWrapper.prototype, "setTextareaValue", null);
exports.default = PromptInputWrapper;
//# sourceMappingURL=index.js.map