github.com/outbrain/consul@v1.4.5/ui-v2/tests/lib/page-object/radiogroup.js (about) 1 import { is, clickable } from 'ember-cli-page-object'; 2 import ucfirst from 'consul-ui/utils/ucfirst'; 3 export default function(name, items) { 4 return items.reduce(function(prev, item, i, arr) { 5 // if item is empty then it means 'all' 6 // otherwise camelCase based on something-here = somethingHere for the key 7 const key = 8 item === '' 9 ? 'all' 10 : item.split('-').reduce(function(prev, item, i, arr) { 11 if (i === 0) { 12 return item; 13 } 14 return prev + ucfirst(item); 15 }); 16 return { 17 ...prev, 18 ...{ 19 [`${key}IsSelected`]: is( 20 ':checked', 21 `[data-test-radiobutton="${name}_${item}"] > input[type="radio"]` 22 ), 23 [key]: clickable(`[data-test-radiobutton="${name}_${item}"]`), 24 }, 25 }; 26 }, {}); 27 }