Commit de9e385d authored by anthony's avatar anthony

Merge branch 'master' into dev

parents 9dd48c05 0269e620
......@@ -135,9 +135,13 @@
};
vm.reinitCases = function () {
delete $scope.searchOptions.searchSort;
$scope.pagination.currentPage = 1;
vm.searchForCases();
if ($scope.searchOptions.searchSort) {
delete $scope.searchOptions.searchSort;
//that's it because searchForCases() is called by the watch on searchOptions
} else {
vm.searchForCases();
}
};
$scope.$on('caselist:http-error', handleHttpErrorEvent);
......
......@@ -134,9 +134,13 @@
};
vm.reinitCases = function () {
delete $scope.searchOptions.searchSort;
$scope.pagination.currentPage = 1;
vm.searchForCases();
if ($scope.searchOptions.searchSort) {
delete $scope.searchOptions.searchSort;
//that's it because searchForCases() is called by the watch on searchOptions
} else {
vm.searchForCases();
}
};
$scope.$on('caselist:http-error', handleHttpErrorEvent);
......
......@@ -240,6 +240,7 @@
//global
when('GET', /^\/API\/bpm\/process\?c=\d+&.*p=0$/).respond(require('./admin/cases/list/process-def-4.json'));
when('GET', /^\/API\/bpm\/process\?c=\d+&.*p=0&.*s=.*$/).respond(require('./admin/cases/list/process-def-4.json'));
when('GET', /^\/API\/system\/i18ntranslation.*$/).respond([]);
//enable french translation
//when('GET', /^\/API\/system\/i18ntranslation.*$/).respond(require('./i18translations.json'));
......@@ -249,5 +250,4 @@
var form = fs.readFileSync(__dirname + '/user/tasks/list/fixtures/form.html', 'utf8');
when('GET', formRegexp, 'html').respond(form);
})(module, false);
......@@ -992,6 +992,19 @@
});
scope.searchOptions.searchSort = {};
scope.pagination.currentPage = 10;
casesCtrl.reinitCases();
expect(scope.searchOptions.searchSort).toBeUndefined();
expect(scope.pagination.currentPage).toBe(1);
}));
it('should perform search', inject(function($controller) {
casesCtrl = $controller('ActiveCaseListCtrl', {
'$scope': scope,
'processId': undefined,
'supervisorId': undefined,
'caseStateFilter': ''
});
delete scope.searchOptions.searchSort;
scope.pagination.currentPage = 10;
spyOn(casesCtrl, 'searchForCases');
casesCtrl.reinitCases();
expect(scope.searchOptions.searchSort).toBeUndefined();
......
......@@ -874,6 +874,19 @@
});
scope.searchOptions.searchSort = {};
scope.pagination.currentPage = 10;
casesCtrl.reinitCases();
expect(scope.searchOptions.searchSort).toBeUndefined();
expect(scope.pagination.currentPage).toBe(1);
}));
it('should perform search', inject(function($controller) {
casesCtrl = $controller('ActiveCaseListUserCtrl', {
'$scope': scope,
'processId': undefined,
'supervisorId': undefined,
'caseStateFilter': ''
});
delete scope.searchOptions.searchSort;
scope.pagination.currentPage = 10;
spyOn(casesCtrl, 'searchForCases');
casesCtrl.reinitCases();
expect(scope.searchOptions.searchSort).toBeUndefined();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment