(state)
| 1270 | } |
| 1271 | |
| 1272 | function setSelectInputState(state) { |
| 1273 | if (!isObject(state)) { |
| 1274 | console.error( |
| 1275 | errMsgPrefix + ' Invalid select input state: ' + printObject(state) |
| 1276 | + ' May caused by test case change.' |
| 1277 | ); |
| 1278 | return; |
| 1279 | } |
| 1280 | if (!validateOptionIndex(state.optionIndex)) { |
| 1281 | return; |
| 1282 | } |
| 1283 | |
| 1284 | var optionStateMap = state.optionStateMap || {}; |
| 1285 | for (var optionIdx in optionStateMap) { |
| 1286 | if (state.optionStateMap.hasOwnProperty(optionIdx)) { |
| 1287 | var subInput = selectCtx._optionIdxToSubInput[optionIdx]; |
| 1288 | if (!subInput) { |
| 1289 | console.error( |
| 1290 | errMsgPrefix + ' Invalid select input state: ' + printObject(state) |
| 1291 | + ' Can not find a sub-input by optionIndex: ' + optionIdx + '.' |
| 1292 | + ' May caused by test case change.' |
| 1293 | ); |
| 1294 | return; |
| 1295 | } |
| 1296 | } |
| 1297 | } |
| 1298 | for (var optionIdx in optionStateMap) { |
| 1299 | if (state.optionStateMap.hasOwnProperty(optionIdx)) { |
| 1300 | var subInput = selectCtx._optionIdxToSubInput[optionIdx]; |
| 1301 | subInput.setState(state.optionStateMap[optionIdx]); |
| 1302 | } |
| 1303 | } |
| 1304 | resetSelectInputDisabled({disabled: state.disabled}); |
| 1305 | resetSelectInputOptionIndex(state.optionIndex); |
| 1306 | } |
| 1307 | |
| 1308 | function validateOptionIndex(optionIndex) { |
| 1309 | if (getType(optionIndex) !== 'number' |
nothing calls this directly
no test coverage detected
searching dependent graphs…