-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
split monaco-editor.spec.ts into two files
- Loading branch information
Showing
2 changed files
with
37 additions
and
35 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/components/main/trace-frame/code-col/__tests__/model.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { describe, it, expect } from "vitest"; | ||
import { ref, nextTick } from "vue"; | ||
|
||
import { useModel } from "../monaco-editor"; | ||
|
||
describe("useModel()", () => { | ||
it("call without arguments", () => { | ||
const { model, source } = useModel(); | ||
expect(source.value).toBe(""); | ||
expect(model.getValue()).toBe(""); | ||
}); | ||
|
||
it("call with string source", () => { | ||
const source = "# Hello, world!"; | ||
const { model } = useModel(source); | ||
expect(model.getValue()).toBe("# Hello, world!"); | ||
}); | ||
|
||
it("call with ref source", () => { | ||
const source = ref("# Hello, world!"); | ||
const { model, source: sourceReturned } = useModel(source); | ||
expect(sourceReturned === source).toBe(true); | ||
expect(model.getValue()).toBe("# Hello, world!"); | ||
}); | ||
|
||
it("source is reactive", async () => { | ||
const source = ref("# Hello, world!"); | ||
const { model } = useModel(source); | ||
expect(model.getValue()).toBe("# Hello, world!"); | ||
source.value = "# New source"; | ||
await nextTick(); | ||
expect(model.getValue()).toBe("# New source"); | ||
}); | ||
}); |
38 changes: 3 additions & 35 deletions
38
src/components/main/trace-frame/code-col/__tests__/monaco-editor.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters