1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-07 22:46:13 +01:00
fab-manager/vendor/assets/components/angular-google-analytics/test/unit/debug-mode.js
Sylvain 139d7d9f0f [bug] Google Analytics not loaded
- angular-google-analytics plugin update from 0.0.15 to 1.1.7
- google analytics config moved into secrets.yml/production
2016-05-24 14:53:07 +02:00

90 lines
2.7 KiB
JavaScript

/* global afterEach, before, beforeEach, describe, document, expect, inject, it, module, spyOn */
'use strict';
describe('universal analytics debug mode', function () {
beforeEach(module('angular-google-analytics'));
beforeEach(module(function (AnalyticsProvider) {
AnalyticsProvider
.setAccount('UA-XXXXXX-xx')
.useAnalytics(true)
.logAllCalls(true)
.enterTestMode();
}));
afterEach(inject(function (Analytics) {
Analytics.log.length = 0; // clear log
}));
it('should have debug mode disabled by default', function () {
inject(function (Analytics) {
expect(Analytics.configuration.debugMode).toBe(false);
});
});
it('should have trace debugging mode disabled by default', function () {
inject(function (Analytics) {
expect(Analytics.configuration.traceDebuggingMode).toBe(false);
});
});
describe('without trace debugging mode', function () {
beforeEach(module(function (AnalyticsProvider) {
AnalyticsProvider.enterDebugMode();
}));
it('should have debug mode enabled', function () {
inject(function (Analytics) {
expect(Analytics.configuration.debugMode).toBe(true);
});
});
it('should have trace debugging disabled', function () {
inject(function (Analytics) {
expect(Analytics.configuration.traceDebuggingMode).toBe(false);
});
});
it('should inject the analytics debug script', function () {
inject(function (Analytics) {
expect(Analytics.log[0]).toEqual(['inject', '//www.google-analytics.com/analytics_debug.js']);
});
});
it('should not set the analytics trace debugging variable', function () {
inject(function (Analytics, $window) {
expect($window.ga_debug).toEqual(undefined);
});
});
});
describe('with trace debugging mode', function () {
beforeEach(module(function (AnalyticsProvider) {
AnalyticsProvider.enterDebugMode(true);
}));
it('should have debug mode enabled', function () {
inject(function (Analytics) {
expect(Analytics.configuration.debugMode).toBe(true);
});
});
it('should have trace debugging enabled', function () {
inject(function (Analytics) {
expect(Analytics.configuration.traceDebuggingMode).toBe(true);
});
});
it('should inject the analytics debug script', function () {
inject(function (Analytics) {
expect(Analytics.log[0]).toEqual(['inject', '//www.google-analytics.com/analytics_debug.js']);
});
});
it('should set the analytics trace debugging variable', function () {
inject(function (Analytics, $window) {
expect($window.ga_debug).toEqual({ trace: true });
});
});
});
});