2021-04-29 20:00:59 +00:00
|
|
|
import { clickable, collection, text, attribute } from 'ember-cli-page-object';
|
2021-12-28 16:08:12 +00:00
|
|
|
import {
|
|
|
|
selectChoose,
|
|
|
|
clickTrigger,
|
|
|
|
} from 'ember-power-select/test-support/helpers';
|
2019-01-24 04:33:47 +00:00
|
|
|
|
2021-12-28 14:45:20 +00:00
|
|
|
export const multiFacet = (scope) => ({
|
2019-01-24 04:33:47 +00:00
|
|
|
scope,
|
|
|
|
|
|
|
|
toggle: clickable('[data-test-dropdown-trigger]'),
|
|
|
|
|
|
|
|
options: collection('[data-test-dropdown-option]', {
|
2021-04-29 20:00:59 +00:00
|
|
|
testContainer: '#ember-testing .ember-basic-dropdown-content',
|
2019-01-24 04:33:47 +00:00
|
|
|
resetScope: true,
|
|
|
|
label: text(),
|
|
|
|
key: attribute('data-test-dropdown-option'),
|
|
|
|
toggle: clickable('label'),
|
|
|
|
}),
|
|
|
|
});
|
2021-04-29 20:00:59 +00:00
|
|
|
|
2021-12-28 14:45:20 +00:00
|
|
|
export const singleFacet = (scope) => ({
|
2021-04-29 20:00:59 +00:00
|
|
|
scope,
|
|
|
|
|
|
|
|
async toggle() {
|
|
|
|
await clickTrigger(this.scope);
|
|
|
|
},
|
|
|
|
|
|
|
|
options: collection('.ember-power-select-option', {
|
|
|
|
testContainer: '#ember-testing .ember-basic-dropdown-content',
|
|
|
|
resetScope: true,
|
|
|
|
label: text('[data-test-dropdown-option]'),
|
|
|
|
key: attribute('data-test-dropdown-option', '[data-test-dropdown-option]'),
|
|
|
|
async select() {
|
|
|
|
// __parentTreeNode is clearly meant to be private in the page object API,
|
|
|
|
// but it seems better to use that and keep the API symmetry across singleFacet
|
|
|
|
// and multiFacet compared to moving select to the parent.
|
|
|
|
const parentScope = this.__parentTreeNode.scope;
|
|
|
|
await selectChoose(parentScope, this.label);
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
});
|