(groupSetDefine)
| 1395 | } // End of createSelectInput |
| 1396 | |
| 1397 | function createGroupSetInput(groupSetDefine) { |
| 1398 | assert( |
| 1399 | getType(groupSetDefine.inputsHeight) === 'number', |
| 1400 | '`inputsHeight` is mandatory on groupSet to avoid height change' |
| 1401 | + ' to affects visual testing when switching groups.' |
| 1402 | ) |
| 1403 | assert( |
| 1404 | getType(groupSetDefine.groups) === 'array', |
| 1405 | '.groups must be an array.' |
| 1406 | ); |
| 1407 | assert( |
| 1408 | groupSetDefine.groups.length > 0, |
| 1409 | 'groupset.group must have at least one group' |
| 1410 | ); |
| 1411 | |
| 1412 | var groupSetEl = document.createElement('div'); |
| 1413 | initInputsContainer(groupSetEl, groupSetDefine, { |
| 1414 | ignoreInputsStyle: true, |
| 1415 | className: 'test-inputs-groupset', |
| 1416 | }); |
| 1417 | var groupSetMarginBottomEl = document.createElement('div'); |
| 1418 | groupSetMarginBottomEl.className = 'test-inputs-groupset-margin-bottom'; |
| 1419 | |
| 1420 | var groupSetTextEl = document.createElement('div'); |
| 1421 | groupSetTextEl.className = 'test-inputs-groupset-text'; |
| 1422 | groupSetEl.appendChild(groupSetTextEl); |
| 1423 | |
| 1424 | var groupSetCreated = { |
| 1425 | currentGroupIndex: 0, |
| 1426 | elList: [groupSetEl, groupSetMarginBottomEl], |
| 1427 | children: [], |
| 1428 | getState: getGroupSetInputState, |
| 1429 | setState: setGroupSetInputState, |
| 1430 | switchGroup: switchGroup |
| 1431 | }; |
| 1432 | |
| 1433 | for (var groupIdx = 0; groupIdx < groupSetDefine.groups.length; groupIdx++) { |
| 1434 | var groupDefine = groupSetDefine.groups[groupIdx]; |
| 1435 | assert(groupDefine, 'groupset.group must not be undefined/null.'); |
| 1436 | |
| 1437 | var groupChildInputsContainer = document.createElement('div'); |
| 1438 | initInputsContainer(groupChildInputsContainer, groupSetDefine, { |
| 1439 | ignoreFixHeight: true, |
| 1440 | className: 'test-inputs-groupset-group', |
| 1441 | }); |
| 1442 | groupSetEl.appendChild(groupChildInputsContainer); |
| 1443 | |
| 1444 | var groupChildId = retrieveId(groupDefine, 'id'); |
| 1445 | if (groupChildId == null) { |
| 1446 | throw new Error('In group child input, id must be specified.'); |
| 1447 | } |
| 1448 | |
| 1449 | var groupCreated = { |
| 1450 | groupParent: groupSetCreated, |
| 1451 | inputsContainerEl: groupChildInputsContainer, |
| 1452 | groupSetTextEl: groupSetTextEl, |
| 1453 | groupDefine: groupDefine, |
| 1454 | idList: null, |
no test coverage detected
searching dependent graphs…