-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-blocker.js
29 lines (27 loc) · 1.04 KB
/
test-blocker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* eslint-env mocha,jquery */
/* global expect,AdblockDetector */
describe("AdblockDetector - With Ad Blocker Running", function() {
"use strict";
describe(".detect()", function() {
it("should detect when an ad-blocker is running", function(done) {
AdblockDetector.detect({
timeout: 0,
blocked: function(element) {
expect(element).to.be.an("object");
},
complete: function(adCount, adsBlockedCount) {
expect(adCount).to.equal(2, "2 ads detected");
expect(adsBlockedCount).to.equal(2, "2 ads blocked");
done();
}
});
});
});
describe("hasAdsBlocked()", function() {
it("should return true when an ad-blocker is running", function() {
$(".ad-container").each(function(i, element) {
expect(AdblockDetector.hasAdsBlocked(element)).to.be.ok();
});
});
});
});