Test that time format is handled by configuration

pull/1712/head
Hagen Schink 10 years ago
parent 71df35f8ba
commit b2cb4c9549
  1. 6
      karma/tests/controllers/details-tab-overview-controller-test.js
  2. 9
      karma/tests/controllers/work-package-details-controller-test.js
  3. 9
      karma/tests/controllers/work-packages-controller-test.js
  4. 9
      karma/tests/controllers/work-packages-list-controller-test.js
  5. 2
      karma/tests/directives/components/date-time-directive-test.js
  6. 12
      karma/tests/directives/components/toggled-multiselect-directive-test.js
  7. 12
      karma/tests/directives/work_packages/options-dropdown-directive-test.js
  8. 8
      karma/tests/directives/work_packages/work-package-column-directive-test.js
  9. 10
      karma/tests/directives/work_packages/work-package-group-sums-directive-test.js
  10. 12
      karma/tests/directives/work_packages/work-package-relations-directive-test.js
  11. 10
      karma/tests/directives/work_packages/work-package-total-sums-directive-test.js
  12. 15
      karma/tests/helpers/components/work-packages-helper-test.js
  13. 10
      karma/tests/helpers/work-package-context-menu-helper-test.js
  14. 9
      karma/tests/helpers/work-package-table-helper-test.js
  15. 12
      karma/tests/layout/query-menu-item-factory-test.js
  16. 13
      karma/tests/services/query-service-test.js
  17. 8
      karma/tests/services/work-package-service-test.js
  18. 9
      karma/tests/work_packages/column-context-menu-test.js
  19. 9
      karma/tests/work_packages/work-package-context-menu-test.js

@ -241,7 +241,7 @@ describe('DetailsTabOverviewController', function() {
}); });
it('renders the due date and a placeholder for the start date as date property', function() { it('renders the due date and a placeholder for the start date as date property', function() {
expect(fetchPresentPropertiesWithName('date')[0].value).to.equal(placeholder + ' - Jul 10, 2014'); expect(fetchPresentPropertiesWithName('date')[0].value).to.equal(placeholder + ' - 07/10/2014');
}); });
}); });
@ -262,7 +262,7 @@ describe('DetailsTabOverviewController', function() {
}); });
it('renders the start date and a placeholder for the due date as date property', function() { it('renders the start date and a placeholder for the due date as date property', function() {
expect(fetchPresentPropertiesWithName('date')[0].value).to.equal('Jul 9, 2014 - ' + placeholder); expect(fetchPresentPropertiesWithName('date')[0].value).to.equal('07/09/2014 - ' + placeholder);
}); });
}); });
@ -275,7 +275,7 @@ describe('DetailsTabOverviewController', function() {
}); });
it('combines them and renders them as date property', function() { it('combines them and renders them as date property', function() {
expect(fetchPresentPropertiesWithName('date')[0].value).to.equal('Jul 9, 2014 - Jul 10, 2014'); expect(fetchPresentPropertiesWithName('date')[0].value).to.equal('07/09/2014 - 07/10/2014');
}); });
}); });
}); });

