Skip to content

Commit

Permalink
add monaco-editor.spec.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
TaiSakuma committed Sep 6, 2023
1 parent 798b219 commit 382c0f5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/utils/__tests__/example/monaco-editor.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { describe, it, expect } from "vitest";
import * as monaco from "monaco-editor";

describe("monaco-editor", () => {
// Note: The test fails at the initial run with
// TypeError: Cannot read properties of null (reading 'webkitBackingStorePixelRatio')
// However, it will pass at rerun (press "f").
it("create", () => {
const ele = document.createElement("div");
const model = monaco.editor.createModel("hello world", "text/plain");
const editor = monaco.editor.create(ele, { model });
expect(editor.getValue()).toBe("hello world");
});
});

0 comments on commit 382c0f5

Please sign in to comment.