Skip to content

Commit

Permalink
Fix tests in facebook pixel
Browse files Browse the repository at this point in the history
  • Loading branch information
josemarluedke committed Aug 23, 2019
1 parent 057c064 commit b70b1e8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion addon/metrics-adapters/facebook-pixel.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default BaseAdapter.extend({

assert(`[ember-metrics] You must pass a valid \`id\` to the ${this.toString()} adapter`, id);

if (canUseDOM) {
if (canUseDOM && !window.fbq) {
/* eslint-disable */
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
Expand Down
8 changes: 1 addition & 7 deletions tests/unit/metrics-adapters/facebook-pixel-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,7 @@ function waitForScripts() {
if (window.fbq.instance.configsLoaded[config.id]) {
init();
} else {
// not ready, so use the event system
// (`fbq.once` would be better but has a bug)
window.fbq.on('configLoaded', name => {
if (name === config.id) {
init();
}
});
later(wait, 10);
}
} else {
// generic script hasn't run yet
Expand Down

0 comments on commit b70b1e8

Please sign in to comment.