code
stringlengths
24
2.07M
docstring
stringlengths
25
85.3k
func_name
stringlengths
1
92
language
stringclasses
1 value
repo
stringlengths
5
64
path
stringlengths
4
172
url
stringlengths
44
218
license
stringclasses
7 values
getAriaActivedescendant() { const { isFocused, focusedItemIndex } = this.state; const { options } = this.props; const isOpen = isMenuOpen(options, isFocused); if (isOpen) { return `lookup-item-${focusedItemIndex}`; } return undefined; }
A Lookup is an autocomplete text input that will search against a database object, it is enhanced by a panel of suggested options. @category Form
getAriaActivedescendant
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
handleChange(value) { const { onChange } = this.props; setTimeout(() => this.containerRef.current.focus(), 0); this.setState({ searchValue: '', }); this.closeMenu(); onChange(value); }
A Lookup is an autocomplete text input that will search against a database object, it is enhanced by a panel of suggested options. @category Form
handleChange
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
handleSearch(event) { const { value } = event.target; this.setState({ searchValue: value, }); this.fireSearch(value); }
A Lookup is an autocomplete text input that will search against a database object, it is enhanced by a panel of suggested options. @category Form
handleSearch
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
handleFocus() { const { onFocus, value } = this.props; this.openMenu(); const eventValue = value || null; onFocus(eventValue); }
A Lookup is an autocomplete text input that will search against a database object, it is enhanced by a panel of suggested options. @category Form
handleFocus
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
handleBlur() { const { onBlur, value } = this.props; this.closeMenu(); const eventValue = value || null; onBlur(eventValue); }
A Lookup is an autocomplete text input that will search against a database object, it is enhanced by a panel of suggested options. @category Form
handleBlur
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
handleClick(event) { const { onClick } = this.props; this.openMenu(); return onClick(event); }
A Lookup is an autocomplete text input that will search against a database object, it is enhanced by a panel of suggested options. @category Form
handleClick
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
handleRemoveValue() { const { onChange, onSearch } = this.props; onChange(null); onSearch(''); setTimeout(() => this.focus(), 0); }
A Lookup is an autocomplete text input that will search against a database object, it is enhanced by a panel of suggested options. @category Form
handleRemoveValue
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
fireSearch(value) { const { onSearch, debounce } = this.props; if (debounce && value) { this.resetTimeout(); this.timeout = setTimeout(() => { onSearch(value); }, 500); } else { this.resetTimeout(); onSearch(value); } }
A Lookup is an autocomplete text input that will search against a database object, it is enhanced by a panel of suggested options. @category Form
fireSearch
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
clearInput() { const searchValue = ''; this.setState({ searchValue, }); this.fireSearch(searchValue); setTimeout(() => this.focus(), 0); }
A Lookup is an autocomplete text input that will search against a database object, it is enhanced by a panel of suggested options. @category Form
clearInput
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
resetTimeout() { if (this.timeout) { clearTimeout(this.timeout); } }
A Lookup is an autocomplete text input that will search against a database object, it is enhanced by a panel of suggested options. @category Form
resetTimeout
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
openMenu() { return this.setState({ isFocused: true, }); }
A Lookup is an autocomplete text input that will search against a database object, it is enhanced by a panel of suggested options. @category Form
openMenu
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
closeMenu() { const { options } = this.state; const { preferredSelectedOption } = this.props; return this.setState({ isFocused: false, isOpen: false, focusedItemIndex: getInitialFocusedIndex(options, preferredSelectedOption), }); }
A Lookup is an autocomplete text input that will search against a database object, it is enhanced by a panel of suggested options. @category Form
closeMenu
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
isLookupOpen() { const { searchValue, isFocused } = this.state; const { options } = this.props; const isMenuEmpty = isFocused && !!searchValue && Array.isArray(options) && options.length === 0; const isOpen = isMenuOpen(options, isFocused); return isOpen || isMenuEmpty; }
A Lookup is an autocomplete text input that will search against a database object, it is enhanced by a panel of suggested options. @category Form
isLookupOpen
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
handleHover(index) { this.setState({ focusedItemIndex: index, }); }
A Lookup is an autocomplete text input that will search against a database object, it is enhanced by a panel of suggested options. @category Form
handleHover
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
handleKeyDown(event) { const { searchValue } = this.state; const { keyCode } = event; if (keyCode === ESCAPE_KEY) { if (searchValue) { event.stopPropagation(); } else if (this.isLookupOpen()) { event.stopPropagation(); this.closeMenu(); } } if (isNavigationKey(keyCode) && this.isLookupOpen()) { event.preventDefault(); event.stopPropagation(); if (this.keyHandlerMap[keyCode]) { this.keyHandlerMap[keyCode](); } } }
A Lookup is an autocomplete text input that will search against a database object, it is enhanced by a panel of suggested options. @category Form
handleKeyDown
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
stopArrowScoll() { if (this.scrollingTimer) { clearTimeout(this.scrollingTimer); } }
A Lookup is an autocomplete text input that will search against a database object, it is enhanced by a panel of suggested options. @category Form
stopArrowScoll
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
scrollTo(offset) { const menu = this.menuRef.current.getRef(); menu.scrollTo(0, offset); }
A Lookup is an autocomplete text input that will search against a database object, it is enhanced by a panel of suggested options. @category Form
scrollTo
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
scrollBy(offset) { const menu = this.menuRef.current.getRef(); menu.scrollBy(0, offset); }
A Lookup is an autocomplete text input that will search against a database object, it is enhanced by a panel of suggested options. @category Form
scrollBy
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
handleScrollUpArrowHover() { this.stopArrowScoll(); const menu = this.menuRef.current.getRef(); this.scrollingTimer = setTimeout(() => { if (menu.scrollTop > 0) { menu.scrollBy(0, -1); setTimeout(this.handleScrollUpArrowHover(), 5); } else { this.stopArrowScoll(); } }, 5); this.updateScrollingArrows(); }
A Lookup is an autocomplete text input that will search against a database object, it is enhanced by a panel of suggested options. @category Form
handleScrollUpArrowHover
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
handleScrollDownArrowHover() { this.stopArrowScoll(); const menu = this.menuRef.current.getRef(); this.scrollingTimer = setTimeout(() => { if (!isScrollPositionAtMenuBottom(menu)) { menu.scrollBy(0, 1); setTimeout(this.handleScrollDownArrowHover(), 5); } else { this.stopArrowScoll(); } }, 5); this.updateScrollingArrows(); }
A Lookup is an autocomplete text input that will search against a database object, it is enhanced by a panel of suggested options. @category Form
handleScrollDownArrowHover
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
updateScrollingArrows() { const menu = this.menuRef.current.getRef(); const showScrollUpArrow = menu.scrollTop > 0; const showScrollDownArrow = !isScrollPositionAtMenuBottom(menu); this.setState({ showScrollUpArrow, showScrollDownArrow, }); }
A Lookup is an autocomplete text input that will search against a database object, it is enhanced by a panel of suggested options. @category Form
updateScrollingArrows
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
handleKeyUpPressed() { const { focusedItemIndex, options } = this.state; if (focusedItemIndex > 0) { const prevIndex = focusedItemIndex - 1; const prevFocusedIndex = options[prevIndex].type === 'header' ? focusedItemIndex - 2 : prevIndex; if (prevFocusedIndex >= 0) { this.setState({ focusedItemIndex: prevFocusedIndex, }); } this.scrollUp(prevFocusedIndex); } }
A Lookup is an autocomplete text input that will search against a database object, it is enhanced by a panel of suggested options. @category Form
handleKeyUpPressed
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
scrollUp(prevFocusedIndex) { const { options } = this.state; const { size } = this.props; const menu = this.menuRef.current.getRef(); const prevIndex = prevFocusedIndex >= 0 ? prevFocusedIndex : 0; const prevFocusedOption = menu.childNodes[prevIndex]; const visibleOptionsAmount = visibleOptionsMap[size] || visibleOptionsMap.medium; if (options.length > visibleOptionsAmount && !isOptionVisible(prevFocusedOption, menu)) { this.menuRef.current.scrollTo(OPTION_HEIGHT * prevIndex); } }
A Lookup is an autocomplete text input that will search against a database object, it is enhanced by a panel of suggested options. @category Form
scrollUp
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
handleKeyDownPressed() { const { focusedItemIndex, options } = this.state; const lastIndex = options.length - 1; if (focusedItemIndex < lastIndex) { const nextIndex = focusedItemIndex + 1; const nextFocusedIndex = options[nextIndex].type === 'header' ? focusedItemIndex + 2 : nextIndex; if (nextFocusedIndex <= lastIndex) { this.setState({ focusedItemIndex: nextFocusedIndex, }); this.scrollDown(nextFocusedIndex); } } }
A Lookup is an autocomplete text input that will search against a database object, it is enhanced by a panel of suggested options. @category Form
handleKeyDownPressed
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
scrollDown(nextFocusedIndex) { const { options } = this.state; const { size } = this.props; const menu = this.menuRef.current.getRef(); const nextFocusedOption = menu.childNodes[nextFocusedIndex]; const visibleOptionsAmount = visibleOptionsMap[size] || visibleOptionsMap.medium; if (options.length > visibleOptionsAmount && !isOptionVisible(nextFocusedOption, menu)) { this.menuRef.current.scrollTo( OPTION_HEIGHT * (nextFocusedIndex - (visibleOptionsAmount - 1)), ); } }
A Lookup is an autocomplete text input that will search against a database object, it is enhanced by a panel of suggested options. @category Form
scrollDown
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
handleKeyEnterPressed() { const { onChange } = this.props; const { focusedItemIndex } = this.state; const { options } = this.state; const value = options[focusedItemIndex]; this.containerRef.current.focus(); this.setState({ searchValue: '', }); onChange(value); }
A Lookup is an autocomplete text input that will search against a database object, it is enhanced by a panel of suggested options. @category Form
handleKeyEnterPressed
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
handleWindowScroll(event) { if (this.menuRef.current && this.menuRef.current.getRef().contains(event.target)) return; this.closeMenu(); }
A Lookup is an autocomplete text input that will search against a database object, it is enhanced by a panel of suggested options. @category Form
handleWindowScroll
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
render() { const { style, className, label, error, size, placeholder, disabled, readOnly, tabIndex, onClick, required, id, name, labelAlignment, hideLabel, isLoading, icon, variant, borderRadius, } = this.props; const { searchValue, focusedItemIndex, options } = this.state; const onDeleteValue = disabled || readOnly ? undefined : this.handleRemoveValue; const isLookupOpen = this.isLookupOpen(); const errorMessageId = this.getErrorMessageId(); const currentValue = this.getValue(); const { showScrollUpArrow, showScrollDownArrow } = this.state; const errorValue = isLoading ? null : error; return ( <StyledContainer id={id} className={className} style={style} role="presentation" onKeyDown={this.handleKeyDown} ref={this.containerRef} tabIndex={-1} > <Label label={label} labelAlignment={labelAlignment} hideLabel={hideLabel} required={required} inputId={this.inputId} readOnly={readOnly} /> <RenderIf isTrue={currentValue}> <SelectedValue id={this.inputId} name={name} value={currentValue} tabIndex={tabIndex} onClick={onClick} disabled={disabled} error={errorValue} required={required} readOnly={readOnly} errorMessageId={errorMessageId} ref={this.inputRef} onClearValue={onDeleteValue} borderRadius={borderRadius} /> </RenderIf> <RenderIf isTrue={!currentValue}> <StyledInputContainer aria-expanded={isLookupOpen} aria-haspopup="listbox" // eslint-disable-next-line jsx-a11y/role-has-required-aria-props role="combobox" > <StyledSpinner isVisible={isLoading} size="x-small" assistiveText="searching" /> <RightElement showCloseButton={!!searchValue} onClear={this.clearInput} icon={icon} error={errorValue} /> <StyledInput id={this.inputId} name={name} type="search" value={searchValue} placeholder={placeholder} onChange={this.handleSearch} tabIndex={tabIndex} onFocus={this.handleFocus} onBlur={this.handleBlur} onClick={this.handleClick} disabled={disabled} readOnly={readOnly} required={required} autoComplete="off" aria-describedby={errorMessageId} aria-autocomplete="list" aria-controls={this.listboxId} aria-activedescendant={this.getAriaActivedescendant()} ref={this.inputRef} iconPosition="right" icon={icon} error={errorValue} isLoading={isLoading} variant={variant} borderRadius={borderRadius} /> <InternalOverlay isVisible={isLookupOpen} triggerElementRef={this.inputRef} positionResolver={lookupPositionResolver} onOpened={this.handleOverlayOpened} > <StyledOptionsMenu id={this.listboxId} role="listbox" data-id="lookup-options-container" borderRadius={borderRadius} > <RenderIf isTrue={showScrollUpArrow}> <MenuArrowButton arrow="up" onMouseEnter={this.handleScrollUpArrowHover} onMouseLeave={this.stopArrowScoll} /> </RenderIf> <Options items={options} value={searchValue} onSelectOption={this.handleChange} focusedItemIndex={focusedItemIndex} onHoverOption={this.handleHover} itemHeight={OPTION_HEIGHT} ref={this.menuRef} size={size} onScroll={this.updateScrollingArrows} /> <RenderIf isTrue={showScrollDownArrow}> <MenuArrowButton arrow="down" onMouseEnter={this.handleScrollDownArrowHover} onMouseLeave={this.stopArrowScoll} /> </RenderIf> </StyledOptionsMenu> </InternalOverlay> </StyledInputContainer> </RenderIf> <RenderIf isTrue={errorValue}> <StyledTextError id={errorMessageId}>{error}</StyledTextError> </RenderIf> </StyledContainer> ); }
Sets blur on the element. @public
render
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/index.js
MIT
render() { const { value, disabled, readOnly, onClearValue, id, name, tabIndex, required, onClick, errorMessageId, error, borderRadius, } = this.props; const { label, icon } = formatValue(value); return ( <StyledSelectedValueContainer readOnly={readOnly}> <RenderIf isTrue={readOnly || disabled}> <RenderIf isTrue={icon}> <StyledSelectedValueIcon readOnly={readOnly}> {icon} </StyledSelectedValueIcon> <StyledReadOnlySelectedInput id={id} name={name} type="text" value={label} tabIndex={tabIndex} onFocus={this.handleFocus} onClick={onClick} disabled={disabled} readOnly={readOnly} aria-describedby={errorMessageId} required={required} ref={this.inputRef} iconPosition="left" icon={icon} error={error} borderRadius={borderRadius} /> </RenderIf> </RenderIf> <RenderIf isTrue={!(readOnly || disabled)}> <StyledCombobox error={error} disabled={disabled} borderRadius={borderRadius} onClick={this.handleClick} > <StyledInput id={id} role="textbox" aria-autocomplete="none" tabIndex={tabIndex} disabled={disabled} ref={this.inputRef} onFocus={this.handleFocus} value={label} type="text" readOnly /> <StyledChip label={ <StyledChipContainer> <RenderIf isTrue={icon}> <StyledSelectedIconContainer> {icon} </StyledSelectedIconContainer> </RenderIf> {label} </StyledChipContainer> } onDelete={onClearValue} borderRadius={borderRadius} /> </StyledCombobox> </RenderIf> </StyledSelectedValueContainer> ); }
Sets blur on the element. @public
render
javascript
nexxtway/react-rainbow
src/components/Lookup/selectedValue.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/selectedValue.js
MIT
constructor(rootElement) { this.rootElement = rootElement; }
Create a new Lookup page object. @constructor @param {string} rootElement - The selector of the Lookup root element.
constructor
javascript
nexxtway/react-rainbow
src/components/Lookup/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/pageObject/index.js
MIT
async clickCloseButton() { await $(this.rootElement) .$('button[title="close"]') .click(); }
Clicks the close button element. @method
clickCloseButton
javascript
nexxtway/react-rainbow
src/components/Lookup/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/pageObject/index.js
MIT
async clickSelectedOptionInput() { await $(this.rootElement) .$('input[type="text"]') .parentElement() .click(); }
Clicks the input with a selected option. @method
clickSelectedOptionInput
javascript
nexxtway/react-rainbow
src/components/Lookup/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/pageObject/index.js
MIT
async clickRemoveSelectedOptionButton() { await $(this.rootElement) .$('button[title="Close"]') .click(); }
Clicks the remove selected option button. @method
clickRemoveSelectedOptionButton
javascript
nexxtway/react-rainbow
src/components/Lookup/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/pageObject/index.js
MIT
async hasFocusInput() { return $(this.rootElement) .$('input[type="search"]') .isFocused(); }
Returns true when the input element has focus. @method @returns {bool}
hasFocusInput
javascript
nexxtway/react-rainbow
src/components/Lookup/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/pageObject/index.js
MIT
async hasFocusSelectedOptionInput() { return $(this.rootElement) .$('input[type="text"]') .isFocused(); }
Returns true when the selected option input element has focus. @method @returns {bool}
hasFocusSelectedOptionInput
javascript
nexxtway/react-rainbow
src/components/Lookup/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/pageObject/index.js
MIT
async hasFocusRemoveSelectedOptionButton() { return $(this.rootElement) .$('button[title="Close"]') .isFocused(); }
Returns true when the remove selected option button has focus. @method @returns {bool}
hasFocusRemoveSelectedOptionButton
javascript
nexxtway/react-rainbow
src/components/Lookup/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/pageObject/index.js
MIT
async setQuery(value) { await $(this.rootElement) .$('input[type="search"]') .setValue(value); }
Type in the input element. @method @param {string} value - The value to type in the input element.
setQuery
javascript
nexxtway/react-rainbow
src/components/Lookup/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/pageObject/index.js
MIT
async getQuery() { return $(this.rootElement) .$('input[type="search"]') .getValue(); }
Get the value typed in the input element. @method @returns {string}
getQuery
javascript
nexxtway/react-rainbow
src/components/Lookup/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/pageObject/index.js
MIT
async getOptionsLength() { return (await $('[data-id="lookup-options-container"]').$$('li[role="presentation"]')) .length; }
Get the number of matched options. @method @returns {number}
getOptionsLength
javascript
nexxtway/react-rainbow
src/components/Lookup/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/pageObject/index.js
MIT
async getOption(itemPosition) { const items = await $('[data-id="lookup-options-container"]').$$('li[role="presentation"]'); if (items[itemPosition]) { return new PageLookupMenuItem(items[itemPosition]); } return null; }
Returns a new LookupMenuItem page object of the element in item position. @method @param {number} itemPosition - The base 0 index of the LookupMenuItem.
getOption
javascript
nexxtway/react-rainbow
src/components/Lookup/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/pageObject/index.js
MIT
async getSelectedOptionLabel() { const content = await $(this.rootElement).$('input[type="text"]'); if (content) { return content.getValue(); } return ''; }
Get the label of the selected option. @method @returns {string}
getSelectedOptionLabel
javascript
nexxtway/react-rainbow
src/components/Lookup/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/pageObject/index.js
MIT
async isMenuOpen() { return ( (await $(this.rootElement) .$('div[role="combobox"]') .getAttribute('aria-expanded')) === 'true' ); }
Returns true when the options menu is open, false otherwise. @method @returns {bool}
isMenuOpen
javascript
nexxtway/react-rainbow
src/components/Lookup/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/pageObject/index.js
MIT
async isMenuEmpty() { return $('[data-id="lookup-options-empty-container"]').isDisplayed(); }
Returns true when the empty message is displayed, false otherwise. @method @returns {bool}
isMenuEmpty
javascript
nexxtway/react-rainbow
src/components/Lookup/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/pageObject/index.js
MIT
async waitUntilOpen() { await browser.waitUntil(async () => this.isMenuOpen()); }
Wait until the options menu is open. @method
waitUntilOpen
javascript
nexxtway/react-rainbow
src/components/Lookup/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/pageObject/index.js
MIT
async hoverScrollUpArrow() { const upArrow = await $('[data-id="lookup-options-container"]').$( '[data-id=lookup-arrow-button-up]', ); await upArrow.scrollIntoView(); return upArrow.moveTo(); }
It moves the pointer over the menu scroll up arrow @method
hoverScrollUpArrow
javascript
nexxtway/react-rainbow
src/components/Lookup/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/pageObject/index.js
MIT
async mouseLeaveScrollUpArrow() { return (await $(this.rootElement).$('input[type="text"]')).moveTo(); }
It moves the pointer out of the menu scroll up arrow @method
mouseLeaveScrollUpArrow
javascript
nexxtway/react-rainbow
src/components/Lookup/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/pageObject/index.js
MIT
async hoverScrollDownArrow() { const downArrow = await $('[data-id="lookup-options-container"]').$( '[data-id="lookup-arrow-button-down"]', ); await downArrow.scrollIntoView(); return downArrow.moveTo(); }
It moves the pointer over the menu scroll down arrow @method
hoverScrollDownArrow
javascript
nexxtway/react-rainbow
src/components/Lookup/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/pageObject/index.js
MIT
async mouseLeaveScrollDownArrow() { return (await $(this.rootElement).$('input[type="text"]')).moveTo(); }
It moves the pointer out of the menu scroll down arrow @method
mouseLeaveScrollDownArrow
javascript
nexxtway/react-rainbow
src/components/Lookup/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/pageObject/index.js
MIT
async arrowDownExists() { return (await $('[data-id="lookup-options-container"]').$( '[data-id="lookup-arrow-button-down"]', )).isExisting(); }
Returns true when the the arrow to scroll down exits, false otherwise. @method @returns {bool}
arrowDownExists
javascript
nexxtway/react-rainbow
src/components/Lookup/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/pageObject/index.js
MIT
async arrowUpExists() { return (await $('[data-id="lookup-options-container"]').$( '[data-id="lookup-arrow-button-up"]', )).isExisting(); }
Returns true when the the arrow to scroll down exits, false otherwise. @method @returns {bool}
arrowUpExists
javascript
nexxtway/react-rainbow
src/components/Lookup/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/pageObject/index.js
MIT
constructor(rootElement) { this.rootElement = rootElement; }
Create a new LookupMenuItem page object. @constructor @param {string} rootElement - The selector of the LookupMenuItem root element.
constructor
javascript
nexxtway/react-rainbow
src/components/Lookup/pageObject/menuItem.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/pageObject/menuItem.js
MIT
async hover() { const itemElement = await this.rootElement.$('div[role="option"]'); await itemElement.scrollIntoView(); await itemElement.moveTo(); }
It moves the pointer over the menu item. @method
hover
javascript
nexxtway/react-rainbow
src/components/Lookup/pageObject/menuItem.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/pageObject/menuItem.js
MIT
async isActive() { return ( (await this.rootElement.$('[role="option"]').getAttribute('aria-selected')) === 'true' ); }
Returns true when the menu item is active. @method @returns {bool}
isActive
javascript
nexxtway/react-rainbow
src/components/Lookup/pageObject/menuItem.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/pageObject/menuItem.js
MIT
async isVisible() { return this.rootElement.isDisplayedInViewport(); }
Returns true when the menu item is visible inside the menu container. @method @returns {bool}
isVisible
javascript
nexxtway/react-rainbow
src/components/Lookup/pageObject/menuItem.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/pageObject/menuItem.js
MIT
async waitUntilIsVisible() { await browser.waitUntil(async () => this.isVisible()); }
Wait until the option is visible. @method
waitUntilIsVisible
javascript
nexxtway/react-rainbow
src/components/Lookup/pageObject/menuItem.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/pageObject/menuItem.js
MIT
function MapMarker(props) { // eslint-disable-next-line react/jsx-props-no-spreading return <Consumer>{context => <Marker {...props} {...context} />}</Consumer>; }
The MapMarker component is a single section of information that is nested in the GMap component. This component shows you the detailed information of each location that is displayed in the GMap.
MapMarker
javascript
nexxtway/react-rainbow
src/components/MapMarker/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/MapMarker/index.js
MIT
function MarkdownOutput(props) { const { id, className, style, value, variant } = props; const renderer = variant === 'inline' ? inlineRenderer : defaultRenderer; const result = useMarkdownToReact(value, renderer); return ( <StyledContainer id={id} className={className} style={style} variant={variant}> {result} </StyledContainer> ); }
MarkdownOutput renders Markdown text in browser. It is based on highlight.js, to customize the code blocks you can use highlight.js themes. @category Form
MarkdownOutput
javascript
nexxtway/react-rainbow
src/components/MarkdownOutput/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/MarkdownOutput/index.js
MIT
function MenuDivider(props) { const { variant, className, style } = props; return <StyledDivider className={className} style={style} variant={variant} role="separator" />; }
The MenuDivider are used for separate content inside the ButtonMenu.
MenuDivider
javascript
nexxtway/react-rainbow
src/components/MenuDivider/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/MenuDivider/index.js
MIT
constructor(rootElement) { this.rootElement = rootElement; }
Create a new MenuItem page object. @constructor @param {string} rootElement - The selector of the MenuItem root element.
constructor
javascript
nexxtway/react-rainbow
src/components/MenuItem/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/MenuItem/pageObject/index.js
MIT
hasFocus() { return this.rootElement.isFocused(); }
Returns true when the menu item has focus. @method @returns {bool}
hasFocus
javascript
nexxtway/react-rainbow
src/components/MenuItem/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/MenuItem/pageObject/index.js
MIT
async hover() { await this.rootElement.moveTo(); }
It moves the pointer over the menu item. @method
hover
javascript
nexxtway/react-rainbow
src/components/MenuItem/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/MenuItem/pageObject/index.js
MIT
getLabelText() { return this.rootElement.getText(); }
Returns the label text of the menu item. @method @returns {string}
getLabelText
javascript
nexxtway/react-rainbow
src/components/MenuItem/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/MenuItem/pageObject/index.js
MIT
constructor(props) { super(props); this.containerRef = React.createRef(); this.buttonRef = React.createRef(); this.modalRef = React.createRef(); this.contentRef = React.createRef(); this.modalHeadingId = uniqueId('modal-heading'); this.modalContentId = uniqueId('modal-content'); this.handleKeyPressed = this.handleKeyPressed.bind(this); this.handleClick = this.handleClick.bind(this); this.closeModal = this.closeModal.bind(this); this.addBackdropClickListener = this.addBackdropClickListener.bind(this); this.removeBackdropClickListener = this.removeBackdropClickListener.bind(this); }
Modals are used to display content in a layer above the app. This is used in cases such as the creation or editing of a record, as well as various types of messaging. @category Layout
constructor
javascript
nexxtway/react-rainbow
src/components/Modal/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Modal/index.js
MIT
componentDidMount() { const { isOpen } = this.props; if (isOpen) { this.contentElement = this.contentRef.current; CounterManager.increment(); disableBodyScroll(this.contentRef.current); this.modalTriggerElement = document.activeElement; this.modalRef.current.focus(); this.addBackdropClickListener(); } }
Modals are used to display content in a layer above the app. This is used in cases such as the creation or editing of a record, as well as various types of messaging. @category Layout
componentDidMount
javascript
nexxtway/react-rainbow
src/components/Modal/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Modal/index.js
MIT
componentDidUpdate(prevProps) { const { isOpen, onOpened } = this.props; const { isOpen: prevIsOpen } = prevProps; const wasOpened = isOpen && !prevIsOpen; const wasClosed = !isOpen && prevIsOpen; if (wasOpened) { CounterManager.increment(); this.contentElement = this.contentRef.current; disableBodyScroll(this.contentRef.current); this.modalTriggerElement = document.activeElement; this.modalRef.current.focus(); this.addBackdropClickListener(); onOpened(); } if (wasClosed) { this.removeBackdropClickListener(); CounterManager.decrement(); if (this.modalTriggerElement) { this.modalTriggerElement.focus(); } if (!CounterManager.hasModalsOpen()) { enableBodyScroll(this.contentElement); clearAllBodyScrollLocks(); } } }
Modals are used to display content in a layer above the app. This is used in cases such as the creation or editing of a record, as well as various types of messaging. @category Layout
componentDidUpdate
javascript
nexxtway/react-rainbow
src/components/Modal/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Modal/index.js
MIT
componentWillUnmount() { const { isOpen } = this.props; if (isOpen) { CounterManager.decrement(); } if (!CounterManager.hasModalsOpen()) { enableBodyScroll(this.contentElement); clearAllBodyScrollLocks(); } this.removeBackdropClickListener(); }
Modals are used to display content in a layer above the app. This is used in cases such as the creation or editing of a record, as well as various types of messaging. @category Layout
componentWillUnmount
javascript
nexxtway/react-rainbow
src/components/Modal/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Modal/index.js
MIT
handleKeyPressed(event) { event.stopPropagation(); const { isOpen } = this.props; if ( isOpen && event.keyCode === ESCAPE_KEY && this.containerRef.current.contains(event.target) ) { this.closeModal(); } if (event.keyCode === TAB_KEY) { manageTab(this.modalRef.current, event); } return null; }
Modals are used to display content in a layer above the app. This is used in cases such as the creation or editing of a record, as well as various types of messaging. @category Layout
handleKeyPressed
javascript
nexxtway/react-rainbow
src/components/Modal/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Modal/index.js
MIT
handleClick(event) { const { isOpen } = this.props; if (isOpen) { const isClickOutsideModal = !this.modalRef.current.contains(event.target); if (isClickOutsideModal) { return this.closeModal(); } } return null; }
Modals are used to display content in a layer above the app. This is used in cases such as the creation or editing of a record, as well as various types of messaging. @category Layout
handleClick
javascript
nexxtway/react-rainbow
src/components/Modal/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Modal/index.js
MIT
closeModal() { const { onRequestClose } = this.props; return onRequestClose(); }
Modals are used to display content in a layer above the app. This is used in cases such as the creation or editing of a record, as well as various types of messaging. @category Layout
closeModal
javascript
nexxtway/react-rainbow
src/components/Modal/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Modal/index.js
MIT
addBackdropClickListener() { const node = this.containerRef.current; if (node) { node.addEventListener('click', this.handleClick); } }
Modals are used to display content in a layer above the app. This is used in cases such as the creation or editing of a record, as well as various types of messaging. @category Layout
addBackdropClickListener
javascript
nexxtway/react-rainbow
src/components/Modal/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Modal/index.js
MIT
removeBackdropClickListener() { const node = this.containerRef.current; if (node) { node.removeEventListener('click', this.handleClick); } }
Modals are used to display content in a layer above the app. This is used in cases such as the creation or editing of a record, as well as various types of messaging. @category Layout
removeBackdropClickListener
javascript
nexxtway/react-rainbow
src/components/Modal/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Modal/index.js
MIT
render() { const { title, style, className, children, footer, isOpen, id, size, hideCloseButton, borderRadius, } = this.props; if (isOpen) { return createPortal( <StyledBackDrop role="presentation" isOpen={isOpen} id={id} ref={this.containerRef} onKeyDown={this.handleKeyPressed} > <StyledModalContainer role="dialog" tabIndex={-1} aria-labelledby={this.modalHeadingId} aria-modal aria-hidden={!isOpen} aria-describedby={this.modalContentId} style={style} ref={this.modalRef} isOpen={isOpen} className={className} size={size} as="section" borderRadius={borderRadius} > <RenderIf isTrue={!hideCloseButton}> <StyledCloseButton id="modal-close-button" icon={<CloseIcon />} title="Close" onClick={this.closeModal} ref={this.buttonRef} borderRadius={borderRadius} /> </RenderIf> <Header id={this.modalHeadingId} title={title} /> <StyledContent id={this.modalContentId} ref={this.contentRef}> {children} </StyledContent> <RenderIf isTrue={footer}> <StyledFooter>{footer}</StyledFooter> </RenderIf> </StyledModalContainer> </StyledBackDrop>, document.body, ); } return null; }
Modals are used to display content in a layer above the app. This is used in cases such as the creation or editing of a record, as well as various types of messaging. @category Layout
render
javascript
nexxtway/react-rainbow
src/components/Modal/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Modal/index.js
MIT
constructor(rootElement) { this.rootElement = rootElement; }
Create a new Modal page object. @constructor @param {string} rootElement - The selector of the Modal root element.
constructor
javascript
nexxtway/react-rainbow
src/components/Modal/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Modal/pageObject/index.js
MIT
async clickCloseButton() { await browser.waitUntil(async () => $(this.rootElement) .$('[id="modal-close-button"]') .isDisplayed(), ); await $(this.rootElement) .$('[id="modal-close-button"]') .click(); }
Clicks the close button element. @method
clickCloseButton
javascript
nexxtway/react-rainbow
src/components/Modal/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Modal/pageObject/index.js
MIT
async isOpen() { if (await $(this.rootElement).isDisplayed()) { return ( (await $(this.rootElement) .$('section[role="dialog"]') .isDisplayed()) && (await $(this.rootElement) .$('[id="modal-close-button"]') .isDisplayed()) ); } return false; }
Returns true when the modal is open, false otherwise. @method @returns {bool}
isOpen
javascript
nexxtway/react-rainbow
src/components/Modal/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Modal/pageObject/index.js
MIT
async hasFocusCloseButton() { return (await $(this.rootElement).$('[id="modal-close-button"]')).isFocused(); }
Returns true when the closeButton has focus. @method @returns {bool}
hasFocusCloseButton
javascript
nexxtway/react-rainbow
src/components/Modal/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Modal/pageObject/index.js
MIT
async waitUntilOpen() { await browser.waitUntil(async () => await this.isOpen()); }
Wait until the open modal transition has finished. @method
waitUntilOpen
javascript
nexxtway/react-rainbow
src/components/Modal/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Modal/pageObject/index.js
MIT
async waitUntilClose() { await browser.waitUntil(async () => !(await this.isOpen())); }
Wait until the close modal transition has finished. @method
waitUntilClose
javascript
nexxtway/react-rainbow
src/components/Modal/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Modal/pageObject/index.js
MIT
constructor(rootElement) { this.rootElement = rootElement; }
Create a new PageMonthlyCalendar page object. @constructor @param {string} rootElement - The selector of the PageMonthlyCalendar root element.
constructor
javascript
nexxtway/react-rainbow
src/components/MonthlyCalendar/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/MonthlyCalendar/pageObject/index.js
MIT
async clickPrevMonthButton() { await $(this.rootElement) .$$('button[data-id=button-icon-element]')[0] .click(); }
Clicks the previous month button element. @method
clickPrevMonthButton
javascript
nexxtway/react-rainbow
src/components/MonthlyCalendar/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/MonthlyCalendar/pageObject/index.js
MIT
async clickNextMonthButton() { await $(this.rootElement) .$$('button[data-id=button-icon-element]')[1] .click(); }
Clicks the next month button element. @method
clickNextMonthButton
javascript
nexxtway/react-rainbow
src/components/MonthlyCalendar/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/MonthlyCalendar/pageObject/index.js
MIT
async clickSelectYear() { await $(this.rootElement) .$('select') .click(); }
Clicks the select year element. @method
clickSelectYear
javascript
nexxtway/react-rainbow
src/components/MonthlyCalendar/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/MonthlyCalendar/pageObject/index.js
MIT
async getSelectedMonth() { return $(this.rootElement) .$('h3[data-id=month]') .getText(); }
Returns the text of the current selected month element. @method @returns {string}
getSelectedMonth
javascript
nexxtway/react-rainbow
src/components/MonthlyCalendar/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/MonthlyCalendar/pageObject/index.js
MIT
async getSelectedYear() { return $(this.rootElement) .$('select') .getValue(); }
Returns the value of the select year element. @method @returns {string}
getSelectedYear
javascript
nexxtway/react-rainbow
src/components/MonthlyCalendar/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/MonthlyCalendar/pageObject/index.js
MIT
async setYear(value) { await $(this.rootElement) .$('select') .selectByVisibleText(value); }
Set the value of the year select element @method @param {string}
setYear
javascript
nexxtway/react-rainbow
src/components/MonthlyCalendar/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/MonthlyCalendar/pageObject/index.js
MIT
async isPrevMonthButtonDisabled() { const buttonEl = (await $(this.rootElement).$$('button[data-id=button-icon-element]'))[0]; return !(await buttonEl.isEnabled()); }
Returns true when the previous month button element is disabled. @method @returns {bool}
isPrevMonthButtonDisabled
javascript
nexxtway/react-rainbow
src/components/MonthlyCalendar/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/MonthlyCalendar/pageObject/index.js
MIT
async isNextMonthButtonDisabled() { const buttonEl = (await $(this.rootElement).$$('button[data-id=button-icon-element]'))[1]; return !(await buttonEl.isEnabled()); }
Returns true when the next month button element is disabled. @method @returns {bool}
isNextMonthButtonDisabled
javascript
nexxtway/react-rainbow
src/components/MonthlyCalendar/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/MonthlyCalendar/pageObject/index.js
MIT
constructor(rootElement) { this.rootElement = rootElement; }
Create a new MultiSelect page object. @constructor @param {string} rootElement - The selector of the MultiSelect root element.
constructor
javascript
nexxtway/react-rainbow
src/components/MultiSelect/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/MultiSelect/pageObject/index.js
MIT
async isMenuOpen() { return ( (await $(this.rootElement) .$('div[role="combobox"]') .getAttribute('aria-expanded')) === 'true' ); }
Returns true when the options menu is open, false otherwise. @method @returns {bool}
isMenuOpen
javascript
nexxtway/react-rainbow
src/components/MultiSelect/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/MultiSelect/pageObject/index.js
MIT
async hasTriggerFocus() { return (await $(this.rootElement).$('[role="combobox"] > button')).isFocused(); }
Returns true when the Add button has focus. @method @returns {bool}
hasTriggerFocus
javascript
nexxtway/react-rainbow
src/components/MultiSelect/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/MultiSelect/pageObject/index.js
MIT
async hasInputFocus() { return (await $(this.rootElement).$('[role="textbox"]')).isFocused(); }
Returns true when the textbox input element has focus. @method @returns {bool}
hasInputFocus
javascript
nexxtway/react-rainbow
src/components/MultiSelect/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/MultiSelect/pageObject/index.js
MIT
async getOption(optionIndex) { return (await this[privateGetMenu]()).getOption(optionIndex); }
Returns a new Option page object of the element in item position. @method @param {number} optionIndex - The base 0 index of the Option.
getOption
javascript
nexxtway/react-rainbow
src/components/MultiSelect/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/MultiSelect/pageObject/index.js
MIT
async waitUntilOpen() { await browser.waitUntil(async () => this.isMenuOpen()); }
Wait until the dropdown is open. @method
waitUntilOpen
javascript
nexxtway/react-rainbow
src/components/MultiSelect/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/MultiSelect/pageObject/index.js
MIT
function Notification(props) { const { className, style, icon, title, description, onRequestClose, hideCloseButton } = props; return ( <StyledContainer className={className} style={style}> <StyledAnchor> <RenderIf isTrue={icon}> <Icon icon={icon} /> </RenderIf> <span> <RenderIf isTrue={title}> <Title text={title} /> </RenderIf> <RenderIf isTrue={description}> <Description text={description} /> </RenderIf> </span> </StyledAnchor> <RenderIf isTrue={!hideCloseButton}> <StyledCloseButton icon={<CloseIcon />} size="small" title="Close" onClick={onRequestClose} /> </RenderIf> </StyledContainer> ); }
Notifications serve as a confirmation mechanism & feedback that comes into the page at the top.
Notification
javascript
nexxtway/react-rainbow
src/components/Notification/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Notification/index.js
MIT
function Option(props) { // eslint-disable-next-line react/jsx-props-no-spreading return <Consumer>{values => <OptionItem {...props} {...values} />}</Consumer>; }
This component represents a dropdown list with different options. It allows a user to select one among multiple options. @category Form
Option
javascript
nexxtway/react-rainbow
src/components/Option/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Option/index.js
MIT
constructor(rootElement, containerRect) { this.rootElement = rootElement; this.containerRect = containerRect; }
Create a new Option page object. @constructor @param {string} rootElement - The selector of the Option root element.
constructor
javascript
nexxtway/react-rainbow
src/components/Option/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Option/pageObject/index.js
MIT
async hover() { const itemElement = await this.rootElement.$('div[role="option"]'); await itemElement.scrollIntoView(); await itemElement.moveTo(); }
It moves the pointer over the Option @method
hover
javascript
nexxtway/react-rainbow
src/components/Option/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Option/pageObject/index.js
MIT
async getLabel() { return (await this.rootElement.$('div[role="option"]')).getText(); }
Get the label of the Option. @method @returns {string}
getLabel
javascript
nexxtway/react-rainbow
src/components/Option/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Option/pageObject/index.js
MIT
async isActive() { return (await this.rootElement.$('div[aria-selected="true"]')).isExisting(); }
Returns true when the Option is active. @method @returns {bool}
isActive
javascript
nexxtway/react-rainbow
src/components/Option/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Option/pageObject/index.js
MIT
async isSelected() { return (await this.rootElement.getAttribute('data-selected')) === 'true'; }
Returns true when the Option is selected. @method @returns {bool}
isSelected
javascript
nexxtway/react-rainbow
src/components/Option/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Option/pageObject/index.js
MIT