Skip to content

Instantly share code, notes, and snippets.

@cs3b
Last active April 14, 2017 17:31
Show Gist options
  • Select an option

  • Save cs3b/dd93b3e87cdf23f4f6598461421c561f to your computer and use it in GitHub Desktop.

Select an option

Save cs3b/dd93b3e87cdf23f4f6598461421c561f to your computer and use it in GitHub Desktop.
import { clickable, create, fillable, visitable, collection } from 'ember-cli-page-object';
const newForm = '.card-header';
const rows = 'tbody > tr';
const expandedRow = `${rows}.lt-expanded-row`;
function formObject(scope) {
return create({
scope,
fillExternalNumber: fillable('input', { at: 1 }),
fillCompany: fillable('input', { at: 2 }),
fillCategory: fillable('input', { at: 4 }),
clickFirstSuggestion: clickable('.md-autocomplete-suggestions li', { resetScope: true }),
selectCompany(company) {
return this.fillCompany(company).clickFirstSuggestion();
},
selectCategory(category) {
return this.fillCategory(category).clickFirstSuggestion();
},
submit: clickable('button')
});
}
export default create({
visit: visitable('/mail-logs'),
formNew() {
return formObject(newForm);
},
mailLogs: collection({
itemScope: rows,
item: {
formEdit() {
return formObject(expandedRow);
}
}
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment