DEV: resets page tracking state between tests (#7847)

This commit is contained in:
Joffrey JAFFEUX 2019-07-03 10:08:05 +02:00 committed by GitHub
parent 9ee2c121c1
commit ecf0215ee7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -1,6 +1,7 @@
import { cleanDOM } from "discourse/lib/clean-dom";
import {
startPageTracking,
resetPageTracking,
googleTagManagerPageChanged
} from "discourse/lib/page-tracker";
import { viewTrackingRequired } from "discourse/lib/ajax";
@ -49,5 +50,9 @@ export default {
}
});
}
},
teardown() {
resetPageTracking();
}
};

View File

@ -1,6 +1,5 @@
let _started = false;
const cache = {};
let cache = {};
let transitionCount = 0;
export function setTransient(key, data, count) {
@ -11,6 +10,12 @@ export function getTransient(key) {
return cache[key];
}
export function resetPageTracking() {
_started = false;
transitionCount = 0;
cache = {};
}
export function startPageTracking(router, appEvents) {
if (_started) {
return;