/*
Copyright (c) 2018 Uber Technologies, Inc.

This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
import * as React from 'react';
import { shallow } from 'enzyme';
import ProgressSteps from '../progress-steps.js';
import Step from '../step.js';
var example;
describe('ProgressSteps', function () {
  beforeEach(function () {
    var steps = [];

    for (var x = 0; x < 5; x++) {
      steps.push(React.createElement(Step, {
        key: x
      }, "Step ", x));
    }

    example = shallow(React.createElement(ProgressSteps, {
      current: 3
    }, steps));
  });
  it('applies isLast prop to child if element is last child', function () {
    example.children().forEach(function (element, index) {
      var isLast = index === 4;
      expect(element).toHaveProp('isLast', isLast);
    });
  });
  it('applies isCompleted prop to child if element is rendered before the provided index', function () {
    example.children().forEach(function (element, index) {
      var isCompleted = index === 0 || index === 1 || index === 2;
      expect(element).toHaveProp('isCompleted', isCompleted);
    });
  });
  it('applies isActive prop to child if element is rendered at the provided index', function () {
    example.children().forEach(function (element, index) {
      var isActive = index === 3;
      expect(element).toHaveProp('isActive', isActive);
    });
  });
  it('applies step prop to child for the current index', function () {
    example.children().forEach(function (element, index) {
      var step = index + 1;
      expect(element).toHaveProp('step', step);
    });
  });
});