code
stringlengths
28
313k
docstring
stringlengths
25
85.3k
func_name
stringlengths
1
74
language
stringclasses
1 value
repo
stringlengths
5
60
path
stringlengths
4
172
url
stringlengths
44
218
license
stringclasses
7 values
async hasFocus() { return $(this.rootElement) .$('input[type="checkbox"]') .isFocused(); }
Returns true when the checkbox has the focus. @method @returns {bool}
hasFocus
javascript
nexxtway/react-rainbow
src/components/CheckboxGroup/pageObject/checkbox.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/CheckboxGroup/pageObject/checkbox.js
MIT
async isChecked() { return $(this.rootElement) .$('input[type="checkbox"]') .isSelected(); }
Returns true when the checkbox is checked. @method @returns {bool}
isChecked
javascript
nexxtway/react-rainbow
src/components/CheckboxGroup/pageObject/checkbox.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/CheckboxGroup/pageObject/checkbox.js
MIT
async getItem(itemPosition) { const items = await $(this.rootElement).$$('[data-id="input-checkbox_container"]'); if (items[itemPosition]) { return new PageCheckboxItem( `${ this.rootElement } [data-id="input-checkboxgroup_container"]:nth-child(${itemPosition + 1})`, ); } return null; }
Returns a new Checkbox page object of the element in item position. @method @param {number} itemPosition - The base 0 index of the checkbox.
getItem
javascript
nexxtway/react-rainbow
src/components/CheckboxGroup/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/CheckboxGroup/pageObject/index.js
MIT
constructor(props) { super(props); this.checkboxToggleRef = React.createRef(); this.inputIndentifier = props.name || uniqueId('checkbox-toggle'); }
Checkbox toggle is a checkable input that communicates if an option is true, false or indeterminate. @category Form
constructor
javascript
nexxtway/react-rainbow
src/components/CheckboxToggle/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/CheckboxToggle/index.js
MIT
async isChecked() { return !!(await $(this.rootElement) .$('input') .isSelected()); }
Returns true when the input element is checked. @method @returns {bool}
isChecked
javascript
nexxtway/react-rainbow
src/components/CheckboxToggle/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/CheckboxToggle/pageObject/index.js
MIT
function Chip(props) { const { label, onDelete, variant, title, className, style, size, borderRadius } = props; const sizeButton = sizesMap[size] || sizesMap.medium; return ( <StyledContainer className={className} style={style} variant={variant} title={title} size={size} borderRadius={borderRadius} > <TruncatedText>{label}</TruncatedText> <RenderIf isTrue={onDelete}> <StyledButtonIcon variant={variant} icon={<CloseIcon />} size={sizeButton} title="Close" onClick={onDelete} assistiveText="Remove" /> </RenderIf> </StyledContainer> ); }
A Chip displays a label that can be removed from view.
Chip
javascript
nexxtway/react-rainbow
src/components/Chip/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Chip/index.js
MIT
handleOnChange = (inputValue, index) => { const newValue = getNormalizedValue(inputValue, index, value); const hasValueChanged = newValue !== valueProp; if (hasValueChanged) { onChange(newValue); } }
The CodeInput is an element that allows to fill a list of numbers, suitable for code validations. @category Form
handleOnChange
javascript
nexxtway/react-rainbow
src/components/CodeInput/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/CodeInput/index.js
MIT
async type(key) { const focusedInput = await this.getFocusedInput(); if (focusedInput) { await focusedInput.setValue(key); } }
Create a new PageCodeInput page object. @constructor @param {string} rootElement - The selector of the PageCodeInput root element.
type
javascript
nexxtway/react-rainbow
src/components/CodeInput/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/CodeInput/pageObject/index.js
MIT
async click() { const focusedInput = await this.getFocusedInput(); if (focusedInput) { await focusedInput.click(); } }
Triggers a click over the focused input @method @param {string} inputIndex - The index of the input
click
javascript
nexxtway/react-rainbow
src/components/CodeInput/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/CodeInput/pageObject/index.js
MIT
async clickInputAtIndex(inputIndex) { const input = await this.getInputAtIndex(inputIndex); if (input) { await input.click(); } }
Triggers a click over the input via their index (position in the input array) @method @param {string} inputIndex - The index of the input
clickInputAtIndex
javascript
nexxtway/react-rainbow
src/components/CodeInput/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/CodeInput/pageObject/index.js
MIT
async getFocusedIndex() { const focusedInput = await this.getFocusedInput(); if (focusedInput) { return focusedInput.index; } return undefined; }
Returns the index of the current input focused or -1 if not found any @method
getFocusedIndex
javascript
nexxtway/react-rainbow
src/components/CodeInput/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/CodeInput/pageObject/index.js
MIT
async getFocusedValue() { const focusedInput = await this.getFocusedInput(); if (focusedInput) { return focusedInput.getValue(); } return undefined; }
Returns the value of the current input focused or -1 if not found any @method
getFocusedValue
javascript
nexxtway/react-rainbow
src/components/CodeInput/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/CodeInput/pageObject/index.js
MIT
async getInputValueAtIndex(inputIndex) { const input = await this.getInputAtIndex(inputIndex); if (input) { return input.getValue(); } return undefined; }
Returns the value of the input via their index (position in the input array) @method @param {string} inputIndex - The index of the input
getInputValueAtIndex
javascript
nexxtway/react-rainbow
src/components/CodeInput/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/CodeInput/pageObject/index.js
MIT
ColorInput = props => { const { id, className, style, value, onChange, defaultColors, variant, onClick, label, labelAlignment, hideLabel, required, readOnly, disabled, error, tabIndex, name, placeholder, bottomHelpText, onFocus: focusInProps, onBlur: blurInProps, size, borderRadius, } = useReduxForm(props); const [isOpen, setIsOpen] = useState(false); const [colorValue, setColorValue] = useState(getColorValue(value)); const [sampleColor, setSampleColor] = useState(value); const pickerRef = useRef(); const containerRef = useRef(); const triggerRef = useRef(); const alphaInputRef = useRef(); const inputRef = useRef(); const inputId = useUniqueIdentifier('color-input'); const errorMessageId = useErrorMessageId(error); const labelId = useLabelId(label); const [focusIndex, setFocusIndex] = useFocusIndex( containerRef, triggerRef, inputRef, alphaInputRef, ); useOutsideClick( containerRef, () => { setFocusIndex(-1); }, focusIndex > -1, ); useOutsideClick( pickerRef, event => { if ( event.target !== triggerRef.current && !triggerRef.current.contains(event.target) && !pickerRef.current.contains(event.target) ) { setIsOpen(false); } }, isOpen, ); useScrollingIntent({ callback: () => setIsOpen(false), isListening: isOpen, triggerElementRef: () => triggerRef, threshold: 5, }); useWindowResize(() => setIsOpen(false), isOpen); const onBlur = useCallback(() => { const { hex } = value; if (!isHexColor(hex)) setSampleColor(undefined); blurInProps(value); }, [value, blurInProps]); const onFocus = useCallback(() => focusInProps(value), [value, focusInProps]); const handleFocus = useHandleFocus({ focusIndex, onFocus, setFocusIndex, value }); const handleBlur = useHandleBlur({ focusIndex, onBlur, value }); const handleClick = event => { if (focusIndex === 1) { setFocusIndex(0); } else { setFocusIndex(1); } event.preventDefault(); if (isOpen) setIsOpen(false); else setIsOpen(true); return onClick(event); }; const handleChange = event => { const eventValue = event.target.value; const { alpha } = value; const hex = getHexString(eventValue); const isValid = isHexColor(hex); const newValue = { hex, alpha, isValid }; if (isValid) { setSampleColor(newValue); setColorValue(getColorValue(newValue)); } onChange(newValue); }; const handleAlphaChange = event => { if (!event.target.value) { onChange({ ...value, alpha: null }); return; } let alpha = Number.parseInt(event.target.value || '0', 10); if (alpha > 100) alpha = 100; else if (alpha < 0) alpha = 0; alpha /= 100; const newValue = { ...value, alpha }; setSampleColor(newValue); setColorValue(getColorValue(newValue)); if (!Number.isNaN(alpha)) onChange(newValue); }; const handleColorChange = color => { const { hex, rgba } = color; const newValue = { hex, alpha: rgba[3], isValid: isHexColor(hex) }; setColorValue(color); setSampleColor(newValue); onChange(newValue); }; const isFocus = focusIndex > -1 || isOpen; const inputValue = (value && value.hex) || value.hex === '' ? value.hex.replace('#', '') : '000000'; const alphaValue = (value && value.alpha) || value.alpha === 0 ? Math.round(value.alpha * 100) : ''; return ( <StyledContainer id={id} className={className} style={style} ref={containerRef}> <Label label={label} labelAlignment={labelAlignment} hideLabel={hideLabel} required={required} inputId={inputId} readOnly={readOnly} id={labelId} size={size} /> <StyledInputContainer disabled={disabled} readOnly={readOnly} error={error} isFocus={isFocus} borderRadius={borderRadius} size={size} > <StyledTrigger ref={triggerRef} onClick={handleClick} onFocus={event => handleFocus(event, 0)} onBlur={handleBlur} tabIndex={tabIndex} disabled={disabled} type="button" > <StyledFlagContainer disabled={disabled}> <ColorSample value={sampleColor} size={size} /> <StyledIndicator error={error} disabled={disabled} /> </StyledFlagContainer> <AssistiveText text="pick color" /> </StyledTrigger> <ColorInputContainer> <StyledIconContainer>#</StyledIconContainer> <StyledInput id={inputId} ref={inputRef} name={name} type="text" value={inputValue} placeholder={placeholder} tabIndex={tabIndex} onFocus={event => handleFocus(event, 2)} onBlur={handleBlur} onClick={onClick} onChange={handleChange} disabled={disabled} readOnly={readOnly} required={required} aria-labelledby={labelId} aria-describedby={errorMessageId} error={error} isFocus={isFocus} size={size} /> </ColorInputContainer> <StyledAlpha disabled={disabled}> <StyledAlphaInput type="number" min="0" max="100" ref={alphaInputRef} onFocus={event => handleFocus(event, 3)} onBlur={handleBlur} onChange={handleAlphaChange} value={alphaValue} size={size} /> % </StyledAlpha> </StyledInputContainer> <RenderIf isTrue={bottomHelpText}> <HelpText alignSelf="center">{bottomHelpText}</HelpText> </RenderIf> <RenderIf isTrue={error}> <ErrorText alignSelf="center" id={errorMessageId}> {error} </ErrorText> </RenderIf> <InternalOverlay isVisible={isOpen} triggerElementRef={() => triggerRef}> <div ref={pickerRef}> <StyledCard borderRadius={borderRadius}> <StyledContent> <ColorPicker value={colorValue} defaultColors={defaultColors} variant={variant} onChange={handleColorChange} /> </StyledContent> </StyledCard> </div> </InternalOverlay> </StyledContainer> ); }
Provides a color input with an improved color picker. @category Form
ColorInput
javascript
nexxtway/react-rainbow
src/components/ColorInput/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ColorInput/index.js
MIT
async getSaturationPointer() { return $(this.rootElement).$('button'); }
Return the saturation pointer button element. @method @returns {object}
getSaturationPointer
javascript
nexxtway/react-rainbow
src/components/ColorPicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ColorPicker/pageObject/index.js
MIT
async clickSaturation() { await (await this.getSaturationPointer()).click(); }
Triggers a click over the saturation pointer button element. @method
clickSaturation
javascript
nexxtway/react-rainbow
src/components/ColorPicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ColorPicker/pageObject/index.js
MIT
async getHueInput() { return $(this.rootElement).$('input[type=range]'); }
Return the hue input element. @method @returns {object}
getHueInput
javascript
nexxtway/react-rainbow
src/components/ColorPicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ColorPicker/pageObject/index.js
MIT
async clickHue() { await (await this.getHueInput()).click(); }
Triggers a click over the hue input element. @method
clickHue
javascript
nexxtway/react-rainbow
src/components/ColorPicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ColorPicker/pageObject/index.js
MIT
async getHexInput() { return $(this.rootElement).$('input[type=text]'); }
Return the hex input element. @method @returns {object}
getHexInput
javascript
nexxtway/react-rainbow
src/components/ColorPicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ColorPicker/pageObject/index.js
MIT
async getRgbaInput(index) { return (await $(this.rootElement).$$('input[type=number]'))[index]; }
Return the rgba input element for index. @method @param {number} index @returns {object}
getRgbaInput
javascript
nexxtway/react-rainbow
src/components/ColorPicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ColorPicker/pageObject/index.js
MIT
async getDefaultColorsInput() { return $(this.rootElement).$('input[type=radio]'); }
Return the default colors input element. @method @returns {object}
getDefaultColorsInput
javascript
nexxtway/react-rainbow
src/components/ColorPicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ColorPicker/pageObject/index.js
MIT
async getDefaultColorsLabel() { const id = await (await this.getDefaultColorsInput()).getAttribute('id'); return $(this.rootElement).$(`label[for="${id}"]`); }
Returns the default colors label element. @method @returns {object}
getDefaultColorsLabel
javascript
nexxtway/react-rainbow
src/components/ColorPicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ColorPicker/pageObject/index.js
MIT
async clickDefaultColors() { await (await this.getDefaultColorsLabel()).click(); }
Triggers a click over the default colors label element. @method
clickDefaultColors
javascript
nexxtway/react-rainbow
src/components/ColorPicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ColorPicker/pageObject/index.js
MIT
async getColor() { return (await this.getHexInput()).getValue(); }
Return hex color from hex input. @method @returns {string}
getColor
javascript
nexxtway/react-rainbow
src/components/ColorPicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ColorPicker/pageObject/index.js
MIT
async isSaturationFocused() { const buttonEl = await this.getSaturationPointer(); return (await buttonEl.isExisting()) && (await buttonEl.isFocused()); }
Returns true when the saturation pointer button element has focus. @method @returns {bool}
isSaturationFocused
javascript
nexxtway/react-rainbow
src/components/ColorPicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ColorPicker/pageObject/index.js
MIT
async isHueFocused() { const rangeEl = await this.getHueInput(); return (await rangeEl.isExisting()) && (await rangeEl.isFocused()); }
Returns true when the hue input element has focus. @method @returns {bool}
isHueFocused
javascript
nexxtway/react-rainbow
src/components/ColorPicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ColorPicker/pageObject/index.js
MIT
async isAlphaFocused() { const rangeEl = (await $(this.rootElement).$$('input[type=range]'))[1]; return (await rangeEl.isExisting()) && (await rangeEl.isFocused()); }
Returns true when the alpha input element has focus. @method @returns {bool}
isAlphaFocused
javascript
nexxtway/react-rainbow
src/components/ColorPicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ColorPicker/pageObject/index.js
MIT
async isHexFocused() { const inputEl = await this.getHexInput(); return (await inputEl.isExisting()) && (await inputEl.isFocused()); }
Returns true when the hex input element has focus. @method @returns {bool}
isHexFocused
javascript
nexxtway/react-rainbow
src/components/ColorPicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ColorPicker/pageObject/index.js
MIT
async isRgbaFocused(index = 0) { const inputEl = await this.getRgbaInput(index); return (await inputEl.isExisting()) && (await inputEl.isFocused()); }
Returns true when the rgba input element has focus. @method * @param {number} index @returns {bool}
isRgbaFocused
javascript
nexxtway/react-rainbow
src/components/ColorPicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ColorPicker/pageObject/index.js
MIT
async isDefaultColorsFocused() { const inputEl = await this.getDefaultColorsInput(); return (await inputEl.isExisting()) && (await inputEl.isFocused()); }
Returns true when the default colors input element has focus. @method @returns {bool}
isDefaultColorsFocused
javascript
nexxtway/react-rainbow
src/components/ColorPicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ColorPicker/pageObject/index.js
MIT
function Column() { return <div />; }
A column is a vertical element of a table that contains data. The Column component is an abstraction that allows us to represent data of the same data type. Both components (Table and Column) are related and should be implemented together. @category DataView
Column
javascript
nexxtway/react-rainbow
src/components/Column/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Column/index.js
MIT
handlePlusMouseDown = event => { event.preventDefault(); inputRef.current.focus(); const val = getValue(Number(value)); if (val < min) return onChange(getNormalizedValue(min)); return onChange(getNormalizedValue(val + step)); }
CounterInput is a component that lets you enter a number. You can increase and decrease the value using your mouse or by simply typing the number. @category Form
handlePlusMouseDown
javascript
nexxtway/react-rainbow
src/components/CounterInput/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/CounterInput/index.js
MIT
constructor(rootElement) { this.rootElement = rootElement; this.modalRootEl = `${rootElement}_modal`; this.calendarRootEl = `${rootElement}_modal_calendar`; }
Create a new PageDatePicker page object. @constructor @param {string} rootElement - The selector of the PageDatePicker root element.
constructor
javascript
nexxtway/react-rainbow
src/components/DatePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/DatePicker/pageObject/index.js
MIT
async getValue() { return $(this.rootElement) .$('input[type="text"]') .getValue(); }
Returns the value of the input element. @method @returns {string}
getValue
javascript
nexxtway/react-rainbow
src/components/DatePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/DatePicker/pageObject/index.js
MIT
async clickLabel() { await $(this.rootElement) .$('label') .click(); }
Clicks the input label element. @method
clickLabel
javascript
nexxtway/react-rainbow
src/components/DatePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/DatePicker/pageObject/index.js
MIT
async clickDay(day) { const calendar = await PageCalendar(this.calendarRootEl); await calendar.clickDay(day); }
Clicks the calendar specific day button element. @method
clickDay
javascript
nexxtway/react-rainbow
src/components/DatePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/DatePicker/pageObject/index.js
MIT
async isOpen() { return ( (await $(this.modalRootEl).isDisplayed()) && (await $(this.modalRootEl) .$('h1') .isDisplayed()) && (await $(this.modalRootEl) .$('select') .isDisplayed()) ); }
Returns true when the DatePicker modal is open, false otherwise. @method @returns {bool}
isOpen
javascript
nexxtway/react-rainbow
src/components/DatePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/DatePicker/pageObject/index.js
MIT
async hasFocusInput() { return (await $(this.rootElement).$('input[type="text"]')).isFocused(); }
Returns true when the DatePicker has focus. @method @returns {bool}
hasFocusInput
javascript
nexxtway/react-rainbow
src/components/DatePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/DatePicker/pageObject/index.js
MIT
async getDate() { return $(this.modalRootEl) .$('h1') .getText(); }
Returns the date displayed on top of the DatePicker. @method @returns {string}
getDate
javascript
nexxtway/react-rainbow
src/components/DatePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/DatePicker/pageObject/index.js
MIT
async waitUntilOpen() { await browser.waitUntil(async () => await this.isOpen()); }
Wait until the DatePicker modal is open. @method
waitUntilOpen
javascript
nexxtway/react-rainbow
src/components/DatePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/DatePicker/pageObject/index.js
MIT
async waitUntilClose() { await browser.waitUntil(async () => !(await this.isOpen())); }
Wait until the DatePicker modal is closed. @method
waitUntilClose
javascript
nexxtway/react-rainbow
src/components/DatePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/DatePicker/pageObject/index.js
MIT
openModal = event => { if (!readOnly) { setIsOpen(true); onClick(event); } }
A DateTimePicker is used to select a day and a time. @category Form
openModal
javascript
nexxtway/react-rainbow
src/components/DateTimePicker/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/DateTimePicker/index.js
MIT
constructor(rootElement) { this.rootElement = rootElement; this.modalRootEl = `${rootElement}_modal`; }
Create a new PageDateTimePicker page object. @constructor @param {string} rootElement - The selector of the PageDateTimePicker root element.
constructor
javascript
nexxtway/react-rainbow
src/components/DateTimePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/DateTimePicker/pageObject/index.js
MIT
async getTimeValue() { return new PageTimeSelect(this.modalRootEl).getValue(); }
Returns the selected time value. @method @returns {string}
getTimeValue
javascript
nexxtway/react-rainbow
src/components/DateTimePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/DateTimePicker/pageObject/index.js
MIT
async clickOKButton() { await $(this.modalRootEl) .$('button[id="time-picker_ok-button"]') .click(); }
Clicks the OK button element @method
clickOKButton
javascript
nexxtway/react-rainbow
src/components/DateTimePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/DateTimePicker/pageObject/index.js
MIT
async clickCancelButton() { await $(this.modalRootEl) .$('button[id="time-picker_cancel-button"]') .click(); }
Clicks the Cancel button element @method
clickCancelButton
javascript
nexxtway/react-rainbow
src/components/DateTimePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/DateTimePicker/pageObject/index.js
MIT
async isOpen() { return ( (await $(this.modalRootEl).isDisplayed()) && (await $(this.modalRootEl) .$('button[id="time-picker_ok-button"]') .isDisplayed()) && (await $(this.modalRootEl) .$('button[id="time-picker_cancel-button"]') .isDisplayed()) ); }
Returns true when the picker modal is open, false otherwise. @method @returns {bool}
isOpen
javascript
nexxtway/react-rainbow
src/components/DateTimePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/DateTimePicker/pageObject/index.js
MIT
async getValue() { const hour = await (await $(this.rootElement).$('input[data-id=hour]')).getValue(); const minutes = await (await $(this.rootElement).$('input[data-id=minutes]')).getValue(); const meridian = await (await $(this.rootElement).$( 'input[aria-label="am-pm selector"]', )).getValue(); return hour && minutes && meridian ? `${hour}:${minutes} ${meridian}` : ''; }
Returns the text representing the current selected time. @method @returns {string}
getValue
javascript
nexxtway/react-rainbow
src/components/DateTimePicker/pageObject/pageTimeSelect.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/DateTimePicker/pageObject/pageTimeSelect.js
MIT
function Drawer(props) { const { id, isOpen, hideCloseButton, onRequestClose, onOpened, header, footer, size, slideFrom, children, className, style, } = props; const headerId = useUniqueIdentifier('drawer-header'); const contentId = useUniqueIdentifier('drawer-content'); const triggerRef = useRef(null); const drawerRef = useRef(null); const containerRef = useRef(null); const contentRef = useRef(null); const [drawerState, setDrawerState] = useState( isOpen ? DrawerState.OPENED : DrawerState.CLOSED, ); useEffect(() => { const contentElement = contentRef.current; if (isOpen) { CounterManager.increment(); disableBodyScroll(contentElement); triggerRef.current = document.activeElement; setDrawerState(DrawerState.OPENING); } return () => { if (isOpen) { CounterManager.decrement(); if (triggerRef.current) triggerRef.current.focus(); if (!CounterManager.hasModalsOpen()) { enableBodyScroll(contentElement); } clearAllBodyScrollLocks(); setDrawerState(DrawerState.CLOSING); } }; }, [isOpen]); useEffect(() => { if (isOpen && drawerState === DrawerState.OPENED) { drawerRef.current.focus(); onOpened(); } }, [drawerState, isOpen, onOpened]); const onSlideEnd = () => { if (drawerState === DrawerState.OPENING) { setDrawerState(DrawerState.OPENED); } else if (drawerState === DrawerState.CLOSING) { setDrawerState(DrawerState.CLOSED); } }; const closeDrawer = () => onRequestClose(); const handleBackDropClick = useCallback(event => { if (drawerRef.current.contains(event.target)) { return null; } return closeDrawer(); // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { const node = containerRef.current; if (drawerState === 1) { node.addEventListener('click', handleBackDropClick); } return () => { if (node) { node.removeEventListener('click', handleBackDropClick); } }; }, [drawerState, handleBackDropClick]); const handleKeyPressed = event => { event.stopPropagation(); if (isOpen && event.keyCode === ESCAPE_KEY && containerRef.current.contains(event.target)) { closeDrawer(); } if (event.keyCode === TAB_KEY) { manageTab(drawerRef.current, event); } return null; }; const drawerIsOpen = [DrawerState.OPENING, DrawerState.OPENED].includes(drawerState); if (drawerState !== null && drawerState !== DrawerState.CLOSED) { return createPortal( <StyledBackDrop id={id} role="presentation" ref={containerRef} onKeyDown={handleKeyPressed} > <StyledContainer role="dialog" tabIndex={-1} aria-labelledby={headerId} aria-modal aria-hidden={!drawerIsOpen} aria-describedby={contentId} className={className} isOpen={drawerIsOpen} style={style} size={size} slideFrom={getSlideFrom(slideFrom, 'left')} ref={drawerRef} onAnimationEnd={onSlideEnd} > <Header id={headerId} content={header} /> <RenderIf isTrue={!hideCloseButton}> <StyledCloseButton id="drawer-close-button" icon={<CloseIcon />} title="Hide" onClick={closeDrawer} /> </RenderIf> <StyledContent id={contentId} ref={contentRef}> {children} </StyledContent> <RenderIf isTrue={footer}> <StyledDivider /> <StyledFooter>{footer}</StyledFooter> </RenderIf> </StyledContainer> </StyledBackDrop>, document.body, ); } return <></>; }
Drawers are surfaces containing supplementary content on your app. @category Layout
Drawer
javascript
nexxtway/react-rainbow
src/components/Drawer/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Drawer/index.js
MIT
function getPointOutsideDrawer(drawerPosition, drawerSize) { const x = drawerPosition.x > 0 ? drawerPosition.x - 2 : drawerSize.width + 2; const y = Math.round(drawerSize.height / 2); return { x, y }; }
Drawer page object class. @class @tutorial drawer
getPointOutsideDrawer
javascript
nexxtway/react-rainbow
src/components/Drawer/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Drawer/pageObject/index.js
MIT
async clickCloseButton() { await $(this.rootElement) .$('[id="drawer-close-button"]') .click(); }
Clicks the close button element. @method
clickCloseButton
javascript
nexxtway/react-rainbow
src/components/Drawer/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Drawer/pageObject/index.js
MIT
async clickBackDrop() { await $(this.rootElement) .$('[id="drawer-close-button"]') .waitForDisplayed(); const section = await $(this.rootElement).$('section[role="dialog"]'); const { x, y } = getPointOutsideDrawer( await section.getLocation(), await section.getSize(), ); await $(this.rootElement) .$('[id="drawer-close-button"]') .click({ x, y }); }
Clicks the drawer's backdrop element. @method
clickBackDrop
javascript
nexxtway/react-rainbow
src/components/Drawer/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Drawer/pageObject/index.js
MIT
async isOpen() { return ( (await $(this.rootElement).isExisting()) && (await $(this.rootElement) .$('section[role="dialog"]') .isDisplayed()) && (await $(this.rootElement) .$('[id="drawer-close-button"]') .isDisplayed()) ); }
Returns true when the drawer is open, false otherwise. @method @returns {bool}
isOpen
javascript
nexxtway/react-rainbow
src/components/Drawer/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Drawer/pageObject/index.js
MIT
async hasFocusCloseButton() { return $(this.rootElement) .$('[id="drawer-close-button"]') .isFocused(); }
Returns true when the closeButton has focus. @method @returns {bool}
hasFocusCloseButton
javascript
nexxtway/react-rainbow
src/components/Drawer/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Drawer/pageObject/index.js
MIT
async waitUntilOpen() { await browser.pause(1000); await browser.waitUntil(async () => await this.isOpen()); }
Wait until the open transition has finished. @method
waitUntilOpen
javascript
nexxtway/react-rainbow
src/components/Drawer/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Drawer/pageObject/index.js
MIT
async waitUntilClose() { await browser.pause(1000); await browser.waitUntil(async () => !(await $(this.rootElement).isExisting())); }
Wait until the close transition has finished. @method
waitUntilClose
javascript
nexxtway/react-rainbow
src/components/Drawer/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Drawer/pageObject/index.js
MIT
DynamicMenuItem = props => { const { renderIf, disabled, rowData: row, ...rest } = props; const shouldRender = typeof renderIf === 'function' ? renderIf({ row }) : true; const isDisabled = typeof disabled === 'function' ? disabled({ row }) : false; if (shouldRender) { // eslint-disable-next-line react/jsx-props-no-spreading return <MenuItem {...rest} disabled={isDisabled} />; } return null; }
A DynamicMenuItem is a menu item meant to be used in the action column of Table. This component adds two new props that allows to render the item conditionally based on row data. @category DataView
DynamicMenuItem
javascript
nexxtway/react-rainbow
src/components/DynamicMenuItem/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/DynamicMenuItem/index.js
MIT
function GMap(props) { const { apiKey, ...rest } = props; // eslint-disable-next-line react-hooks/exhaustive-deps const Component = useCallback( scriptLoader(`${googleMapApiUrl}?key=${apiKey}&libraries=places`)(MapComponent), [apiKey], ); // eslint-disable-next-line react/jsx-props-no-spreading return <Component {...rest} />; }
The GMap component is used to find a location.
GMap
javascript
nexxtway/react-rainbow
src/components/GMap/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/GMap/index.js
MIT
function GoogleAddressLookup(props) { const { apiKey, ...rest } = props; // eslint-disable-next-line react-hooks/exhaustive-deps const Component = useCallback( scriptLoader(`${googleMapApiUrl}?key=${apiKey}&libraries=places`)(PlacesLookupComponent), [apiKey], ); // eslint-disable-next-line react/jsx-props-no-spreading return <Component {...rest} />; }
The GoogleAddressLookup component is used to find a location. @category Form
GoogleAddressLookup
javascript
nexxtway/react-rainbow
src/components/GoogleAddressLookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/GoogleAddressLookup/index.js
MIT
handleBlur = () => { if (!isClickTooltip.current) { setIsFocused(false); } }
HelpText is a popup that displays information related to an element.
handleBlur
javascript
nexxtway/react-rainbow
src/components/HelpText/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/HelpText/index.js
MIT
function HighlightedText(props) { const { style, className, parts, hitComponent, textComponent, isInline } = props; const finalHitContainer = hitComponent || DefaultHitContainer; const finalTextContainer = textComponent || DefaultTextContainer; return ( <HighlighContainer className={className} style={style} isInline={isInline}> <HitText parts={parts} hitComponent={finalHitContainer} textComponent={finalTextContainer} /> </HighlighContainer> ); }
HighlightedText is a component that highlights a part of a text.
HighlightedText
javascript
nexxtway/react-rainbow
src/components/HighlightedText/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/HighlightedText/index.js
MIT
constructor(props) { super(props); this.inputRef = React.createRef(); }
Text inputs are used for freeform data entry. @category Form
constructor
javascript
nexxtway/react-rainbow
src/components/Input/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Input/index.js
MIT
async hasFocusInput() { return $(this.rootElement) .$('input') .isFocused(); }
Returns true when the input element has focus. @method @returns {bool}
hasFocusInput
javascript
nexxtway/react-rainbow
src/components/Input/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Input/pageObject/index.js
MIT
async setValue(value) { await $(this.rootElement) .$('input') .setValue(value); }
Type in the input element. @method @param {string} value - The value to type in the input element.
setValue
javascript
nexxtway/react-rainbow
src/components/Input/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Input/pageObject/index.js
MIT
async getValue() { return $(this.rootElement) .$('input') .getValue(); }
Get the value typed in the input element. @method @returns {string}
getValue
javascript
nexxtway/react-rainbow
src/components/Input/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Input/pageObject/index.js
MIT
async hoverScrollUpArrow() { const upArrow = await $(this.rootElement).$('[data-id="internal-dropdown-arrow-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/InternalDropdown/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/InternalDropdown/pageObject/index.js
MIT
async hoverScrollDownArrow() { const downArrow = await $(this.rootElement).$('[data-id="internal-dropdown-arrow-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/InternalDropdown/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/InternalDropdown/pageObject/index.js
MIT
async getOptionsLength() { return (await $(this.rootElement).$$('li[data-selected="false"]')).length; }
Get the number of registered options. @method @returns {number}
getOptionsLength
javascript
nexxtway/react-rainbow
src/components/InternalDropdown/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/InternalDropdown/pageObject/index.js
MIT
async getOption(optionIndex) { const activeOptions = await $(this.rootElement).$$('li[data-selected="false"]'); const option = activeOptions[optionIndex]; if (option && !option.error) { return new PageOption(option, await this[privateGetMenuBoundsRect]()); } return null; }
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/InternalDropdown/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/InternalDropdown/pageObject/index.js
MIT
async arrowDownExists() { return $(this.rootElement) .$('[data-id="internal-dropdown-arrow-down"]') .isExisting(); }
Returns true when the arrow to scroll down exits, false otherwise. @method @returns {bool}
arrowDownExists
javascript
nexxtway/react-rainbow
src/components/InternalDropdown/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/InternalDropdown/pageObject/index.js
MIT
async emptyMessageExist() { return $(this.rootElement) .$('[data-id="internal-dropdown-empty-message"]') .isExisting(); }
Returns true when the search no results found, false otherwise. @method @returns {bool}
emptyMessageExist
javascript
nexxtway/react-rainbow
src/components/InternalDropdown/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/InternalDropdown/pageObject/index.js
MIT
async isLoading() { return $(this.rootElement) .$('ul[role="presentation"] > div > div') .isExisting(); }
Returns true when loading indicator is visible. @method @returns {bool}
isLoading
javascript
nexxtway/react-rainbow
src/components/InternalDropdown/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/InternalDropdown/pageObject/index.js
MIT
InternalOverlay = props => { const { render: ContentComponent, isVisible, triggerElementRef, positionResolver, onOpened, children, keepScrollEnabled, } = props; const containerRef = useRef(); const [contentMeta, updateContentMeta] = useState(false); const shouldOpen = isVisible && contentMeta; useEffect(() => { if (shouldOpen) { onOpened(); } // eslint-disable-next-line react-hooks/exhaustive-deps }, [shouldOpen]); const shouldDisableScroll = shouldOpen && !keepScrollEnabled; useDisableScroll(shouldDisableScroll); // eslint-disable-next-line react-hooks/exhaustive-deps useIsomorphicLayoutEffect(() => { if (contentMeta && containerRef.current) { const { width, height } = containerRef.current.getBoundingClientRect(); if (width !== contentMeta.width || height !== contentMeta.height) { updateContentMeta({ width, height }); } } }); if (isVisible) { const content = children || <ContentComponent />; if (contentMeta) { const triggerMeta = resolveTriggerMeta(triggerElementRef); const viewportMeta = resolveViewportMeta(); const position = resolvePosition({ triggerMeta, contentMeta, viewportMeta, positionResolver, }); return createPortal( <Container position={position} ref={containerRef}> {content} </Container>, document.body, ); } return ( <ContentMetaResolver component={ContentComponent} onResolved={updateContentMeta}> {children} </ContentMetaResolver> ); } return null; }
This component implements the positioning of a component (inserted in the DOM at the body level) based on a trigger DOM element. By the way of example, you can think of the use case of a Menu Options, Tooltip, Popup that should be floating on top of all the elements and it should be correctly positioned based on the component/element that triggers the show/open action. @category Internal
InternalOverlay
javascript
nexxtway/react-rainbow
src/components/InternalOverlay/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/InternalOverlay/index.js
MIT
handleOpen = () => { const triggerRect = resolveElement(triggerElementRef).getBoundingClientRect(); const tooltipRect = tooltipRef.current.getBoundingClientRect(); if (tooltipRect.bottom < triggerRect.top) { setPos('top'); } else if (tooltipRect.top > triggerRect.bottom) { setPos('bottom'); } else if (tooltipRect.right < triggerRect.left) { setPos('left'); } else if (tooltipRect.left > triggerRect.right) { setPos('right'); } else { setPos('floating'); } }
A Tooltip is a small piece of contextual information about an element on the screen, which is displayed when a user hovers or focuses on the element it is describing. @category Internal
handleOpen
javascript
nexxtway/react-rainbow
src/components/InternalTooltip/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/InternalTooltip/index.js
MIT
LoadingShape = props => { const { className, style, shape, variant } = props; const shapeRef = useRef(); const isImage = variant === 'image'; const isAvatar = variant === 'avatar'; useEffect(() => { const element = shapeRef.current; if (shape === 'square' || shape === 'circle') { element.style.width = `${element.offsetHeight}px`; } else { element.style.width = '100%'; } }); return ( <StyledShapeContainer className={className} style={style}> <StyledLoadingShape shape={shape} variant={variant} ref={shapeRef}> <RenderIf isTrue={isImage}> <StyledImageIcon shape={shape} /> </RenderIf> <RenderIf isTrue={isAvatar}> <StyledAvatarIcon shape={shape} /> </RenderIf> </StyledLoadingShape> </StyledShapeContainer> ); }
LoadingShape can be used to display a placeholder where content is being loaded asynchronously.
LoadingShape
javascript
nexxtway/react-rainbow
src/components/LoadingShape/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/LoadingShape/index.js
MIT
constructor(props) { super(props); const normalizedOptions = getNormalizedOptions(props.options || []); this.state = { searchValue: '', isOpen: false, isFocused: false, options: normalizedOptions, focusedItemIndex: getInitialFocusedIndex( normalizedOptions, props.preferredSelectedOption, ), showScrollUpArrow: undefined, showScrollDownArrow: undefined, }; this.inputId = uniqueId('lookup-input'); this.listboxId = uniqueId('lookup-listbox'); this.errorMessageId = uniqueId('error-message'); this.containerRef = React.createRef(); this.inputRef = React.createRef(); this.menuRef = React.createRef(); this.handleSearch = this.handleSearch.bind(this); this.clearInput = this.clearInput.bind(this); this.handleChange = this.handleChange.bind(this); this.handleFocus = this.handleFocus.bind(this); this.handleRemoveValue = this.handleRemoveValue.bind(this); this.handleBlur = this.handleBlur.bind(this); this.handleHover = this.handleHover.bind(this); this.handleKeyDown = this.handleKeyDown.bind(this); this.handleKeyUpPressed = this.handleKeyUpPressed.bind(this); this.handleKeyDownPressed = this.handleKeyDownPressed.bind(this); this.handleKeyEnterPressed = this.handleKeyEnterPressed.bind(this); this.keyHandlerMap = { [UP_KEY]: this.handleKeyUpPressed, [DOWN_KEY]: this.handleKeyDownPressed, [ENTER_KEY]: this.handleKeyEnterPressed, }; this.handleScrollDownArrowHover = this.handleScrollDownArrowHover.bind(this); this.handleScrollUpArrowHover = this.handleScrollUpArrowHover.bind(this); this.stopArrowScoll = this.stopArrowScoll.bind(this); this.updateScrollingArrows = this.updateScrollingArrows.bind(this); this.handleWindowScroll = this.handleWindowScroll.bind(this); this.handleOverlayOpened = this.handleOverlayOpened.bind(this); this.handleClick = this.handleClick.bind(this); this.windowScrolling = new WindowScrolling(); }
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
constructor
javascript
nexxtway/react-rainbow
src/components/Lookup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Lookup/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 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 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 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 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 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
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
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
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