open-nomad/ui/tests/pages/components/stepper-input.js
Michael Lange 7ad214f34a StepperInput UX improvements
- Click label to focus input
- Focusing input selects value
- Entering an invalid value reverts selection
- Entering a fractional number floors the value
2020-06-30 11:54:11 -07:00

45 lines
934 B
JavaScript

import {
attribute,
blurrable,
clickable,
fillable,
focusable,
isPresent,
text,
triggerable,
value,
} from 'ember-cli-page-object';
export default scope => ({
scope,
label: text('[data-test-stepper-label]'),
clickLabel: clickable('[data-test-stepper-label]'),
input: {
scope: '[data-test-stepper-input]',
fill: fillable(),
focus: focusable(),
blur: blurrable(),
value: value(),
esc: triggerable('keydown', '', { eventProperties: { keyCode: 27 } }),
isDisabled: attribute('disabled'),
},
decrement: {
scope: '[data-test-stepper-decrement]',
click: clickable(),
isPresent: isPresent(),
isDisabled: attribute('disabled'),
classNames: attribute('class'),
},
increment: {
scope: '[data-test-stepper-increment]',
click: clickable(),
isPresent: isPresent(),
isDisabled: attribute('disabled'),
classNames: attribute('class'),
},
});