@@ -125,80 +125,77 @@ void main() {
125
125
expect (js.context['ngProbe' ].apply ([ngtop])).toBeDefined ();
126
126
});
127
127
128
- // Issue #1219
129
- if (identical (1 , 1.0 ) || ! js.context['DART_VERSION' ].toString ().contains ("version: 1.5." )) {
130
- describe (r'testability' , () {
128
+ describe (r'testability' , () {
131
129
132
- var testability;
130
+ var testability;
133
131
134
- beforeEach (() {
135
- testability = angular['getTestability' ].apply ([ngtop]);
136
- });
137
-
138
- it ('should be available from Javascript' , () {
139
- expect (testability).toBeDefined ();
140
- });
141
-
142
- it ('should expose allowAnimations' , () {
143
- allowAnimations (allowed) => testability['allowAnimations' ].apply ([allowed]);
144
- expect (allowAnimations (false )).toEqual (true );
145
- expect (allowAnimations (false )).toEqual (false );
146
- expect (allowAnimations (true )).toEqual (false );
147
- expect (allowAnimations (true )).toEqual (true );
148
- });
132
+ beforeEach (() {
133
+ testability = angular['getTestability' ].apply ([ngtop]);
134
+ });
149
135
150
- describe ('bindings' , () {
151
- it ('should find exact bindings' , () {
152
- // exactMatch should fail.
153
- var bindingNodes = testability['findBindings' ].apply (['introspection' , true ]);
154
- expect (bindingNodes.length).toEqual (0 );
155
-
156
- // substring search (default) should succeed.
157
- // exactMatch should default to false.
158
- bindingNodes = testability['findBindings' ].apply (['introspection' ]);
159
- expect (bindingNodes.length).toEqual (1 );
160
- bindingNodes = testability['findBindings' ].apply (['introspection' , false ]);
161
- expect (bindingNodes.length).toEqual (1 );
162
-
163
- // and so should exact search with the correct query.
164
- bindingNodes = testability['findBindings' ].apply (["'introspection FTW'" , true ]);
165
- expect (bindingNodes.length).toEqual (1 );
166
- });
136
+ it ('should be available from Javascript' , () {
137
+ expect (testability).toBeDefined ();
138
+ });
167
139
168
- _assertBinding (String query) {
169
- var bindingNodes = testability['findBindings' ].apply ([query]);
170
- expect (bindingNodes.length).toEqual (1 );
171
- var node = bindingNodes[0 ];
172
- var probe = js.context['ngProbe' ].apply ([node]);
173
- expect (probe).toBeDefined ();
174
- var bindings = probe['bindings' ];
175
- expect (bindings['length' ]).toEqual (1 );
176
- expect (bindings[0 ].contains (query)).toBe (true );
177
- }
178
-
179
- it ('should find ng-bind bindings' , () => _assertBinding ('introspection FTW' ));
180
- it ('should find attribute mustache bindings' , () => _assertBinding ('attrMustache' ));
181
- it ('should find text mustache bindings' , () => _assertBinding ('textMustache' ));
182
- });
140
+ it ('should expose allowAnimations' , () {
141
+ allowAnimations (allowed) => testability['allowAnimations' ].apply ([allowed]);
142
+ expect (allowAnimations (false )).toEqual (true );
143
+ expect (allowAnimations (false )).toEqual (false );
144
+ expect (allowAnimations (true )).toEqual (false );
145
+ expect (allowAnimations (true )).toEqual (true );
146
+ });
183
147
184
- it ('should find models' , () {
148
+ describe ('bindings' , () {
149
+ it ('should find exact bindings' , () {
185
150
// exactMatch should fail.
186
- var modelNodes = testability['findModels ' ].apply (['my ' , true ]);
187
- expect (modelNodes .length).toEqual (0 );
151
+ var bindingNodes = testability['findBindings ' ].apply (['introspection ' , true ]);
152
+ expect (bindingNodes .length).toEqual (0 );
188
153
189
154
// substring search (default) should succeed.
190
- modelNodes = testability[ 'findModels' ]. apply ([ 'my' ]);
191
- expect (modelNodes.length). toEqual ( 1 );
192
- var divElement = modelNodes[ 0 ] ;
193
- expect (divElement is DivElement ). toEqual ( true );
194
- var probe = js.context[ 'ngProbe' ]. apply ([divElement] );
195
- expect (probe). toBeDefined ();
196
- var models = probe[ 'models' ];
197
- expect (models[ 'length' ]). toEqual ( 1 );
198
- expect (models[ 0 ] ).toEqual ('myModel' );
155
+ // exactMatch should default to false.
156
+ bindingNodes = testability[ 'findBindings' ]. apply ([ 'introspection' ] );
157
+ expect (bindingNodes.length). toEqual ( 1 ) ;
158
+ bindingNodes = testability[ 'findBindings' ]. apply ([ 'introspection' , false ] );
159
+ expect (bindingNodes.length). toEqual ( 1 );
160
+
161
+ // and so should exact search with the correct query.
162
+ bindingNodes = testability[ 'findBindings' ]. apply ([ "'introspection FTW'" , true ] );
163
+ expect (bindingNodes.length ).toEqual (1 );
199
164
});
165
+
166
+ _assertBinding (String query) {
167
+ var bindingNodes = testability['findBindings' ].apply ([query]);
168
+ expect (bindingNodes.length).toEqual (1 );
169
+ var node = bindingNodes[0 ];
170
+ var probe = js.context['ngProbe' ].apply ([node]);
171
+ expect (probe).toBeDefined ();
172
+ var bindings = probe['bindings' ];
173
+ expect (bindings['length' ]).toEqual (1 );
174
+ expect (bindings[0 ].contains (query)).toBe (true );
175
+ }
176
+
177
+ it ('should find ng-bind bindings' , () => _assertBinding ('introspection FTW' ));
178
+ it ('should find attribute mustache bindings' , () => _assertBinding ('attrMustache' ));
179
+ it ('should find text mustache bindings' , () => _assertBinding ('textMustache' ));
200
180
});
201
- }
181
+
182
+ it ('should find models' , () {
183
+ // exactMatch should fail.
184
+ var modelNodes = testability['findModels' ].apply (['my' , true ]);
185
+ expect (modelNodes.length).toEqual (0 );
186
+
187
+ // substring search (default) should succeed.
188
+ modelNodes = testability['findModels' ].apply (['my' ]);
189
+ expect (modelNodes.length).toEqual (1 );
190
+ var divElement = modelNodes[0 ];
191
+ expect (divElement is DivElement ).toEqual (true );
192
+ var probe = js.context['ngProbe' ].apply ([divElement]);
193
+ expect (probe).toBeDefined ();
194
+ var models = probe['models' ];
195
+ expect (models['length' ]).toEqual (1 );
196
+ expect (models[0 ]).toEqual ('myModel' );
197
+ });
198
+ });
202
199
});
203
200
});
204
201
}
0 commit comments