"use strict";

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

var _immutable = require("immutable");

var _Stimulus = _interopRequireDefault(require("../../../../../../common/components/layout/sidebar/Stimulus"));

var _DragHandle = _interopRequireDefault(require("../../../../../../common/components/shared/drag_and_drop/DragHandle"));

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

var _presenter = _interopRequireDefault(require("../presenter"));

var _Stimulus2 = _interopRequireDefault(require("../../../../../../common/records/Stimulus"));

describe('Stimulus Building Sidebar Presenter', function () {
  var props = {
    connectDropTarget: sinon.stub().returnsArg(0),
    displayPosition: 1,
    itemId: '1',
    sidebarOpen: true,
    stimulus: new _Stimulus2.default(),
    itemsCollectionSize: 1,
    quizEntry: new _QuizEntry.default({
      position: 2,
      entryType: 'Stimulus',
      entry: new _Stimulus2.default()
    }),
    quizEntries: (0, _immutable.List)([new _QuizEntry.default(), new _QuizEntry.default(), new _QuizEntry.default()]),
    connectDragSource: function connectDragSource(C) {
      return C;
    },
    connectDragPreview: function connectDragPreview(C) {
      return C;
    }
  };
  var testbed = createTestbed(wrapInDragAndDropTestContext(withContext(_presenter.default)), props);
  shouldRenderComponent(testbed, {}, _presenter.default);
  it('renders common stimulus', function () {
    testbed.render();
    expect(testbed.findChildrenByType(_Stimulus.default).length).to.eq(1);
  });
  it('should include a drag handle if draggable', function () {
    testbed.render();
    var dragHandles = testbed.findChildrenByType(_DragHandle.default);
    expect(dragHandles).to.have.length(1);
  });
  it('should not include a drag handle not draggable', function () {
    testbed.render({
      sidebarOpen: false
    });
    var dragHandles = testbed.findChildrenByType(_DragHandle.default);
    expect(dragHandles).to.have.length(0);
  });
});