Skip to content

Commit

Permalink
Fix event firing on native click (#3589)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewlane authored and jsnellbaker committed Mar 1, 2019
1 parent 5112950 commit dd26503
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/native.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export function fireNativeTrackers(message, adObject) {
}

(trackers || []).forEach(triggerPixel);
return message.action;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/secureCreatives.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ function receiveMessage(ev) {
return;
}

fireNativeTrackers(data, adObject);
const trackerType = fireNativeTrackers(data, adObject);
if (trackerType === 'click') { return; }

auctionManager.addWinningBid(adObject);
events.emit(BID_WON, adObject);
}
Expand Down
3 changes: 2 additions & 1 deletion test/spec/native_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ describe('native.js', function () {
});

it('fires click trackers', function () {
fireNativeTrackers({ action: 'click' }, bid);
const trackerType = fireNativeTrackers({ action: 'click' }, bid);
expect(trackerType).to.equal('click');
sinon.assert.calledOnce(triggerPixelStub);
sinon.assert.calledWith(triggerPixelStub, bid.native.clickTrackers[0]);
});
Expand Down

0 comments on commit dd26503

Please sign in to comment.