@@ -57,7 +57,7 @@ export class SelectionModel<T> {
5757 * Selects a value or an array of values.
5858 */
5959 select ( ...values : T [ ] ) : void {
60- this . _warnMultipleValuesForSingleSelection ( values ) ;
60+ this . _verifyValueAssignment ( values ) ;
6161 values . forEach ( value => this . _markSelected ( value ) ) ;
6262 this . _emitChangeEvent ( ) ;
6363 }
@@ -66,7 +66,7 @@ export class SelectionModel<T> {
6666 * Deselects a value or an array of values.
6767 */
6868 deselect ( ...values : T [ ] ) : void {
69- this . _warnMultipleValuesForSingleSelection ( values ) ;
69+ this . _verifyValueAssignment ( values ) ;
7070 values . forEach ( value => this . _unmarkSelected ( value ) ) ;
7171 this . _emitChangeEvent ( ) ;
7272 }
@@ -165,10 +165,13 @@ export class SelectionModel<T> {
165165 }
166166 }
167167
168- /** Throws an error if multiple values are passed into a selection model with a single value. */
169- private _warnMultipleValuesForSingleSelection ( values : T [ ] ) {
168+ /**
169+ * Verifies the value assignment and throws an error if the specified value array is
170+ * including multiple values while the selection model is not supporting multiple values.
171+ */
172+ private _verifyValueAssignment ( values : T [ ] ) {
170173 if ( values . length > 1 && ! this . _isMulti ) {
171- throwMultipleValuesInSingleSelectionError ( ) ;
174+ throw getMultipleValuesInSingleSelectionError ( ) ;
172175 }
173176 }
174177}
@@ -182,6 +185,6 @@ export class SelectionChange<T> {
182185}
183186
184187/** Throws an error if multiple values are passed into a selection model with a single value. */
185- export function throwMultipleValuesInSingleSelectionError ( ) {
186- throw Error ( 'Cannot pass multiple values into SelectionModel with single-value mode.' ) ;
188+ export function getMultipleValuesInSingleSelectionError ( ) {
189+ return Error ( 'Cannot pass multiple values into SelectionModel with single-value mode.' ) ;
187190}
0 commit comments