Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordizzy <diosmosis@users.noreply.github.com>2021-10-15 09:08:14 +0300
committerGitHub <noreply@github.com>2021-10-15 09:08:14 +0300
commit2f80606b1db3caaeb4195ff7cd0bf949b2154968 (patch)
tree3ebe7333835309b135395a3b31496f9bee93c9ed /plugins/CoreHome/angularjs
parent71c98f36ec238b6d688065963f196c387850da53 (diff)
[Vue] utility function for creating angularjs adapters (#18146)4.6.0-b1
* incomplete conversion * get ajax helper migration to work * delete old periods.spec.js * remove global-ajax-queue.js file * migrate piwik service and test (w/ hacks to get it the test to work) * rebuild and remove old files + get tests to pass * unfinished commit * return jqxhr object so promise api can be used * move hasBlockedContent and deprecate piwikApi service * remove alert files * convert piwikHelper.spec.js * in new vue code, use "Matomo" everywhere possible instead of "piwik" and rebuild vue files * add another needed export line in command * include polyfills after vue so we can add to vue engine * Add HTML sanitizer for use w/ migrating ng-bind-html uses. * fix broken merge, rebuild js, fix issue in build command * add sanitize to other components for consistency (will be replaced by utility function eventually) * migrate matomo-dialog, fix issue where vue:build --watch did not correctly watch all plugin files, fix path issue in webpack externals, add vue matomo dialog use example to ExampleVue * update expected screenshot * create initial createAngularJsAdapter generic function and use for AcitivityIndicator * fix webpack chunk loading issue that occurs only on production (since the chunk is not stored in the same directory as the merged asset JS) * use adapter utility for Alert * use adapter function for matomo-dialog (even though the mapping becomes more complex) * fix unit tests
Diffstat (limited to 'plugins/CoreHome/angularjs')
-rw-r--r--plugins/CoreHome/angularjs/common/directives/dialog.js62
-rw-r--r--plugins/CoreHome/angularjs/comparisons/comparisons.service.js5
-rw-r--r--plugins/CoreHome/angularjs/comparisons/comparisons.service.spec.js80
3 files changed, 50 insertions, 97 deletions
diff --git a/plugins/CoreHome/angularjs/common/directives/dialog.js b/plugins/CoreHome/angularjs/common/directives/dialog.js
deleted file mode 100644
index 62f9bbd8b5..0000000000
--- a/plugins/CoreHome/angularjs/common/directives/dialog.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/*!
- * Matomo - free/libre analytics platform
- *
- * @link https://matomo.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
- */
-
-/**
- * Usage:
- * <div piwik-dialog="showDialog">...</div>
- * Will show dialog once showDialog evaluates to true.
- *
- * <div piwik-dialog="showDialog" yes="executeMyFunction();">
- * ... <input type="button" role="yes" value="button">
- * </div>
- * Will execute the "executeMyFunction" function in the current scope once the yes button is pressed.
- */
-(function () {
- angular.module('piwikApp.directive').directive('piwikDialog', piwikDialog);
-
- piwikDialog.$inject = ['piwik', '$parse'];
-
- function piwikDialog(piwik, $parse) {
-
- return {
- restrict: 'A',
- link: function(scope, element, attrs) {
-
- element.css('display', 'none');
-
- scope.$watch(attrs.piwikDialog, function(newValue, oldValue) {
- if (newValue) {
- piwik.helper.modalConfirm(element, {yes: function() {
- if (attrs.yes) {
- scope.$eval(attrs.yes);
- setTimeout(function () { scope.$apply(); }, 0);
- }
- }, no: function() {
- if (attrs.no) {
- scope.$eval(attrs.no);
- setTimeout(function () { scope.$apply(); }, 0);
- }
- }
- }, {
- onCloseEnd: function () {
- setTimeout(function () {
- scope.$apply($parse(attrs.piwikDialog).assign(scope, false));
- }, 0);
- }
- });
- } else if (newValue === false && oldValue === true) {
- // The user closed the dialog, e.g. by pressing Esc or clicking away from it
- if (attrs.close) {
- scope.$eval(attrs.close);
- setTimeout(function () { scope.$apply(); }, 0);
- }
- }
- });
- }
- };
- }
-})(); \ No newline at end of file
diff --git a/plugins/CoreHome/angularjs/comparisons/comparisons.service.js b/plugins/CoreHome/angularjs/comparisons/comparisons.service.js
index 7672397601..1ca05570e1 100644
--- a/plugins/CoreHome/angularjs/comparisons/comparisons.service.js
+++ b/plugins/CoreHome/angularjs/comparisons/comparisons.service.js
@@ -220,8 +220,9 @@
});
// angular is not rendering the page (ie, we are in the embedded dashboard) or we need to change the segment
- var url = $.param($.extend({}, extraParams));
- var strHash = $.param($.extend({}, compareParams));
+ var url = $.param($.extend({}, extraParams)).replace(/%5B%5D/g, '[]');
+ var strHash = $.param($.extend({}, compareParams)).replace(/%5B%5D/g, '[]');
+
broadcast.propagateNewPage(url, undefined, strHash, paramsToRemove);
}
diff --git a/plugins/CoreHome/angularjs/comparisons/comparisons.service.spec.js b/plugins/CoreHome/angularjs/comparisons/comparisons.service.spec.js
index 181d7dab4b..76cd614f4b 100644
--- a/plugins/CoreHome/angularjs/comparisons/comparisons.service.spec.js
+++ b/plugins/CoreHome/angularjs/comparisons/comparisons.service.spec.js
@@ -18,6 +18,16 @@
var $location;
var oldInjectorFn;
var $window;
+ var oldWindowHash;
+
+ function setHash(search) {
+ $location.search(search);
+ window.location.hash = '#?' + search;
+ }
+
+ beforeEach(function () {
+ oldWindowHash = window.location.hash;
+ });
beforeEach(module('piwikApp.service'));
beforeEach(module(function($provide) {
@@ -86,9 +96,13 @@
$httpBackend.verifyNoOutstandingRequest ();
});
+ afterEach(function () {
+ window.location.hash = oldWindowHash;
+ });
+
describe('#getComparisons()', function () {
it('should return all comparisons in URL', function () {
- $location.search('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
+ setHash('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
$rootScope.$apply();
expect(piwikComparisonsService.getComparisons()).to.deep.equal([
@@ -133,7 +147,7 @@
});
it('should return base params if there are no comparisons', function () {
- $location.search('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg');
+ setHash('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg');
$rootScope.$apply();
expect(piwikComparisonsService.getComparisons()).to.deep.equal([
@@ -156,7 +170,7 @@
});
it('should return nothing if comparison is not enabled for the page', function () {
- $location.search('category=MyModule1&subcategory=disabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
+ setHash('category=MyModule1&subcategory=disabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
$rootScope.$apply();
expect(piwikComparisonsService.getComparisons()).to.deep.equal([]);
@@ -165,27 +179,27 @@
describe('#removeSegmentComparison()', function () {
it('should remove an existing segment comparison from the URL', function () {
- $location.search('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
+ setHash('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
$rootScope.$apply();
piwikComparisonsService.removeSegmentComparison(1);
- expect($location.url()).to.equal('?category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates%5B%5D=2018-03-04&comparePeriods%5B%5D=week&compareSegments%5B%5D=comparedsegment&compareSegments%5B%5D=&updated=1#%3Fdate=2012-01-01,2012-01-02&period=range&comparePeriods%255B%255D=week&compareDates%255B%255D=2018-03-04');
+ expect($location.url()).to.equal('?category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates%5B%5D=2018-03-04&comparePeriods%5B%5D=week&compareSegments%5B%5D=comparedsegment&compareSegments%5B%5D=&updated=1#%3Fcategory=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates%5B%5D=2018-03-04&comparePeriods%5B%5D=week&compareSegments%5B%5D=comparedsegment&compareSegments%5B%5D=');
});
it('should change the base comparison if the first segment is removed', function () {
- $location.search('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
+ setHash('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
$rootScope.$apply();
piwikComparisonsService.removeSegmentComparison(0);
- expect($location.url()).to.equal('?category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=comparedsegment&compareDates%5B%5D=2018-03-04&comparePeriods%5B%5D=week&compareSegments%5B%5D=comparedsegment&compareSegments%5B%5D=&updated=1#%3Fdate=2012-01-01,2012-01-02&period=range&segment=comparedsegment&comparePeriods%255B%255D=week&compareDates%255B%255D=2018-03-04');
+ expect($location.url()).to.equal('?category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=comparedsegment&compareDates%5B%5D=2018-03-04&comparePeriods%5B%5D=week&compareSegments%5B%5D=comparedsegment&compareSegments%5B%5D=&updated=1#%3Fcategory=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=comparedsegment&compareDates%5B%5D=2018-03-04&comparePeriods%5B%5D=week&compareSegments%5B%5D=comparedsegment&compareSegments%5B%5D=');
});
});
describe('#addSegmentComparison()', function () {
it('should add a new segment comparison to the URL', function () {
- $location.search('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment');
+ setHash('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment');
$rootScope.$apply();
piwikComparisonsService.addSegmentComparison({
@@ -201,7 +215,7 @@
});
it('should add the all visits segment to the URL', function () {
- $location.search('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment');
+ setHash('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment');
$rootScope.$apply();
piwikComparisonsService.addSegmentComparison({
@@ -217,7 +231,7 @@
});
it('should add a new period comparison to the URL', function () {
- $location.search('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=&compareSegments[]=comparedsegment');
+ setHash('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=&compareSegments[]=comparedsegment');
$rootScope.$apply();
piwikComparisonsService.addSegmentComparison({
@@ -233,7 +247,7 @@
});
it('should add another period comparison to the URL if one is already there', function () {
- $location.search('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment');
+ setHash('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment');
$rootScope.$apply();
piwikComparisonsService.addSegmentComparison({
@@ -252,21 +266,21 @@
describe('#isComparisonEnabled()', function () {
it('should return true if comparison is enabled for the page', function () {
- $location.search('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment');
+ setHash('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment');
$rootScope.$apply();
expect(piwikComparisonsService.isComparisonEnabled()).to.be.true;
});
it('should return false if comparison is disabled for the page', function () {
- $location.search('category=MyModule2&subcategory=disabledPage2&date=2018-01-02&period=day&segment=&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment');
+ setHash('category=MyModule2&subcategory=disabledPage2&date=2018-01-02&period=day&segment=&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment');
$rootScope.$apply();
expect(piwikComparisonsService.isComparisonEnabled()).to.be.false;
});
it('should return false if comparison is disabled for the entire category', function () {
- $location.search('category=MyModule3&subcategory=enabledPage&date=2018-01-02&period=day&segment=&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment');
+ setHash('category=MyModule3&subcategory=enabledPage&date=2018-01-02&period=day&segment=&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment');
$rootScope.$apply();
expect(piwikComparisonsService.isComparisonEnabled()).to.be.false;
@@ -275,7 +289,7 @@
describe('#getSegmentComparisons()', function () {
it('should return the segment comparisons only', function () {
- $location.search('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
+ setHash('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
$rootScope.$apply();
expect(piwikComparisonsService.getSegmentComparisons()).to.be.deep.equal([
@@ -286,7 +300,7 @@
});
it('should return nothing if comparison is not enabled', function () {
- $location.search('category=MyModule1&subcategory=disabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
+ setHash('category=MyModule1&subcategory=disabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
$rootScope.$apply();
expect(piwikComparisonsService.getSegmentComparisons()).to.be.deep.equal([]);
@@ -295,7 +309,7 @@
describe('#getPeriodComparisons()', function () {
it('should return the period comparisons only', function () {
- $location.search('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
+ setHash('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
$rootScope.$apply();
expect(piwikComparisonsService.getPeriodComparisons()).to.be.deep.equal([
@@ -319,7 +333,7 @@
});
it('should return nothing if comparison is not enabled', function () {
- $location.search('category=MyModule1&subcategory=disabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
+ setHash('category=MyModule1&subcategory=disabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
$rootScope.$apply();
expect(piwikComparisonsService.getPeriodComparisons()).to.be.deep.equal([]);
@@ -328,7 +342,7 @@
describe('#getAllComparisonSeries()', function () {
it('should return all individual comparison serieses', function () {
- $location.search('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
+ setHash('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
$rootScope.$apply();
expect(piwikComparisonsService.getAllComparisonSeries()).to.be.deep.equal([
@@ -390,7 +404,7 @@
});
it('should return nothing if comparison is not enabled', function () {
- $location.search('category=MyModule1&subcategory=disabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
+ setHash('category=MyModule1&subcategory=disabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
$rootScope.$apply();
expect(piwikComparisonsService.getAllComparisonSeries()).to.be.deep.equal([]);
@@ -399,40 +413,40 @@
describe('#isComparing()', function () {
it('should return true if there are comparison parameters present', function () {
- $location.search('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
+ setHash('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
$rootScope.$apply();
expect(piwikComparisonsService.isComparing()).to.be.true;
});
it('should return true if there are segment comparisons but no period comparisons', function () {
- $location.search('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareSegments[]=comparedsegment&compareSegments[]=');
+ setHash('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareSegments[]=comparedsegment&compareSegments[]=');
$rootScope.$apply();
expect(piwikComparisonsService.isComparing()).to.be.true;
});
it('should return true if there are period comparisons but no segment comparisons', function () {
- $location.search('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week');
+ setHash('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week');
$rootScope.$apply();
expect(piwikComparisonsService.isComparing()).to.be.true;
});
it('should return false if there are no comparison parameters present', function () {
- $location.search('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg');
+ setHash('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg');
$rootScope.$apply();
expect(piwikComparisonsService.isComparing()).to.be.false;
- $location.search('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day');
+ setHash('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day');
$rootScope.$apply();
expect(piwikComparisonsService.isComparing()).to.be.false;
});
it('should return false if comparison is not enabled', function () {
- $location.search('category=MyModule1&subcategory=disabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
+ setHash('category=MyModule1&subcategory=disabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
$rootScope.$apply();
expect(piwikComparisonsService.isComparing()).to.be.false;
@@ -441,28 +455,28 @@
describe('#isComparingPeriods()', function () {
it('should return true if there are periods being compared', function () {
- $location.search('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
+ setHash('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
$rootScope.$apply();
expect(piwikComparisonsService.isComparingPeriods()).to.be.true;
});
it('should return false if there are no periods being compared, just segments', function () {
- $location.search('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareSegments[]=comparedsegment&compareSegments[]=');
+ setHash('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareSegments[]=comparedsegment&compareSegments[]=');
$rootScope.$apply();
expect(piwikComparisonsService.isComparingPeriods()).to.be.false;
});
it('should return false if there is nothing being compared', function () {
- $location.search('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg');
+ setHash('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg');
$rootScope.$apply();
expect(piwikComparisonsService.isComparingPeriods()).to.be.false;
});
it('should return false if comparing is not enabled', function () {
- $location.search('category=MyModule1&subcategory=disabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
+ setHash('category=MyModule1&subcategory=disabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
$rootScope.$apply();
expect(piwikComparisonsService.isComparingPeriods()).to.be.false;
@@ -471,7 +485,7 @@
describe('#getIndividualComparisonRowIndices()', function () {
it('should calculate the segment/period index from the given series index', function () {
- $location.search('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
+ setHash('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
$rootScope.$apply();
expect(piwikComparisonsService.getIndividualComparisonRowIndices(3)).to.be.deep.equal({
@@ -488,7 +502,7 @@
describe('#getComparisonSeriesIndex()', function () {
it('should return the comparison series index from the given segment & period indices', function () {
- $location.search('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
+ setHash('category=MyModule1&subcategory=enabledPage&date=2018-01-02&period=day&segment=abcdefg&compareDates[]=2018-03-04&comparePeriods[]=week&compareSegments[]=comparedsegment&compareSegments[]=');
$rootScope.$apply();
expect(piwikComparisonsService.getComparisonSeriesIndex(1, 1)).to.be.deep.equal(4);
@@ -497,4 +511,4 @@
});
});
});
-})(); \ No newline at end of file
+})();