mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-15 02:54:07 +00:00
This replaces the ace editor with the monaco editor. It fixes quite a few small paper-cut bugs and should be easier to add code completion to in the future. Many of the snippets are omitted but can be added back later if needed. Otherwise, we have tried to preserve the existing look and feel as much as possible.
28 lines
756 B
TypeScript
28 lines
756 B
TypeScript
// SPDX-License-Identifier: MIT
|
|
// Copyright (c) 2021 The Pybricks Authors
|
|
|
|
import { monaco } from 'react-monaco-editor';
|
|
import { Action } from '../actions';
|
|
import { setEditSession } from './actions';
|
|
import reducers from './reducers';
|
|
|
|
type State = ReturnType<typeof reducers>;
|
|
|
|
test('initial state', () => {
|
|
expect(reducers(undefined, {} as Action)).toMatchInlineSnapshot(`
|
|
Object {
|
|
"current": null,
|
|
}
|
|
`);
|
|
});
|
|
|
|
test('current', () => {
|
|
const session = {} as monaco.editor.ICodeEditor;
|
|
expect(reducers({ current: null } as State, setEditSession(session)).current).toBe(
|
|
session,
|
|
);
|
|
expect(
|
|
reducers({ current: session } as State, setEditSession(undefined)).current,
|
|
).toBe(null);
|
|
});
|