Skip to content

Commit

Permalink
Fix a bug where expectation was not allowed to be set twice with the …
Browse files Browse the repository at this point in the history
…same selector but differnet callbacks
  • Loading branch information
Inviz committed Nov 9, 2011
1 parent dbf197a commit 7bf9b00
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Source/Module/Ambient/Expectations.js
Expand Up @@ -109,7 +109,6 @@ var Expectations = LSD.Module.Expectations = new Class({
if (!kind) kind = expectations[type] = {};
var group = kind[value];
if (!group) group = kind[value] = [];
for (var k = group.length, expectation; expectation = group[--k];) if (expectation[0] == selector) continue values;
group.push([selector, callback]);
}
}
Expand Down Expand Up @@ -271,7 +270,9 @@ var check = function(type, value, state, target) {
}
} else subject.expect(selector.state, expectation[1])
}
} else if (subject.match(selector)) expectation[1].call(this, subject, !!state)
} else if (subject.match(selector)) {
expectation[1].call(this, subject, !!state)
}
}
if (expectations == this.expectations) expectations = Expectations.Default;
else break;
Expand Down

0 comments on commit 7bf9b00

Please sign in to comment.