"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

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

var _immutable = require("immutable");

var _InteractionType = _interopRequireDefault(require("quiz-interactions/lib/records/InteractionType"));

var _honorsSidebarProps = require("../../../../../../tests/util/sharedExamples/honorsSidebarProps");

var _dndTestUtils = require("../../../../../../tests/util/dndTestUtils");

var _Item = _interopRequireDefault(require("../../../../../common/records/Item"));

var _QuizEntry = _interopRequireDefault(require("../../../../../common/records/QuizEntry"));

var _index = _interopRequireWildcard(require("../index"));

describe('Building Index Sidebar', function () {
  var intType = new _InteractionType.default({});
  var itemA = new _Item.default({
    id: '5',
    position: 4
  });
  var itemB = new _Item.default({
    id: '6',
    position: 8
  });
  sinon.stub(itemA, 'getInteractionType').returns(intType);
  sinon.stub(itemB, 'getInteractionType').returns(intType);
  var quizEntryA = new _QuizEntry.default({
    id: '3'
  });
  var quizEntryB = new _QuizEntry.default({
    id: '8'
  });
  sinon.stub(quizEntryA, 'getEntry').returns(itemA);
  sinon.stub(quizEntryB, 'getEntry').returns(itemB);
  var quizEntries = (0, _immutable.List)([quizEntryA, quizEntryB]);
  var moveQuizEntryStub = sinon.stub();
  var moveTemporaryQuizEntryStub = sinon.stub();
  var newHoverPositionStub = sinon.stub();
  var scrollToItemStub = sinon.stub();
  var props = {
    connectDropTarget: function connectDropTarget(Component) {
      return Component;
    },
    // inserted by React DnD
    isOver: false,
    // inserted by React DnD
    moveQuizEntry: moveQuizEntryStub,
    // Used for DND
    moveTemporaryQuizEntry: moveTemporaryQuizEntryStub,
    // Used for DND
    newHoverPosition: newHoverPositionStub,
    // Used for DND
    quizId: '1',
    // Used for DND
    scrollToItem: scrollToItemStub,
    sidebarOpen: true,
    quizEntries: quizEntries
  };
  var ConnectedSidebar = (0, _dndTestUtils.wrapInDragAndDropTestContext)(withContext(_index.default));
  var testbed = createTestbed(ConnectedSidebar, props);
  shouldRenderComponent(testbed, {}, _index.default);
  (0, _honorsSidebarProps.honorsSidebarProps)(_index.mapStateToProps, _index.mapDispatchToProps);
});