"use strict";

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

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

var _immutable = require("immutable");

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

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

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

describe('Common Stimulus Sidebar Index', function () {
  var stimulusParent = new _QuizEntry.default();
  sinon.stub(stimulusParent, 'getEntry').returns(new _Stimulus.default());
  var testbed = createTestbed(withContext(_index.default), {
    displayPosition: 1,
    isOver: false,
    isDragging: false,
    isShowingItems: false,
    renderSidebarItem: function renderSidebarItem() {},
    sidebarOpen: true,
    stimulusParent: stimulusParent
  });
  shouldRenderComponent(testbed, {}, _index.default);
  describe('#mapStateToProps', function () {
    it('gets isShowingItems from state', function () {
      var state = (0, _immutable.fromJS)({
        sidebar: {
          1: true
        }
      });
      var stimulusParent = new _QuizEntry.default();
      sinon.stub(stimulusParent, 'getEntry').returns({
        id: '1'
      });
      expect((0, _index.mapStateToProps)(state, {
        stimulusParent: stimulusParent
      }).isShowingItems).to.be.true();
    });
    it('sets default of isShowingItems to false if not found in state', function () {
      var state = (0, _immutable.fromJS)({
        sidebar: {
          2: true
        }
      });
      var stimulusParent = new _QuizEntry.default();
      sinon.stub(stimulusParent, 'getEntry').returns({
        id: '1'
      });
      expect((0, _index.mapStateToProps)(state, {
        stimulusParent: stimulusParent
      }).isShowingItems).to.be.false();
    });
  });
});