Commit b55a0e46 authored by Michael Lange's avatar Michael Lange
Browse files

Fix the allocations page compoent to support multiple prop keys

It was designed to be used this way, but allocationFor has never
worked as intended :face_palm:
parent 5a84d731
Showing with 5 additions and 2 deletions
+5 -2
import { attribute, collection, clickable, isPresent, text } from 'ember-cli-page-object';
import { singularize } from 'ember-inflector';
export default function(selector = '[data-test-allocation]', propKey = 'allocations') {
const lookupKey = `${singularize(propKey)}For`;
return {
[propKey]: collection(selector, {
id: attribute('data-test-allocation'),
......@@ -25,8 +28,8 @@ export default function(selector = '[data-test-allocation]', propKey = 'allocati
visitClient: clickable('[data-test-client] a'),
}),
allocationFor(id) {
return this.allocations.toArray().find(allocation => allocation.id === id);
[lookupKey]: function(id) {
return this[propKey].toArray().find(allocation => allocation.id === id);
},
};
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment