core-graphics
Version:
A core library for creating shape-based graphic editors
46 lines (27 loc) • 1.51 kB
JavaScript
;
var _tap = require('tap');
var _editorStateReducer3 = require('../editor-state-reducer');
var _editorStateReducer4 = _interopRequireDefault(_editorStateReducer3);
var _editorState = require('../editor-state');
var _editorEvents = require('../editor-events');
var _testHistorySpec = require('./test-history.spec.js');
var _modes = require('../../declarations/modes');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var ALICE_BOB_LINES_EDITOR_STATE = (0, _editorStateReducer4.default)((0, _editorState.getInitialEditorState)({ shapesDeclarations: {}, author: _testHistorySpec.ALICE }), (0, _editorEvents.updateHistory)(_testHistorySpec.ALICE_BOB_LINES));
(0, _tap.test)('setMode', function (t) {
var newMode = (0, _modes.modeSelected)([_testHistorySpec.ALICE_LINE.id]);
var ev = (0, _editorEvents.setMode)(newMode);
var _editorStateReducer = (0, _editorStateReducer4.default)(ALICE_BOB_LINES_EDITOR_STATE, ev);
var mode = _editorStateReducer.mode;
t.deepEqual(mode, newMode);
t.end();
});
(0, _tap.test)('setMode: fall back to select mode if selectedMode is with no ids', function (t) {
var newMode = (0, _modes.modeSelected)([]);
var expectedMode = (0, _modes.modeSelect)();
var ev = (0, _editorEvents.setMode)(newMode);
var _editorStateReducer2 = (0, _editorStateReducer4.default)(ALICE_BOB_LINES_EDITOR_STATE, ev);
var mode = _editorStateReducer2.mode;
t.deepEqual(mode, expectedMode);
t.end();
});