Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
997 changes: 525 additions & 472 deletions jquery.dfp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion jquery.dfp.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tests/SpecRunner.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<!-- include spec files here... -->
<script type="text/javascript" src="spec/loadingPhaseSpec.js"></script>
<script type="text/javascript" src="spec/adUnitSpec.js"></script>
<script type="text/javascript" src="spec/displayAdsSpec.js"></script>
<script type="text/javascript" src="spec/TargetingSpec.js"></script>
<script type="text/javascript" src="spec/categoryExclusionSpec.js"></script>
<script type="text/javascript" src="spec/setLocationSpec.js"></script>
Expand Down
3 changes: 3 additions & 0 deletions tests/spec/categoryExclusionSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ describe('Category Exclusion', function () {
enableSingleRequest: function () {},
setTargeting: function () {},
collapseEmptyDivs: function () {},
addEventListener: function () {},
setCategoryExclusion: mock.setCategoryExclusion
};
};
Expand Down Expand Up @@ -172,6 +173,7 @@ describe('Category Exclusion', function () {
enableSingleRequest: function () {},
setTargeting: function () {},
collapseEmptyDivs: function () {},
addEventListener: function () {},
setCategoryExclusion: mock.setCategoryExclusion
};
};
Expand Down Expand Up @@ -211,6 +213,7 @@ describe('Category Exclusion', function () {
enableSingleRequest: function () {},
setTargeting: function () {},
collapseEmptyDivs: function () {},
addEventListener: function () {},
setCategoryExclusion: mock.setCategoryExclusion
};
};
Expand Down
50 changes: 50 additions & 0 deletions tests/spec/displayAdsSpec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
describe('Display Ad units', function () {

var cleanup = function () {
$('.adunit').remove();
$('script[src*="gpt.js"]').remove();
window.googletag = undefined;
};
beforeEach(cleanup);
afterEach(cleanup);

it('Refresh ads in single request with disable init load', function (done) {
var mock = {};
mock.refresh = function (param) {
};

var dummyTag = {};
dummyTag.pubads = function () {
return {
enableSingleRequest: function () {},
setTargeting: function () {},
collapseEmptyDivs: function () {},
disableInitialLoad: function () {},
addEventListener: function () {},
refresh: mock.refresh
};
};

dummyTag.enableServices = function () {};

spyOn(dummyTag, 'enableServices').and.callThrough();
spyOn(mock, 'refresh').and.callThrough();

jQuery.dfp({
dfpID: 'xxxxxxxxx',
googletag: dummyTag,
disableInitialLoad: true
});

waitsForAndRuns(function () {
if (typeof window.googletag.getVersion === 'function') {
return true;
} else {
return false;
}
}, function () {
expect(mock.refresh).toHaveBeenCalled();
done();
}, 5000);
});
});
2 changes: 1 addition & 1 deletion tests/spec/loadingPhaseSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('Loading Phase', function () {
return false;
}
}, function () {
expect(window.googletag.getVersion()).toBeGreaterThan('23');
expect(window.googletag.getVersion()).toBeGreaterThan(23);
done();
}, 5000);
});
Expand Down
9 changes: 6 additions & 3 deletions tests/spec/targetingSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ describe('Targeting', function () {
return {
enableSingleRequest: function () {},
setTargeting: mock.setTargeting,
collapseEmptyDivs: function () {}
collapseEmptyDivs: function () {},
addEventListener: function () {}
};
};

Expand Down Expand Up @@ -56,7 +57,8 @@ describe('Targeting', function () {
return {
enableSingleRequest: function () { },
setTargeting: mock.setTargeting,
collapseEmptyDivs: function () { }
collapseEmptyDivs: function () { },
addEventListener: function () { }
};
};

Expand Down Expand Up @@ -91,7 +93,8 @@ describe('Targeting', function () {
return {
enableSingleRequest: function () {},
setTargeting: mock.setTargeting,
collapseEmptyDivs: function () {}
collapseEmptyDivs: function () {},
addEventListener: function () {}
};
};

Expand Down