@@ -234,7 +234,14 @@ class DirectiveInfosMatcher extends Matcher {
234
234
Map expectedTemplate;
235
235
Map expectedComponent;
236
236
237
- DirectiveInfosMatcher (this .expected, {this .expectedTemplate, this .expectedComponent});
237
+ safeToString (a) => "${a ['element' ]} ${a ['selector' ]} ${a ['value' ]}" ;
238
+ safeToStringRef (a) => "${a .element } ${a .annotation .selector } ${a .value }" ;
239
+
240
+ DirectiveInfosMatcher (this .expected, {this .expectedTemplate, this .expectedComponent}) {
241
+ if (expected != null ) {
242
+ expected.sort ((a, b) => Comparable .compare (safeToString (a), safeToString (b)));
243
+ }
244
+ }
238
245
239
246
Description describe (Description description) =>
240
247
description..add (expected.toString ());
@@ -248,11 +255,12 @@ class DirectiveInfosMatcher extends Matcher {
248
255
bool matches (ElementBinder binder, matchState) {
249
256
var pass = true ;
250
257
if (expected != null ) {
251
- pass = expected.length == binder.decorators.length;
258
+ var decorators = new List .from (binder.decorators)
259
+ ..sort ((a, b) => Comparable .compare (safeToStringRef (a), safeToStringRef (b)));
260
+ pass = expected.length == decorators.length;
252
261
for (var i = 0 , ii = expected.length; i < ii; i++ ) {
253
- DirectiveRef directiveRef = binder. decorators[i];
262
+ DirectiveRef directiveRef = decorators[i];
254
263
var expectedMap = expected[i];
255
-
256
264
pass = pass && _refMatches (directiveRef, expectedMap);
257
265
}
258
266
}
0 commit comments