MCPcopy Index your code
hub / github.com/angular/angular / testDifferent

Function testDifferent

packages/zone.js/test/browser/browser.spec.ts:1304–1341  ·  view source on GitHub ↗
(args1?: any, args2?: any)

Source from the content-addressed store, hash-verified

1302 });
1303
1304 const testDifferent = function (args1?: any, args2?: any) {
1305 zone.run(function () {
1306 if (args1) {
1307 (document as any).addEventListener('click', docListener, args1);
1308 } else {
1309 (document as any).addEventListener('click', docListener);
1310 }
1311 if (args2) {
1312 (document as any).addEventListener('click', docListener1, args2);
1313 } else {
1314 (document as any).addEventListener('click', docListener1);
1315 }
1316 });
1317
1318 button.dispatchEvent(clickEvent);
1319 expect(hookSpy).toHaveBeenCalled();
1320 expect(logs.sort()).toEqual(['document options', 'document useCapture']);
1321 logs = [];
1322
1323 if (args1) {
1324 (document as any).removeEventListener('click', docListener, args1);
1325 } else {
1326 (document as any).removeEventListener('click', docListener);
1327 }
1328
1329 button.dispatchEvent(clickEvent);
1330 expect(logs).toEqual(['document useCapture']);
1331 logs = [];
1332
1333 if (args2) {
1334 (document as any).removeEventListener('click', docListener1, args2);
1335 } else {
1336 (document as any).removeEventListener('click', docListener1);
1337 }
1338
1339 button.dispatchEvent(clickEvent);
1340 expect(logs).toEqual([]);
1341 };
1342
1343 it('should be able to add different handlers for same event', function () {
1344 let captureFalse = [

Callers 1

browser.spec.tsFile · 0.85

Calls 4

runMethod · 0.65
addEventListenerMethod · 0.65
removeEventListenerMethod · 0.65
dispatchEventMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…