DEV: Stop loading external scripts while running tests (#81)

* DEV: Stop loading external scripts while running tests

* Revert "Turn of CSP for tests"

This reverts commit db1bf99277b18fae53201bd18bbaabe9f3680dfa. It had no effect, since CSP is set by the server, and this was only affecting the client
This commit is contained in:
David Taylor 2020-01-06 17:01:40 +00:00 committed by Blake Erickson
parent db1bf99277
commit cf27a7be64
5 changed files with 14 additions and 4 deletions

View File

@ -72,6 +72,10 @@ export default AdComponent.extend({
}, },
_triggerAds() { _triggerAds() {
if (Ember.testing) {
return; // Don't load external JS during tests
}
loadAdbutler().then( loadAdbutler().then(
function() { function() {
if (this.divs.length > 0) { if (this.divs.length > 0) {

View File

@ -135,6 +135,10 @@ export default AdComponent.extend({
}, },
_triggerAds() { _triggerAds() {
if (Ember.testing) {
return; // Don't load external JS during tests
}
this.set("adRequested", true); this.set("adRequested", true);
loadAdsense().then(function() { loadAdsense().then(function() {
const adsbygoogle = window.adsbygoogle || []; const adsbygoogle = window.adsbygoogle || [];

View File

@ -367,6 +367,10 @@ export default AdComponent.extend({
@on("didInsertElement") @on("didInsertElement")
_initGoogleDFP() { _initGoogleDFP() {
if (Ember.testing) {
return; // Don't load external JS during tests
}
if (!this.get("showAd")) { if (!this.get("showAd")) {
return; return;
} }

View File

@ -18,8 +18,7 @@ acceptance("AdSense", {
adsense_mobile_post_bottom_ad_size: "300*250 - medium rectangle", adsense_mobile_post_bottom_ad_size: "300*250 - medium rectangle",
adsense_nth_post_code: 6, adsense_nth_post_code: 6,
adsense_topic_above_post_stream_code: "above_post_stream_ad_unit", adsense_topic_above_post_stream_code: "above_post_stream_ad_unit",
adsense_topic_above_post_stream_ad_sizes: "728*90 - leaderboard", adsense_topic_above_post_stream_ad_sizes: "728*90 - leaderboard"
content_security_policy: false
}, },
site: { site: {
house_creatives: { house_creatives: {

View File

@ -18,8 +18,7 @@ acceptance("DFP Ads", {
dfp_mobile_post_bottom_ad_size: "300*250 - medium rectangle", dfp_mobile_post_bottom_ad_size: "300*250 - medium rectangle",
dfp_nth_post_code: 6, dfp_nth_post_code: 6,
dfp_topic_above_post_stream_code: "list_top_ad_unit", dfp_topic_above_post_stream_code: "list_top_ad_unit",
dfp_topic_above_post_stream_ad_sizes: "728*90 - leaderboard", dfp_topic_above_post_stream_ad_sizes: "728*90 - leaderboard"
content_security_policy: false
}, },
site: { site: {
house_creatives: { house_creatives: {