"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

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

var _enzyme = require("enzyme");

var _ = _interopRequireDefault(require("."));

var _index = _interopRequireDefault(require("../TutorialStep/index"));

var _components = require("../../../../../components");

var _2 = require("../..");

var _stepDefaults = require("../../constants/stepDefaults");

// Components
// Constants
describe('TutorialStepNav', function () {
  var node;
  var props;
  var childProps = {
    step: _stepDefaults.DEFAULT_STEP,
    index: 0
  };
  beforeEach(function () {
    props = {
      createStep: jest.fn()
    };
    node = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_2.PermissionContext.Provider, {
      value: false
    }, /*#__PURE__*/_react["default"].createElement(_["default"], props, /*#__PURE__*/_react["default"].createElement(_index["default"], childProps))));
  });
  it('should display the TutorialStepNav component', function () {
    expect(node.find('.TutorialStepNav')).toHaveLength(1);
  });
  it('should display the create step button when not readOnly', function () {
    expect(node.find('.TutorialStepNav').find(_components.Button).find('.TutorialStepNav-Button').first()).toHaveLength(1);
  });
  it('should call create step when button is clicked', function () {
    var button = node.find('.TutorialStepNav').find(_components.Button).find('.TutorialStepNav-Button').first();
    button.simulate('click');
    expect(props.createStep).toHaveBeenCalled();
  });
});