1
- import { dispatchMouseEvent } from '../.. /cdk/testing/private' ;
1
+ import { dispatchMouseEvent } from '@angular /cdk/testing/private' ;
2
2
import { Component , DebugElement , QueryList , ViewChild , ViewChildren } from '@angular/core' ;
3
3
import { CommonModule } from '@angular/common' ;
4
4
import { ComponentFixture , fakeAsync , flush , TestBed , tick } from '@angular/core/testing' ;
@@ -14,8 +14,11 @@ import {
14
14
describe ( 'MatButtonToggle with forms' , ( ) => {
15
15
beforeEach ( fakeAsync ( ( ) => {
16
16
TestBed . configureTestingModule ( {
17
- imports : [ MatButtonToggleModule , FormsModule , ReactiveFormsModule , CommonModule ] ,
18
- declarations : [
17
+ imports : [
18
+ MatButtonToggleModule ,
19
+ FormsModule ,
20
+ ReactiveFormsModule ,
21
+ CommonModule ,
19
22
ButtonToggleGroupWithNgModel ,
20
23
ButtonToggleGroupWithFormControl ,
21
24
ButtonToggleGroupWithIndirectDescendantToggles ,
@@ -310,8 +313,8 @@ describe('MatButtonToggle with forms', () => {
310
313
describe ( 'MatButtonToggle without forms' , ( ) => {
311
314
beforeEach ( fakeAsync ( ( ) => {
312
315
TestBed . configureTestingModule ( {
313
- imports : [ MatButtonToggleModule ] ,
314
- declarations : [
316
+ imports : [
317
+ MatButtonToggleModule ,
315
318
ButtonTogglesInsideButtonToggleGroup ,
316
319
ButtonTogglesInsideButtonToggleGroupMultiple ,
317
320
FalsyButtonTogglesInsideButtonToggleGroupMultiple ,
@@ -969,6 +972,8 @@ describe('MatButtonToggle without forms', () => {
969
972
<mat-button-toggle value="test3">Test3</mat-button-toggle>
970
973
</mat-button-toggle-group>
971
974
` ,
975
+ standalone : true ,
976
+ imports : [ MatButtonToggleModule ] ,
972
977
} )
973
978
class ButtonTogglesInsideButtonToggleGroup {
974
979
isGroupDisabled : boolean = false ;
@@ -991,6 +996,8 @@ class ButtonTogglesInsideButtonToggleGroup {
991
996
}
992
997
</mat-button-toggle-group>
993
998
` ,
999
+ standalone : true ,
1000
+ imports : [ MatButtonToggleModule , FormsModule , ReactiveFormsModule , CommonModule ] ,
994
1001
} )
995
1002
class ButtonToggleGroupWithNgModel {
996
1003
groupName = 'group-name' ;
@@ -1012,6 +1019,8 @@ class ButtonToggleGroupWithNgModel {
1012
1019
<mat-button-toggle value="sugar">Sugar</mat-button-toggle>
1013
1020
</mat-button-toggle-group>
1014
1021
` ,
1022
+ standalone : true ,
1023
+ imports : [ MatButtonToggleModule ] ,
1015
1024
} )
1016
1025
class ButtonTogglesInsideButtonToggleGroupMultiple {
1017
1026
isGroupDisabled : boolean = false ;
@@ -1027,6 +1036,8 @@ class ButtonTogglesInsideButtonToggleGroupMultiple {
1027
1036
<mat-button-toggle>Sugar</mat-button-toggle>
1028
1037
</mat-button-toggle-group>
1029
1038
` ,
1039
+ standalone : true ,
1040
+ imports : [ MatButtonToggleModule ] ,
1030
1041
} )
1031
1042
class FalsyButtonTogglesInsideButtonToggleGroupMultiple {
1032
1043
value : ( '' | number | null | undefined | boolean ) [ ] = [ 0 ] ;
@@ -1037,6 +1048,8 @@ class FalsyButtonTogglesInsideButtonToggleGroupMultiple {
1037
1048
template : `
1038
1049
<mat-button-toggle>Yes</mat-button-toggle>
1039
1050
` ,
1051
+ standalone : true ,
1052
+ imports : [ MatButtonToggleModule ] ,
1040
1053
} )
1041
1054
class StandaloneButtonToggle { }
1042
1055
@@ -1047,6 +1060,8 @@ class StandaloneButtonToggle {}
1047
1060
<mat-button-toggle value="green">Value Green</mat-button-toggle>
1048
1061
</mat-button-toggle-group>
1049
1062
` ,
1063
+ standalone : true ,
1064
+ imports : [ MatButtonToggleModule ] ,
1050
1065
} )
1051
1066
class ButtonToggleGroupWithInitialValue {
1052
1067
lastEvent : MatButtonToggleChange ;
@@ -1060,6 +1075,8 @@ class ButtonToggleGroupWithInitialValue {
1060
1075
<mat-button-toggle value="blue">Value Blue</mat-button-toggle>
1061
1076
</mat-button-toggle-group>
1062
1077
` ,
1078
+ standalone : true ,
1079
+ imports : [ MatButtonToggleModule , FormsModule , ReactiveFormsModule , CommonModule ] ,
1063
1080
} )
1064
1081
class ButtonToggleGroupWithFormControl {
1065
1082
control = new FormControl ( '' ) ;
@@ -1076,6 +1093,8 @@ class ButtonToggleGroupWithFormControl {
1076
1093
}
1077
1094
</mat-button-toggle-group>
1078
1095
` ,
1096
+ standalone : true ,
1097
+ imports : [ MatButtonToggleModule , FormsModule , ReactiveFormsModule , CommonModule ] ,
1079
1098
} )
1080
1099
class ButtonToggleGroupWithIndirectDescendantToggles {
1081
1100
control = new FormControl ( '' ) ;
@@ -1084,12 +1103,16 @@ class ButtonToggleGroupWithIndirectDescendantToggles {
1084
1103
/** Simple test component with an aria-label set. */
1085
1104
@Component ( {
1086
1105
template : `<mat-button-toggle aria-label="Super effective"></mat-button-toggle>` ,
1106
+ standalone : true ,
1107
+ imports : [ MatButtonToggleModule ] ,
1087
1108
} )
1088
1109
class ButtonToggleWithAriaLabel { }
1089
1110
1090
1111
/** Simple test component with an aria-label set. */
1091
1112
@Component ( {
1092
1113
template : `<mat-button-toggle aria-labelledby="some-id"></mat-button-toggle>` ,
1114
+ standalone : true ,
1115
+ imports : [ MatButtonToggleModule ] ,
1093
1116
} )
1094
1117
class ButtonToggleWithAriaLabelledby { }
1095
1118
@@ -1101,6 +1124,8 @@ class ButtonToggleWithAriaLabelledby {}
1101
1124
}
1102
1125
</mat-button-toggle-group>
1103
1126
` ,
1127
+ standalone : true ,
1128
+ imports : [ MatButtonToggleModule ] ,
1104
1129
} )
1105
1130
class RepeatedButtonTogglesWithPreselectedValue {
1106
1131
@ViewChild ( MatButtonToggleGroup ) toggleGroup : MatButtonToggleGroup ;
@@ -1112,11 +1137,15 @@ class RepeatedButtonTogglesWithPreselectedValue {
1112
1137
1113
1138
@Component ( {
1114
1139
template : `<mat-button-toggle tabindex="3"></mat-button-toggle>` ,
1140
+ standalone : true ,
1141
+ imports : [ MatButtonToggleModule ] ,
1115
1142
} )
1116
1143
class ButtonToggleWithTabindex { }
1117
1144
1118
1145
@Component ( {
1119
1146
template : `<mat-button-toggle name="custom-name"></mat-button-toggle>` ,
1147
+ standalone : true ,
1148
+ imports : [ MatButtonToggleModule ] ,
1120
1149
} )
1121
1150
class ButtonToggleWithStaticName { }
1122
1151
@@ -1127,6 +1156,8 @@ class ButtonToggleWithStaticName {}
1127
1156
<mat-button-toggle value="2" checked>Two</mat-button-toggle>
1128
1157
</mat-button-toggle-group>
1129
1158
` ,
1159
+ standalone : true ,
1160
+ imports : [ MatButtonToggleModule ] ,
1130
1161
} )
1131
1162
class ButtonToggleWithStaticChecked {
1132
1163
@ViewChild ( MatButtonToggleGroup ) group : MatButtonToggleGroup ;
@@ -1137,6 +1168,8 @@ class ButtonToggleWithStaticChecked {
1137
1168
template : `
1138
1169
<mat-button-toggle aria-label="Toggle me" aria-labelledby="something"></mat-button-toggle>
1139
1170
` ,
1171
+ standalone : true ,
1172
+ imports : [ MatButtonToggleModule ] ,
1140
1173
} )
1141
1174
class ButtonToggleWithStaticAriaAttributes { }
1142
1175
@@ -1148,6 +1181,8 @@ class ButtonToggleWithStaticAriaAttributes {}
1148
1181
}
1149
1182
</mat-button-toggle-group>
1150
1183
` ,
1184
+ standalone : true ,
1185
+ imports : [ MatButtonToggleModule , FormsModule , ReactiveFormsModule , CommonModule ] ,
1151
1186
} )
1152
1187
class ButtonToggleGroupWithFormControlAndDynamicButtons {
1153
1188
@ViewChildren ( MatButtonToggle ) toggles : QueryList < MatButtonToggle > ;
0 commit comments