Verifies that the option values are valid.
()
| 1013 | |
| 1014 | /** Verifies that the option values are valid. */ |
| 1015 | private _verifyOptionValues() { |
| 1016 | if (this.options && (typeof ngDevMode === 'undefined' || ngDevMode)) { |
| 1017 | const selected = this.selectionModel.selected; |
| 1018 | const invalidValues = this._getInvalidOptionValues(selected); |
| 1019 | |
| 1020 | if (!this.multiple && selected.length > 1) { |
| 1021 | throw Error('Listbox cannot have more than one selected value in single selection mode.'); |
| 1022 | } |
| 1023 | |
| 1024 | if (invalidValues.length) { |
| 1025 | throw Error('Listbox has selected values that do not match any of its options.'); |
| 1026 | } |
| 1027 | } |
| 1028 | } |
| 1029 | |
| 1030 | /** |
| 1031 | * Coerces a value into an array representing a listbox selection. |
no test coverage detected