-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add tooltip * feat: add tooltip * test: spannerDelegate * optimize: font changed * feat: react theme provider
- Loading branch information
1 parent
5dba662
commit 26e21b6
Showing
18 changed files
with
457 additions
and
62 deletions.
There are no files selected for viewing
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
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
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
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,45 @@ | ||
import { describe, expect, it, vi } from "vitest"; | ||
import { SpannerDelegate, SpannerInstance } from "./spannerDelegate"; | ||
import { EditorController } from "./controller"; | ||
import { BlockDataElement } from ".."; | ||
|
||
describe("SpannerDelegate", () => { | ||
it("focusedNode", () => { | ||
const editorController = new EditorController("user"); | ||
|
||
const spannerInstance: SpannerInstance = { | ||
onFocusedNodeChanged: () => {}, | ||
dispose() {}, | ||
}; | ||
|
||
const mount = document.createElement("div"); | ||
|
||
const delegate = new SpannerDelegate(editorController, () => { | ||
return spannerInstance; | ||
}); | ||
delegate.mount(mount); | ||
|
||
const focusedNode1 = new BlockDataElement("Text", "id-1"); | ||
const focusedNode2 = new BlockDataElement("Text", "id-2"); | ||
|
||
const focusedNodeChangedSpy = vi.spyOn( | ||
spannerInstance, | ||
"onFocusedNodeChanged" | ||
); | ||
const disposeSpy = vi.spyOn(spannerInstance, "dispose"); | ||
|
||
delegate.focusedNode = focusedNode1; | ||
|
||
expect(focusedNodeChangedSpy).toHaveBeenCalledTimes(1); | ||
|
||
delegate.focusedNode = focusedNode2; | ||
|
||
expect(focusedNodeChangedSpy).toHaveBeenCalledTimes(2); | ||
|
||
delegate.focusedNode = focusedNode2; | ||
expect(focusedNodeChangedSpy).toHaveBeenCalledTimes(2); // shoud not increase | ||
|
||
delegate.dispose(); | ||
expect(disposeSpy).toHaveBeenCalledOnce(); | ||
}); | ||
}); |
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
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
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
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
Oops, something went wrong.
26e21b6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
blocky-editor – ./
blocky-editor.vercel.app
blocky-editor-git-master-vincentdchan.vercel.app
www.blocky-editor.dev
blocky-editor-vincentdchan.vercel.app
blocky-editor.dev