MCPcopy
hub / github.com/Semantic-Org/Semantic-UI / delegateToCalls

Function delegateToCalls

test/helpers/sinon.js:1725–1751  ·  view source on GitHub ↗
(method, matchAny, actual, notCalled)

Source from the content-addressed store, hash-verified

1723 };
1724
1725 function delegateToCalls(method, matchAny, actual, notCalled) {
1726 spyApi[method] = function () {
1727 if (!this.called) {
1728 if (notCalled) {
1729 return notCalled.apply(this, arguments);
1730 }
1731 return false;
1732 }
1733
1734 var currentCall;
1735 var matches = 0;
1736
1737 for (var i = 0, l = this.callCount; i < l; i += 1) {
1738 currentCall = this.getCall(i);
1739
1740 if (currentCall[actual || method].apply(currentCall, arguments)) {
1741 matches += 1;
1742
1743 if (matchAny) {
1744 return true;
1745 }
1746 }
1747 }
1748
1749 return matches === this.callCount;
1750 };
1751 }
1752
1753 delegateToCalls("calledOn", true);
1754 delegateToCalls("alwaysCalledOn", false, "calledOn");

Callers 1

sinon.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…