Skip to content

Commit

Permalink
--amend
Browse files Browse the repository at this point in the history
  • Loading branch information
pabloalbizu committed Oct 27, 2016
1 parent 9651b7b commit 54cb06a
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 7 deletions.
6 changes: 1 addition & 5 deletions jquery.dfp.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@
pubadsService.setCentering(true);
}

if (dfpIsLoaded === false) {
if (!dfpIsLoaded) {
// Setup event listener to listen for renderEnded event and fire callbacks.
pubadsService.addEventListener('slotRenderEnded', function (event) {

Expand Down Expand Up @@ -404,10 +404,6 @@
if ($(this).hasClass('display-none')) {
return $(this);
}
//
// if (dfpOptions.refreshExisting && $(this).hasClass('display-block')) {
// return $(this);
// }
}).map(function () {
return $(this).data(storeAs);
}).get();
Expand Down
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
45 changes: 45 additions & 0 deletions tests/spec/displayAdsSpec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
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 {
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

0 comments on commit 54cb06a

Please sign in to comment.