|
|
|
@ -8,6 +8,12 @@ describe('time filter', function () {
@@ -8,6 +8,12 @@ describe('time filter', function () {
|
|
|
|
|
this.$filter = _$filter_ |
|
|
|
|
})) |
|
|
|
|
|
|
|
|
|
beforeEach(function () { |
|
|
|
|
// https://stackoverflow.com/questions/4676195/why-do-i-need-to-multiply-unix-timestamps-by-1000-in-javascript
|
|
|
|
|
this.miliSecondsToSeconds = 1000 |
|
|
|
|
this.dateFilter = this.$filter('date') |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
describe('on the mobile website', function () { |
|
|
|
|
beforeEach(function () { |
|
|
|
|
Config.Mobile = true |
|
|
|
@ -16,7 +22,7 @@ describe('time filter', function () {
@@ -16,7 +22,7 @@ describe('time filter', function () {
|
|
|
|
|
|
|
|
|
|
it('can create a short time based on timestamp', function () { |
|
|
|
|
var input = 1222 |
|
|
|
|
var expected = '1:20 AM' |
|
|
|
|
var expected = this.dateFilter(input * this.miliSecondsToSeconds, 'shortTime') // For CEST: '1:20 AM'
|
|
|
|
|
var result = this.timeFilter(input) |
|
|
|
|
|
|
|
|
|
expect(result).toBe(expected) |
|
|
|
@ -24,7 +30,7 @@ describe('time filter', function () {
@@ -24,7 +30,7 @@ describe('time filter', function () {
|
|
|
|
|
|
|
|
|
|
it('can recollect a short time based on timestamp', function () { |
|
|
|
|
var input = 121155 |
|
|
|
|
var expected = '10:39 AM' |
|
|
|
|
var expected = this.dateFilter(input * this.miliSecondsToSeconds, 'shortTime') // For CEST: '10:39 AM'
|
|
|
|
|
var result1 = this.timeFilter(input) |
|
|
|
|
|
|
|
|
|
expect(result1).toBe(expected) |
|
|
|
@ -43,7 +49,7 @@ describe('time filter', function () {
@@ -43,7 +49,7 @@ describe('time filter', function () {
|
|
|
|
|
|
|
|
|
|
it('can create a medium-size time based on timestamp', function () { |
|
|
|
|
var input = 1222 |
|
|
|
|
var expected = '1:20:22 AM' |
|
|
|
|
var expected = this.dateFilter(input * this.miliSecondsToSeconds, 'mediumTime') // For CEST: '1:20:22 AM'
|
|
|
|
|
var result = this.timeFilter(input) |
|
|
|
|
|
|
|
|
|
expect(result).toBe(expected) |
|
|
|
@ -51,7 +57,7 @@ describe('time filter', function () {
@@ -51,7 +57,7 @@ describe('time filter', function () {
|
|
|
|
|
|
|
|
|
|
it('can recollect a medium-size time on timestamp', function () { |
|
|
|
|
var input = 121155 |
|
|
|
|
var expected = '10:39:15 AM' |
|
|
|
|
var expected = this.dateFilter(input * this.miliSecondsToSeconds, 'mediumTime') // For CEST: '10:39:15 AM'
|
|
|
|
|
var result1 = this.timeFilter(input) |
|
|
|
|
|
|
|
|
|
expect(result1).toBe(expected) |
|
|
|
|