"use strict";

var _react = _interopRequireDefault(require("react"));

var _chai = require("chai");

var _enzyme = require("enzyme");

var _iconSettings = _interopRequireDefault(require("../../icon-settings"));

var _setupAssistant = _interopRequireDefault(require("../../setup-assistant"));

var _step = _interopRequireDefault(require("../../setup-assistant/step"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

/* eslint-disable react/no-find-dom-node */
describe('SLDS Setup Assistant', function () {
  var handles = {
    setupAssistant: null
  };
  describe('Setup Assistant & Setup Assistant Step events', function () {
    var onStepToggleIsOpenObject;
    var onToggleIsOpenObject;
    beforeEach(function () {
      handles.setupAssistant = (0, _enzyme.mount)(_react.default.createElement(_iconSettings.default, {
        iconPath: "/assets/icons"
      }, _react.default.createElement(_setupAssistant.default, {
        id: "setup-assistant-event-test-1",
        onStepToggleIsOpen: function onStepToggleIsOpen(event, data) {
          onStepToggleIsOpenObject = {
            event: event,
            data: data
          };
        }
      }, _react.default.createElement(_step.default, {
        heading: "Setup Assistant Step Heading",
        id: "setup-assistant-event-test-1-step-1",
        isExpandable: true,
        isOpen: true
      }), _react.default.createElement(_step.default, {
        heading: "Setup Assistant Step Heading",
        id: "setup-assistant-event-test-1-step-2",
        isExpandable: true,
        isOpen: true,
        onToggleIsOpen: function onToggleIsOpen(event, data) {
          onToggleIsOpenObject = {
            event: event,
            data: data
          };
        }
      }))));
    });
    it('renders setup assistant', function () {
      (0, _chai.expect)(handles.setupAssistant.length).to.equal(1);
    });
    it('handles onStepToggleIsOpen correctly', function () {
      var expandButton = handles.setupAssistant.find('#setup-assistant-event-test-1-step-1 .slds-setup-assistant__step-summary-title button');
      expandButton.simulate('click');
      (0, _chai.expect)(_typeof(onStepToggleIsOpenObject.event)).to.eql('object');
      (0, _chai.expect)(_typeof(onStepToggleIsOpenObject.data)).to.eql('object');
      (0, _chai.expect)(onStepToggleIsOpenObject.data.index).to.eql(0);
      (0, _chai.expect)(onStepToggleIsOpenObject.data.isOpen).to.eql(true);
      (0, _chai.expect)(_typeof(onStepToggleIsOpenObject.data.step)).to.eql('object');
    });
    it('handles onToggleIsOpen correctly', function () {
      var expandButton = handles.setupAssistant.find('#setup-assistant-event-test-1-step-2 .slds-setup-assistant__step-summary-title button');
      expandButton.simulate('click');
      (0, _chai.expect)(_typeof(onToggleIsOpenObject.event)).to.eql('object');
      (0, _chai.expect)(_typeof(onToggleIsOpenObject.data)).to.eql('object');
      (0, _chai.expect)(onToggleIsOpenObject.data.index).to.eql(1);
      (0, _chai.expect)(onToggleIsOpenObject.data.isOpen).to.eql(true);
      (0, _chai.expect)(_typeof(onToggleIsOpenObject.data.step)).to.eql('object');
    });
  });
});