Skip to content

Commit

Permalink
Merge branch 'i-like-robots-namespace-option' of https://github.com/i…
Browse files Browse the repository at this point in the history
…-like-robots/jquery.dfp.js into i-like-robots-i-like-robots-namespace-option
  • Loading branch information
coop182 committed Feb 28, 2014
2 parents 01cb0e1 + 358f045 commit 8010a25
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
5 changes: 3 additions & 2 deletions jquery.dfp.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@
refreshExisting: true,
disablePublisherConsole: false,
disableInitialLoad: false,
noFetch: false
noFetch: false,
namespace: undefined
};

if (typeof options.setUrlTargeting === 'undefined' || options.setUrlTargeting)
Expand Down Expand Up @@ -349,7 +350,7 @@
*/
getName = function ($adUnit) {

return $adUnit.data('adunit') || $adUnit.attr('id');
return $adUnit.data('adunit') || dfpOptions.namespace || $adUnit.attr('id');

},

Expand Down
4 changes: 2 additions & 2 deletions jquery.dfp.min.js

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

22 changes: 22 additions & 0 deletions tests/spec/adUnitSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,26 @@ describe('Ad units', function () {

});

it("Google ad unit object get attached to the ad unit container (with namespace)", function () {
var namespace = 'my-long-namespace';

runs(function () {
$('body').append('<div class="adunit"></div>');
$.dfp({dfpID: 'xxxxxxx', namespace: namespace});
}, "Kick off loader");

waitsFor(function () {
if (typeof window.googletag.getVersion === 'function') {
return true;
} else {
return false;
}
}, "getVersion function to exist", 5000);

runs(function () {
expect($('.adunit').data('googleAdUnit').getName()).toEqual('/xxxxxxx/' + namespace);
});

});

});

0 comments on commit 8010a25

Please sign in to comment.