@ -87,7 +87,14 @@ describe('WorkPackageDetailsController', function() {
return workPackage; return workPackage;
} }
beforeEach(module('openproject.api', 'openproject.services', 'openproject.workPackages.controllers')); beforeEach(module('openproject.api', 'openproject.services', 'openproject.workPackages.controllers', 'openproject.services'));
beforeEach(module('templates', function($provide) {
configurationService = new Object();
configurationService.isTimezoneSet = sinon.stub().returns(false);
$provide.constant('ConfigurationService', configurationService);
}));
beforeEach(inject(function($rootScope, $controller, $timeout) { beforeEach(inject(function($rootScope, $controller, $timeout) {
var workPackageId = 99; var workPackageId = 99;

@ -31,7 +31,14 @@
describe('WorkPackagesController', function() { describe('WorkPackagesController', function() {
var scope, win, testParams, buildController; var scope, win, testParams, buildController;
beforeEach(module('openproject.workPackages.controllers', 'openproject.api')); beforeEach(module('openproject.workPackages.controllers', 'openproject.api', 'openproject.services'));
beforeEach(module('templates', function($provide) {
configurationService = new Object();
configurationService.isTimezoneSet = sinon.stub().returns(false);
$provide.constant('ConfigurationService', configurationService);
}));
beforeEach(inject(function($rootScope, $controller, $timeout) { beforeEach(inject(function($rootScope, $controller, $timeout) {
scope = $rootScope.$new(); scope = $rootScope.$new();
})); }));

@ -33,7 +33,14 @@ describe('WorkPackagesListController', function() {
testProjectService, testWorkPackageService, testQueryService, testPaginationService; testProjectService, testWorkPackageService, testQueryService, testPaginationService;
var buildController; var buildController;
beforeEach(module('openproject.api', 'openproject.workPackages.controllers', 'openproject.workPackages.services', 'ng-context-menu', 'btford.modal')); beforeEach(module('openproject.api', 'openproject.workPackages.controllers', 'openproject.workPackages.services', 'ng-context-menu', 'btford.modal', 'openproject.services'));
beforeEach(module('templates', function($provide) {
configurationService = new Object();
configurationService.isTimezoneSet = sinon.stub().returns(false);
$provide.constant('ConfigurationService', configurationService);
}));
beforeEach(inject(function($rootScope, $controller, $timeout) { beforeEach(inject(function($rootScope, $controller, $timeout) {
scope = $rootScope.$new(); scope = $rootScope.$new();
win = { win = {

@ -27,7 +27,7 @@
//++ //++
describe('date time Directives', function() { describe('date time Directives', function() {
var I18n, compile, element, scope, timezoneService, configurationService; var I18n, compile, element, scope, configurationService;
var formattedDate = function() { var formattedDate = function() {
var formattedDateElement = element[0]; var formattedDateElement = element[0];

@ -29,8 +29,16 @@
describe('toggledMultiselect Directive', function() { describe('toggledMultiselect Directive', function() {
var compile, element, rootScope, scope; var compile, element, rootScope, scope;
beforeEach(angular.mock.module('openproject.uiComponents', 'openproject.workPackages.helpers')); beforeEach(angular.mock.module('openproject.uiComponents',
beforeEach(module('templates')); 'openproject.workPackages.helpers',
'openproject.services'));
beforeEach(module('templates', function($provide) {
configurationService = new Object();
configurationService.isTimezoneSet = sinon.stub().returns(false);
$provide.constant('ConfigurationService', configurationService);
}));
beforeEach(inject(function($rootScope, $compile) { beforeEach(inject(function($rootScope, $compile) {
var html; var html;

@ -30,7 +30,17 @@ describe('optionsDropdown Directive', function() {
var compile, element, rootScope, scope; var compile, element, rootScope, scope;
beforeEach(angular.mock.module('openproject.workPackages.directives')); beforeEach(angular.mock.module('openproject.workPackages.directives'));
beforeEach(module('openproject.models', 'openproject.workPackages.controllers', 'openproject.api')); beforeEach(module('openproject.models',
'openproject.workPackages.controllers',
'openproject.api',
'openproject.services'));
beforeEach(module('templates', function($provide) {
configurationService = new Object();
configurationService.isTimezoneSet = sinon.stub().returns(false);
$provide.constant('ConfigurationService', configurationService);
}));
beforeEach(module('templates', function($provide) { beforeEach(module('templates', function($provide) {
var state = { go: function() { return false; } }; var state = { go: function() { return false; } };

@ -30,8 +30,14 @@ describe('workPackageColumn Directive', function() {
var compile, element, rootScope, scope; var compile, element, rootScope, scope;
beforeEach(angular.mock.module('openproject.workPackages.directives')); beforeEach(angular.mock.module('openproject.workPackages.directives'));
beforeEach(module('templates', 'openproject.api')); beforeEach(module('templates', 'openproject.api', 'openproject.services'));
beforeEach(module('templates', function($provide) {
configurationService = new Object();
configurationService.isTimezoneSet = sinon.stub().returns(false);
$provide.constant('ConfigurationService', configurationService);
}));
beforeEach(inject(function($rootScope, $compile) { beforeEach(inject(function($rootScope, $compile) {
var html; var html;
html = '<span work-package-column work-package="workPackage" column="column" display-type="displayType" display-empty="-"></span>'; html = '<span work-package-column work-package="workPackage" column="column" display-type="displayType" display-empty="-"></span>';

@ -29,8 +29,14 @@
describe('workPackageGroupSums Directive', function() { describe('workPackageGroupSums Directive', function() {
var compile, element, rootScope, scope; var compile, element, rootScope, scope;
beforeEach(angular.mock.module('openproject.workPackages.directives')); beforeEach(angular.mock.module('openproject.workPackages.directives', 'openproject.services'));
beforeEach(module('openproject.api', 'templates')); beforeEach(module('openproject.api', 'templates', function($provide) {
configurationService = new Object();
configurationService.isTimezoneSet = sinon.stub().returns(false);
$provide.constant('ConfigurationService', configurationService);
}));
beforeEach(inject(function($rootScope, $compile) { beforeEach(inject(function($rootScope, $compile) {
var html; var html;

@ -29,8 +29,18 @@
describe('Work Package Relations Directive', function() { describe('Work Package Relations Directive', function() {
var I18n, PathHelper, compile, element, scope; var I18n, PathHelper, compile, element, scope;
beforeEach(angular.mock.module('openproject.workPackages.tabs', 'openproject.api', 'openproject.helpers', 'ngSanitize')); beforeEach(angular.mock.module('openproject.workPackages.tabs',
'openproject.api',
'openproject.helpers',
'openproject.services',
'ngSanitize'));
beforeEach(module('templates', function($provide) { beforeEach(module('templates', function($provide) {
configurationService = new Object();
configurationService.isTimezoneSet = sinon.stub().returns(false);
$provide.constant('ConfigurationService', configurationService);
})); }));
beforeEach(inject(function($rootScope, $compile, _I18n_, _PathHelper_, _WorkPackagesHelper_) { beforeEach(inject(function($rootScope, $compile, _I18n_, _PathHelper_, _WorkPackagesHelper_) {

@ -29,8 +29,14 @@
describe('workPackageTotalSums Directive', function() { describe('workPackageTotalSums Directive', function() {
var compile, element, rootScope, scope; var compile, element, rootScope, scope;
beforeEach(angular.mock.module('openproject.workPackages.directives')); beforeEach(angular.mock.module('openproject.workPackages.directives', 'openproject.services'));
beforeEach(module('openproject.api', 'templates')); beforeEach(module('openproject.api', 'templates', function($provide) {
configurationService = new Object();
configurationService.isTimezoneSet = sinon.stub().returns(false);
$provide.constant('ConfigurationService', configurationService);
}));
beforeEach(inject(function($rootScope, $compile) { beforeEach(inject(function($rootScope, $compile) {
var html; var html;

@ -31,7 +31,16 @@
describe('Work packages helper', function() { describe('Work packages helper', function() {
var WorkPackagesHelper; var WorkPackagesHelper;
beforeEach(module('openproject.helpers')); beforeEach(module('openproject.helpers', 'openproject.services'));
beforeEach(module('templates', function($provide) {
configurationService = new Object();
configurationService.isTimezoneSet = sinon.stub().returns(false);
configurationService.dateFormatPresent = sinon.stub().returns(false);
configurationService.timeFormatPresent = sinon.stub().returns(false);
$provide.constant('ConfigurationService', configurationService);
}));
beforeEach(inject(function(_WorkPackagesHelper_) { beforeEach(inject(function(_WorkPackagesHelper_) {
WorkPackagesHelper = _WorkPackagesHelper_; WorkPackagesHelper = _WorkPackagesHelper_;
})); }));
@ -129,8 +138,8 @@ describe('Work packages helper', function() {
}); });
it('should display parsed dates and datetimes', function(){ it('should display parsed dates and datetimes', function(){
expect(formatValue("01/01/2014", 'date')).to.equal("Jan 1, 2014"); expect(formatValue("01/01/2014", 'date')).to.equal("12/31/2013");
expect(formatValue("01/01/2014 08:19 AM", 'datetime')).to.equal("Jan 1, 2014 12:00:00 AM"); expect(formatValue("01/01/2014 08:19 AM", 'datetime')).to.equal("01/01/2014 7:19 AM");
}) })
}); });

@ -31,7 +31,15 @@
describe('WorkPackageContextMenuHelper', function() { describe('WorkPackageContextMenuHelper', function() {
var WorkPackageContextMenuHelper; var WorkPackageContextMenuHelper;
beforeEach(module('openproject.workPackages.helpers', 'openproject.models', 'openproject.api')); beforeEach(module('openproject.workPackages.helpers', 'openproject.models', 'openproject.api', 'openproject.services'));
beforeEach(module('templates', function($provide) {
configurationService = new Object();
configurationService.isTimezoneSet = sinon.stub().returns(false);
$provide.constant('ConfigurationService', configurationService);
}));
beforeEach(inject(function(_WorkPackageContextMenuHelper_) { beforeEach(inject(function(_WorkPackageContextMenuHelper_) {
WorkPackageContextMenuHelper = _WorkPackageContextMenuHelper_; WorkPackageContextMenuHelper = _WorkPackageContextMenuHelper_;

@ -31,7 +31,14 @@
describe('WorkPackagesTableHelper', function() { describe('WorkPackagesTableHelper', function() {
var WorkPackagesTableHelper; var WorkPackagesTableHelper;
beforeEach(module('openproject.workPackages.helpers')); beforeEach(module('openproject.workPackages.helpers', 'openproject.services'));
beforeEach(module('templates', function($provide) {
configurationService = new Object();
configurationService.isTimezoneSet = sinon.stub().returns(false);
$provide.constant('ConfigurationService', configurationService);
}));
beforeEach(inject(function(_WorkPackagesTableHelper_) { beforeEach(inject(function(_WorkPackagesTableHelper_) {
WorkPackagesTableHelper = _WorkPackagesTableHelper_; WorkPackagesTableHelper = _WorkPackagesTableHelper_;
})); }));

@ -33,7 +33,17 @@ describe('queryMenuItemFactory', function() {
queryMenuItemFactory, stateParams = {}; queryMenuItemFactory, stateParams = {};
beforeEach(angular.mock.module('openproject.layout')); beforeEach(angular.mock.module('openproject.layout'));
beforeEach(module('templates', 'openproject.services', 'openproject.models', 'openproject.api')); beforeEach(module('templates',
'openproject.services',
'openproject.models',
'openproject.api',
function($provide) {
configurationService = new Object();
configurationService.isTimezoneSet = sinon.stub().returns(false);
$provide.constant('ConfigurationService', configurationService);
}));
beforeEach(module('templates', function($provide) { beforeEach(module('templates', function($provide) {
$provide.value('$stateParams', stateParams); $provide.value('$stateParams', stateParams);

@ -32,7 +32,18 @@ describe('QueryService', function() {
var QueryService, query, queryData; var QueryService, query, queryData;
beforeEach(module('openproject.services', 'openproject.models', 'openproject.api')); beforeEach(module('openproject.services',
'openproject.models',
'openproject.api',
'openproject.services'));
beforeEach(module('templates', function($provide) {
configurationService = new Object();
configurationService.isTimezoneSet = sinon.stub().returns(false);
$provide.constant('ConfigurationService', configurationService);
}));
beforeEach(inject(function(_QueryService_){ beforeEach(inject(function(_QueryService_){
QueryService = _QueryService_; QueryService = _QueryService_;

@ -33,6 +33,14 @@ describe('WorkPackageService', function() {
var WorkPackageService; var WorkPackageService;
beforeEach(module('openproject.api','openproject.services', 'openproject.models')); beforeEach(module('openproject.api','openproject.services', 'openproject.models'));
beforeEach(module('templates', function($provide) {
configurationService = new Object();
configurationService.isTimezoneSet = sinon.stub().returns(false);
$provide.constant('ConfigurationService', configurationService);
}));
beforeEach(inject(function(_WorkPackageService_, _HALAPIResource_){ beforeEach(inject(function(_WorkPackageService_, _HALAPIResource_){
WorkPackageService = _WorkPackageService_; WorkPackageService = _WorkPackageService_;
})); }));

@ -36,8 +36,17 @@ describe('columnContextMenu', function() {
'openproject.workPackages.controllers', 'openproject.workPackages.controllers',
'openproject.models', 'openproject.models',
'openproject.api', 'openproject.api',
'openproject.services',
'templates')); 'templates'));
beforeEach(module('templates', function($provide) {
configurationService = new Object();
configurationService.isTimezoneSet = sinon.stub().returns(false);
$provide.constant('ConfigurationService', configurationService);
}));
beforeEach(function() { beforeEach(function() {
var html = '<div></div>'; var html = '<div></div>';
container = angular.element(html); container = angular.element(html);

@ -36,8 +36,17 @@ describe('workPackageContextMenu', function() {
'openproject.api', 'openproject.api',
'openproject.workPackages', 'openproject.workPackages',
'openproject.models', 'openproject.models',
'openproject.services',
'templates')); 'templates'));
beforeEach(module('templates', function($provide) {
configurationService = new Object();
configurationService.isTimezoneSet = sinon.stub().returns(false);
$provide.constant('ConfigurationService', configurationService);
}));
beforeEach(function() { beforeEach(function() {
var html = '<div></div>'; var html = '<div></div>';
container = angular.element(html); container = angular.element(html);

Loading…
Cancel
Save