1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- /*
- * Copyright 2018 Scytl Secure Electronic Voting SA
- *
- * All rights reserved
- *
- * See our extended copyright notice in *file 'Copyright.txt' which is part of this source code package
- */
- describe('voting-cards.js', function() {
- 'use strict';
- beforeEach(module('endpoints'));
- beforeEach(module('gettext'));
- beforeEach(module('voting-cards'));
- describe('filters', function() {
- function seconds(time) {
- return time * 1000;
- }
- function minutes(time) {
- return seconds(time) * 60;
- }
- function hours(time) {
- return minutes(time) * 60;
- }
- it('Should show elapsed time formatted', inject(function($filter) {
- var elapsed = $filter('elapsed');
- var time = seconds(0);
- expect(elapsed(time)).toBe('0 seconds');
- time = seconds(1);
- expect(elapsed(time)).toBe('1 seconds');
- time = seconds(59);
- expect(elapsed(time)).toBe('59 seconds');
- time = seconds(60);
- expect(elapsed(time)).toBe('1 minute');
- time = seconds(61);
- expect(elapsed(time)).toBe('1 minute 1 seconds');
- time = minutes(59);
- expect(elapsed(time)).toBe('59 minutes 0 seconds');
- time = minutes(60);
- expect(elapsed(time)).toBe('1 hour 0 minutes');
- time = minutes(61);
- expect(elapsed(time)).toBe('1 hour 1 minutes');
- time = hours(2);
- expect(elapsed(time)).toBe('2 hours 0 minutes');
- }));
- });
- });
|