Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow test-helpers to accept DOM Elements #291

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sukima
Copy link

@sukima sukima commented Feb 2, 2022

One of the issues I ran into I didn't have access to the selector strings but instead the actual DOM element. This is usually the case in addons like fractal-page-object.

With this change we can seamlessly use both. Ember test-helpers function with both a string selector or a DOM Element. Here is a working example:

class Foo extends PageObject {
  form = selector('[data-test-selector=my-form]', class extends PageObject {
    calendar = selector('ember-power-calendar', class extends PageObject {
      selectDate(date) {
        return calendarSelect(this.element, date);
      }
    });
  });
}

One of the issues I ran into I didn't have access to the selector strings but instead the actual DOM element. This is usually the case in addons like [fractal-page-object](https://github.com/bendemboski/fractal-page-object).

With this change we can seamlessly use both. Ember test-helpers function with both a string selector or a DOM Element. Here is a working example:

```js
class Foo extends PageObject {
  form = selector('[data-test-selector=my-form]', class extends PageObject {
    calendar = selector('ember-power-calendar', class extends PageObject {
      selectDate(date) {
        return calendarSelect(this.element, date);
      }
    });
  });
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant