All files / test-support dsl.js

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49                                                                                                 
import { as } from './properties/as';
import { blurrable } from './properties/blurrable';
import { clickable } from './properties/clickable';
import { clickOnText } from './properties/click-on-text';
import { contains } from './properties/contains';
import { fillable } from './properties/fillable';
import { focusable } from './properties/focusable';
import { isHidden } from './properties/is-hidden';
import { isPresent } from './properties/is-present';
import { isVisible } from './properties/is-visible';
import { text } from './properties/text';
import { value } from './properties/value';
import { getRoot } from './helpers';
import { wait } from './compatibility';
 
const thenDescriptor = {
  isDescriptor: true,
  value() {
    // In RFC268 tests, we need to wait on the promise returned from the actual
    // test helper, rather than a global method such as `wait`. So, we store the
    // promise on the root of the (chained) tree so we can find it here and use
    // it.
    let promise = getRoot(this)._promise;
    if (!promise) {
      promise = (window.wait || wait)();
    }
    return promise.then(...arguments);
  }
};
 
const dsl = {
  as,
  blur: blurrable(),
  click: clickable(),
  clickOn: clickOnText(),
  contains: contains(),
  fillIn: fillable(),
  focus: focusable(),
  isHidden: isHidden(),
  isPresent: isPresent(),
  isVisible: isVisible(),
  select: fillable(),
  text: text(),
  then: thenDescriptor,
  value: value()
};
 
export default dsl;