open-vault/ui/tests/pages/components/flash-message.js
Matthew Irish d509588cd2
Ember update (#5386)
Ember update - update ember-cli, ember-data, and ember to 3.4 series
2018-09-25 11:28:26 -05:00

30 lines
762 B
JavaScript

import { waitFor, settled } from '@ember/test-helpers';
import { collection, text, clickable } from 'ember-cli-page-object';
import { getter } from 'ember-cli-page-object/macros';
export default {
latestMessage: getter(function() {
return this.latestItem.text;
}),
latestItem: getter(function() {
const count = this.messages.length;
return this.messages.objectAt(count - 1);
}),
messages: collection('[data-test-flash-message-body]', {
click: clickable(),
text: text(),
}),
waitForFlash() {
return waitFor('[data-test-flash-message-body]');
},
clickLast() {
return this.latestItem.click();
},
async clickAll() {
for (let message of this.messages) {
message.click();
}
await settled();
},
};