describe('ZendeskWidgetProvider', function() {
  'use strict';

  var subject, mockService, $window;

  beforeEach(module('zendeskWidget'));
  beforeEach(inject(function(_$window_, _ZendeskWidget_) {
    subject    = _ZendeskWidget_;
    $window    = _$window_;
  }));

  describe('a set of API methods', function() {
    beforeEach(function() {
      var apiMethods = ['setLocale', 'identify', 'hide', 'show', 'activate'];
      // Stub out $window.zE() wrapper and all apiMethods
      mockService = $window.zE = function(fn) { fn(); };
      for (var apiMethod of apiMethods) {
        $window.zE[apiMethod] = function() {};
        spyOn($window.zE, apiMethod).and.callThrough();
      }
    });

    it("delegates to Zendesk's Web Widget API", function() {
      var anyArgs = ['foo', 'bar', 'baz'];

      subject.identify(anyArgs);
      subject.hide(anyArgs);
      subject.show(anyArgs);
      subject.activate(anyArgs);
      subject.setLocale(anyArgs);

      expect(mockService.identify).toHaveBeenCalledWith(anyArgs);
      expect(mockService.hide).toHaveBeenCalledWith(anyArgs);
      expect(mockService.show).toHaveBeenCalledWith(anyArgs);
      expect(mockService.activate).toHaveBeenCalledWith(anyArgs);
      expect(mockService.setLocale).toHaveBeenCalledWith(anyArgs);
    });
  });
})

describe('ZendeskWidgetProvider', function() {
  'use strict';

  var subject, mockService, $window;

  beforeEach(module('zendeskWidget'));
  beforeEach(inject(function(_$window_, _ZendeskWidget_) {
    subject    = _ZendeskWidget_;
    $window    = _$window_;
  }));

  describe('a set of API methods', function() {
    beforeEach(function() {
      var apiMethods = ['setLocale', 'identify', 'hide', 'show', 'activate'];
      // Stub out $window.zE() wrapper and all apiMethods
      mockService = $window.zE = function(fn) { fn(); };
      for (var i = 0; i < apiMethods.length; i++) {
        var apiMethod = apiMethods[i];
        $window.zE[apiMethod] = function() {};
        spyOn($window.zE, apiMethod).and.callThrough();
      }
    });

    it("delegates to Zendesk's Web Widget API", function() {
      var anyArgs = ['foo', 'bar', 'baz'];

      subject.identify(anyArgs);
      subject.hide(anyArgs);
      subject.show(anyArgs);
      subject.activate(anyArgs);
      subject.setLocale(anyArgs);

      expect(mockService.identify).toHaveBeenCalledWith(anyArgs);
      expect(mockService.hide).toHaveBeenCalledWith(anyArgs);
      expect(mockService.show).toHaveBeenCalledWith(anyArgs);
      expect(mockService.activate).toHaveBeenCalledWith(anyArgs);
      expect(mockService.setLocale).toHaveBeenCalledWith(anyArgs);
    });
  });
})

Use old-school looping since travis stuck on ancient Chromium:
test: Use old-school looping since travis stuck on ancient Chromium:

- See travis-ci/travis-ci#3475
- TODO: switch to full Chrome on travis
