Removing _trackEvent method
It has become an unnecessary abstraction around _gaq.push
This commit is contained in:
parent
fd8014d326
commit
37fca15bc8
@ -239,19 +239,6 @@ describe('regexper.js', function() {
|
||||
|
||||
});
|
||||
|
||||
describe('#_trackEvent', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
spyOn(window._gaq, 'push');
|
||||
});
|
||||
|
||||
it('adds a _trackEvent call to gaq', function() {
|
||||
this.regexper._trackEvent('category', 'action');
|
||||
expect(window._gaq.push).toHaveBeenCalledWith(['_trackEvent', 'category', 'action']);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('#showExpression', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
@ -365,7 +352,7 @@ describe('regexper.js', function() {
|
||||
spyOn(Parser.prototype, 'render').and.returnValue(this.renderPromise.promise);
|
||||
spyOn(Parser.prototype, 'cancel');
|
||||
|
||||
spyOn(this.regexper, '_trackEvent');
|
||||
spyOn(window._gaq, 'push');
|
||||
spyOn(this.regexper, 'updateLinks');
|
||||
spyOn(this.regexper, 'displayWarnings');
|
||||
});
|
||||
@ -377,7 +364,7 @@ describe('regexper.js', function() {
|
||||
|
||||
it('tracks the beginning of the render', function() {
|
||||
this.regexper.renderRegexp('example expression');
|
||||
expect(this.regexper._trackEvent).toHaveBeenCalledWith('visualization', 'start');
|
||||
expect(window._gaq.push).toHaveBeenCalledWith(['_trackEvent', 'visualization', 'start']);
|
||||
});
|
||||
|
||||
it('keeps a copy of the running property parser', function() {
|
||||
@ -417,7 +404,7 @@ describe('regexper.js', function() {
|
||||
it('tracks the parse error', function(done) {
|
||||
this.regexper.renderRegexp('example expression')
|
||||
.then(() => {
|
||||
expect(this.regexper._trackEvent).toHaveBeenCalledWith('visualization', 'parse error');
|
||||
expect(window._gaq.push).toHaveBeenCalledWith(['_trackEvent', 'visualization', 'parse error']);
|
||||
}, fail)
|
||||
.finally(done)
|
||||
.done();
|
||||
@ -482,7 +469,7 @@ describe('regexper.js', function() {
|
||||
it('tracks the complete render', function(done) {
|
||||
this.regexper.renderRegexp('example expression')
|
||||
.then(() => {
|
||||
expect(this.regexper._trackEvent).toHaveBeenCalledWith('visualization', 'complete');
|
||||
expect(window._gaq.push).toHaveBeenCalledWith(['_trackEvent', 'visualization', 'complete']);
|
||||
}, fail)
|
||||
.finally(done)
|
||||
.done();
|
||||
@ -519,7 +506,7 @@ describe('regexper.js', function() {
|
||||
it('tracks the cancelled render', function(done) {
|
||||
this.regexper.renderRegexp('example expression')
|
||||
.then(() => {
|
||||
expect(this.regexper._trackEvent).toHaveBeenCalledWith('visualization', 'cancelled');
|
||||
expect(window._gaq.push).toHaveBeenCalledWith(['_trackEvent', 'visualization', 'cancelled']);
|
||||
}, fail)
|
||||
.finally(done)
|
||||
.done();
|
||||
|
@ -72,10 +72,6 @@ export default class Regexper {
|
||||
return decodeURIComponent(location.hash.slice(1));
|
||||
}
|
||||
|
||||
_trackEvent(category, action) {
|
||||
window._gaq.push(['_trackEvent', category, action]);
|
||||
}
|
||||
|
||||
set state(state) {
|
||||
this.root.className = state;
|
||||
}
|
||||
@ -144,7 +140,7 @@ export default class Regexper {
|
||||
}
|
||||
|
||||
this.state = 'is-loading';
|
||||
this._trackEvent('visualization', 'start');
|
||||
window._gaq.push(['_trackEvent', 'visualization', 'start']);
|
||||
|
||||
this.running = new Parser(this.svgContainer);
|
||||
|
||||
@ -161,17 +157,17 @@ export default class Regexper {
|
||||
})
|
||||
.invoke('render')
|
||||
.then(() => {
|
||||
this.state = 'has-results';
|
||||
this.updateLinks();
|
||||
this.displayWarnings(this.running.warnings);
|
||||
this._trackEvent('visualization', 'complete');
|
||||
this.state = 'has-results';
|
||||
this.updateLinks();
|
||||
this.displayWarnings(this.running.warnings);
|
||||
window._gaq.push(['_trackEvent', 'visualization', 'complete']);
|
||||
})
|
||||
.then(null, message => {
|
||||
if (message === 'Render cancelled') {
|
||||
this._trackEvent('visualization', 'cancelled');
|
||||
window._gaq.push(['_trackEvent', 'visualization', 'cancelled']);
|
||||
this.state = '';
|
||||
} else if (parseError) {
|
||||
this._trackEvent('visualization', 'parse error');
|
||||
window._gaq.push(['_trackEvent', 'visualization', 'parse error']);
|
||||
} else {
|
||||
throw message;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user