mirror of
https://github.com/discourse/discourse.git
synced 2025-04-11 16:52:56 +08:00
DEV: resets page tracking state between tests (#7847)
This commit is contained in:
parent
9ee2c121c1
commit
ecf0215ee7
@ -1,6 +1,7 @@
|
|||||||
import { cleanDOM } from "discourse/lib/clean-dom";
|
import { cleanDOM } from "discourse/lib/clean-dom";
|
||||||
import {
|
import {
|
||||||
startPageTracking,
|
startPageTracking,
|
||||||
|
resetPageTracking,
|
||||||
googleTagManagerPageChanged
|
googleTagManagerPageChanged
|
||||||
} from "discourse/lib/page-tracker";
|
} from "discourse/lib/page-tracker";
|
||||||
import { viewTrackingRequired } from "discourse/lib/ajax";
|
import { viewTrackingRequired } from "discourse/lib/ajax";
|
||||||
@ -49,5 +50,9 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
teardown() {
|
||||||
|
resetPageTracking();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
let _started = false;
|
let _started = false;
|
||||||
|
let cache = {};
|
||||||
const cache = {};
|
|
||||||
let transitionCount = 0;
|
let transitionCount = 0;
|
||||||
|
|
||||||
export function setTransient(key, data, count) {
|
export function setTransient(key, data, count) {
|
||||||
@ -11,6 +10,12 @@ export function getTransient(key) {
|
|||||||
return cache[key];
|
return cache[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function resetPageTracking() {
|
||||||
|
_started = false;
|
||||||
|
transitionCount = 0;
|
||||||
|
cache = {};
|
||||||
|
}
|
||||||
|
|
||||||
export function startPageTracking(router, appEvents) {
|
export function startPageTracking(router, appEvents) {
|
||||||
if (_started) {
|
if (_started) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user