You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it('should display the elements that do not match a switch',inject(function($rootScope,$compile){
99
+
element=$compile(
100
+
'<ul ng-switch="select">'+
101
+
'<li>always </li>'+
102
+
'<li ng-switch-when="1">one </li>'+
103
+
'<li ng-switch-when="2">two </li>'+
104
+
'<li ng-switch-default>other, </li>'+
105
+
'<li ng-switch-default>other too </li>'+
106
+
'</ul>')($rootScope);
107
+
$rootScope.$apply();
108
+
expect(element.text()).toEqual('always other, other too ');
109
+
$rootScope.select=1;
110
+
$rootScope.$apply();
111
+
expect(element.text()).toEqual('always one ');
112
+
}));
113
+
114
+
115
+
it('should display the elements that do not have ngSwitchWhen nor ngSwitchDefault at the position specified in the template, when the first and last elements in the ngSwitch body do not have a ngSwitch* directive',inject(function($rootScope,$compile){
116
+
element=$compile(
117
+
'<ul ng-switch="select">'+
118
+
'<li>1</li>'+
119
+
'<li ng-switch-when="1">2</li>'+
120
+
'<li>3</li>'+
121
+
'<li ng-switch-when="2">4</li>'+
122
+
'<li ng-switch-default>5</li>'+
123
+
'<li>6</li>'+
124
+
'<li ng-switch-default>7</li>'+
125
+
'<li>8</li>'+
126
+
'</ul>')($rootScope);
127
+
$rootScope.$apply();
128
+
expect(element.text()).toEqual('135678');
129
+
$rootScope.select=1;
130
+
$rootScope.$apply();
131
+
expect(element.text()).toEqual('12368');
132
+
}));
133
+
134
+
135
+
it('should display the elements that do not have ngSwitchWhen nor ngSwitchDefault at the position specified in the template when the first and last elements in the ngSwitch have a ngSwitch* directive',inject(function($rootScope,$compile){
136
+
element=$compile(
137
+
'<ul ng-switch="select">'+
138
+
'<li ng-switch-when="1">2</li>'+
139
+
'<li>3</li>'+
140
+
'<li ng-switch-when="2">4</li>'+
141
+
'<li ng-switch-default>5</li>'+
142
+
'<li>6</li>'+
143
+
'<li ng-switch-default>7</li>'+
144
+
'</ul>')($rootScope);
145
+
$rootScope.$apply();
146
+
expect(element.text()).toEqual('3567');
147
+
$rootScope.select=1;
148
+
$rootScope.$apply();
149
+
expect(element.text()).toEqual('236');
150
+
}));
151
+
152
+
98
153
it('should call change on switch',inject(function($rootScope,$compile){
0 commit comments