'use strict';

describe('Filter: timeFormatters', function() {

  beforeEach(
    window.module('spinnaker.core.utils.timeFormatters')
  );

  describe('timePickerTime', function() {

    var filter;

    describe('timePicker', function () {
      beforeEach(
        window.inject(
          function($filter) {
            filter = $filter('timePickerTime');
          }
        )
      );
      it('returns nothing when invalid values are provided', function() {
        expect(filter()).toBe('-');
        expect(filter({})).toBe('-');
        expect(filter({invalidField: 2})).toBe('-');
        expect(filter({h: 2})).toBe('-');
        expect(filter({h: 2, m: 1})).toBe('-');
        expect(filter({hours: 2, m: 1})).toBe('-');
        expect(filter({h: 2, minutes: 1})).toBe('-');
        expect(filter({hours: 'pasta', minutes: 1})).toBe('-');
        expect(filter({hours: 11, minutes: 'copy'})).toBe('-');
      });

      it('handles string inputs', function() {
        expect(filter({hours: '10', minutes: '30'})).toBe('10:30');
        expect(filter({hours: '10', minutes: 30})).toBe('10:30');
        expect(filter({hours: 10, minutes: '30'})).toBe('10:30');
      });

      it('prefixes hours, minutes with zeros if necessary', function() {
        expect(filter({hours: 1, minutes: 30})).toBe('01:30');
        expect(filter({hours: 10, minutes: 5})).toBe('10:05');

      });
    });

    describe('timestamp', function () {
      beforeEach(
        window.inject(
          function($filter) {
            filter = $filter('timestamp');
          }
        )
      );
      it('returns nothing when invalid values are provided', function() {
        expect(filter()).toBe('-');
        expect(filter(null)).toBe('-');
      });
      it('returns formatted date when valid value is provided', function () {
        // this will probably break when daylight savings ends, let's find out!
        expect(filter(1445707299020)).toBe('2015-10-24 10:21:39 PDT');
      });
    });
  });

});

@@ -294,32 +294,42 @@
 function($filter
+, settings
 ) %7B%0A            
@@ -360,24 +360,76 @@
 ckerTime');%0A
+            settings.defaultTimeZone = 'Etc/GMT+0';%0A
           %7D%0A
@@ -1887,88 +1887,8 @@
 ) %7B%0A
-        // this will probably break when daylight savings ends, let's find out!%0A
     
@@ -1943,18 +1943,18 @@
 24 1
-0
+7
 :21:39 
-PD
+GM
 T');

use GMT for timeFormatter spec