Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
coop182 committed Sep 5, 2015
1 parent d0305a0 commit b4890e0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 14 deletions.
4 changes: 2 additions & 2 deletions tests/spec/adUnitSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('Ad units', function () {
});

waitsForAndRuns(function () {
if (typeof window.googletag.getVersion === 'function') {
if (typeof window.googletag.getVersion === 'function' && $('.adunit').data('googleAdUnit')) {
return true;
} else {
return false;
Expand All @@ -70,7 +70,7 @@ describe('Ad units', function () {
});

waitsForAndRuns(function () {
if (typeof window.googletag.getVersion === 'function') {
if (typeof window.googletag.getVersion === 'function' && $('.adunit').data('googleAdUnit')) {
return true;
} else {
return false;
Expand Down
2 changes: 1 addition & 1 deletion tests/spec/callBacksSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ describe('Callbacks', function () {
});

waitsForAndRuns(function () {
if (typeof window.googletag.getVersion === 'function') {
if (typeof window.googletag.getVersion === 'function' && $('.adunit').data('googleAdUnit')) {
return true;
} else {
return false;
Expand Down
15 changes: 9 additions & 6 deletions tests/spec/categoryExclusionSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('Category Exclusion', function () {
});

waitsForAndRuns(function () {
if (typeof window.googletag.getVersion === 'function') {
if (typeof window.googletag.getVersion === 'function' && $('.adunit').data('googleAdUnit')) {
return true;
} else {
return false;
Expand Down Expand Up @@ -70,7 +70,7 @@ describe('Category Exclusion', function () {
});

waitsForAndRuns(function () {
if (typeof window.googletag.getVersion === 'function') {
if (typeof window.googletag.getVersion === 'function' && $('.adunit').data('googleAdUnit')) {
return true;
} else {
return false;
Expand Down Expand Up @@ -107,7 +107,7 @@ describe('Category Exclusion', function () {
});

waitsForAndRuns(function () {
if (typeof window.googletag.getVersion === 'function') {
if (typeof window.googletag.getVersion === 'function' && $('.adunit').data('googleAdUnit')) {
return true;
} else {
return false;
Expand Down Expand Up @@ -138,14 +138,15 @@ describe('Category Exclusion', function () {

spyOn(mock, 'setCategoryExclusion').and.callThrough();

jQuery('body').append('<div class="adunit"></div>');
jQuery.dfp({
dfpID: 'xxxxxxxxx',
googletag: dummyTag,
setCategoryExclusion: 'firstcategory, secondcategory'
});

waitsForAndRuns(function () {
if (typeof window.googletag.getVersion === 'function') {
if (typeof window.googletag.getVersion === 'function' && $('.adunit').data('googleAdUnit')) {
return true;
} else {
return false;
Expand Down Expand Up @@ -177,14 +178,15 @@ describe('Category Exclusion', function () {

spyOn(mock, 'setCategoryExclusion').and.callThrough();

jQuery('body').append('<div class="adunit"></div>');
jQuery.dfp({
dfpID: 'xxxxxxxxx',
googletag: dummyTag,
setCategoryExclusion: 'firstcategory, '
});

waitsForAndRuns(function () {
if (typeof window.googletag.getVersion === 'function') {
if (typeof window.googletag.getVersion === 'function' && $('.adunit').data('googleAdUnit')) {
return true;
} else {
return false;
Expand Down Expand Up @@ -215,14 +217,15 @@ describe('Category Exclusion', function () {

spyOn(mock, 'setCategoryExclusion').and.callThrough();

jQuery('body').append('<div class="adunit"></div>');
jQuery.dfp({
dfpID: 'xxxxxxxxx',
googletag: dummyTag,
setCategoryExclusion: 'firstcategory'
});

waitsForAndRuns(function () {
if (typeof window.googletag.getVersion === 'function') {
if (typeof window.googletag.getVersion === 'function' && $('.adunit').data('googleAdUnit')) {
return true;
} else {
return false;
Expand Down
4 changes: 2 additions & 2 deletions tests/spec/sizeMappingSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('SizeMapping', function () {
});

waitsForAndRuns(function () {
if (typeof window.googletag.getVersion === 'function') {
if (typeof window.googletag.getVersion === 'function' && $('.adunit').data('googleAdUnit')) {
return true;
} else {
return false;
Expand Down Expand Up @@ -81,7 +81,7 @@ describe('SizeMapping', function () {
});

waitsForAndRuns(function () {
if (typeof window.googletag.getVersion === 'function') {
if (typeof window.googletag.getVersion === 'function' && $('.adunit').data('googleAdUnit')) {
return true;
} else {
return false;
Expand Down
9 changes: 6 additions & 3 deletions tests/spec/targetingSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ describe('Targeting', function () {

spyOn(mock, 'setTargeting').and.callThrough();

jQuery('body').append('<div class="adunit"></div>');
jQuery.dfp({
dfpID: 'xxxxxxxxx',
googletag: dummyTag
});

waitsForAndRuns(function () {
if (typeof window.googletag.getVersion === 'function') {
if (typeof window.googletag.getVersion === 'function' && $('.adunit').data('googleAdUnit')) {
return true;
} else {
return false;
Expand Down Expand Up @@ -61,14 +62,15 @@ describe('Targeting', function () {

spyOn(mock, 'setTargeting').and.callThrough();

jQuery('body').append('<div class="adunit"></div>');
jQuery.dfp({
dfpID: 'xxxxxxxxx',
setUrlTargeting: false,
googletag: dummyTag
});

waitsForAndRuns(function () {
if (typeof window.googletag.getVersion === 'function') {
if (typeof window.googletag.getVersion === 'function' && $('.adunit').data('googleAdUnit')) {
return true;
} else {
return false;
Expand All @@ -95,14 +97,15 @@ describe('Targeting', function () {

spyOn(mock, 'setTargeting').and.callThrough();

jQuery('body').append('<div class="adunit"></div>');
jQuery.dfp({
dfpID: 'xxxxxxxxx',
googletag: dummyTag,
url: 'http://www.domain.com/path1/path2?param1=1&param2=2'
});

waitsForAndRuns(function () {
if (typeof window.googletag.getVersion === 'function') {
if (typeof window.googletag.getVersion === 'function' && $('.adunit').data('googleAdUnit')) {
return true;
} else {
return false;
Expand Down

0 comments on commit b4890e0

Please sign in to comment.