-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add unit test for editorTree in workbench (#386)
* test: add unit test for editorTree in workbench * feat: editorTree support to toolbarClick event * refactor: improve editorTree for testing * test: add test for editorTree * test: improve test * test: replace the scrollable mock
- Loading branch information
1 parent
89f1cbc
commit d43dee4
Showing
9 changed files
with
697 additions
and
10 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
163 changes: 163 additions & 0 deletions
163
src/workbench/sidebar/__tests__/__snapshots__/editorTree.test.tsx.snap
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,163 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`The EditorTree Component Match Snapshot 1`] = ` | ||
<div | ||
className="mo-editorTree" | ||
data-content="test" | ||
> | ||
<div | ||
className="mo-editorTree__item" | ||
onClick={[Function]} | ||
onContextMenu={[Function]} | ||
tabIndex={0} | ||
title="tab/tab1" | ||
> | ||
<span | ||
className="mo-editorTree__close codicon codicon-close" | ||
onClick={[Function]} | ||
/> | ||
<span | ||
className="mo-editorTree__item__fileName" | ||
> | ||
tab1 | ||
</span> | ||
<span | ||
className="mo-editorTree__item__filePath" | ||
> | ||
tab | ||
</span> | ||
</div> | ||
<div | ||
className="mo-editorTree__item" | ||
onClick={[Function]} | ||
onContextMenu={[Function]} | ||
tabIndex={0} | ||
title="tab/tab2" | ||
> | ||
<span | ||
className="mo-editorTree__close codicon codicon-close" | ||
onClick={[Function]} | ||
/> | ||
<span | ||
className="mo-editorTree__item__fileName" | ||
> | ||
tab2 | ||
</span> | ||
<span | ||
className="mo-editorTree__item__filePath" | ||
> | ||
tab | ||
</span> | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`The EditorTree Component With multiple groups Match Snapshot 1`] = ` | ||
<div | ||
className="mo-editorTree" | ||
data-content="test" | ||
> | ||
<div | ||
className="mo-editorTree__group" | ||
onClick={[Function]} | ||
onContextMenu={[Function]} | ||
> | ||
第 1 组 | ||
</div> | ||
<div | ||
className="mo-editorTree__item" | ||
onClick={[Function]} | ||
onContextMenu={[Function]} | ||
tabIndex={0} | ||
title="tab/tab1" | ||
> | ||
<span | ||
className="mo-editorTree__close codicon codicon-close" | ||
onClick={[Function]} | ||
/> | ||
<span | ||
className="mo-editorTree__item__fileName" | ||
> | ||
tab1 | ||
</span> | ||
<span | ||
className="mo-editorTree__item__filePath" | ||
> | ||
tab | ||
</span> | ||
</div> | ||
<div | ||
className="mo-editorTree__item" | ||
onClick={[Function]} | ||
onContextMenu={[Function]} | ||
tabIndex={0} | ||
title="tab/tab2" | ||
> | ||
<span | ||
className="mo-editorTree__close codicon codicon-close" | ||
onClick={[Function]} | ||
/> | ||
<span | ||
className="mo-editorTree__item__fileName" | ||
> | ||
tab2 | ||
</span> | ||
<span | ||
className="mo-editorTree__item__filePath" | ||
> | ||
tab | ||
</span> | ||
</div> | ||
<div | ||
className="mo-editorTree__group" | ||
onClick={[Function]} | ||
onContextMenu={[Function]} | ||
> | ||
第 2 组 | ||
</div> | ||
<div | ||
className="mo-editorTree__item" | ||
onClick={[Function]} | ||
onContextMenu={[Function]} | ||
tabIndex={0} | ||
title="tab/tab1" | ||
> | ||
<span | ||
className="mo-editorTree__close codicon codicon-close" | ||
onClick={[Function]} | ||
/> | ||
<span | ||
className="mo-editorTree__item__fileName" | ||
> | ||
tab1 | ||
</span> | ||
<span | ||
className="mo-editorTree__item__filePath" | ||
> | ||
tab | ||
</span> | ||
</div> | ||
<div | ||
className="mo-editorTree__item" | ||
onClick={[Function]} | ||
onContextMenu={[Function]} | ||
tabIndex={0} | ||
title="tab/tab2" | ||
> | ||
<span | ||
className="mo-editorTree__close codicon codicon-close" | ||
onClick={[Function]} | ||
/> | ||
<span | ||
className="mo-editorTree__item__fileName" | ||
> | ||
tab2 | ||
</span> | ||
<span | ||
className="mo-editorTree__item__filePath" | ||
> | ||
tab | ||
</span> | ||
</div> | ||
</div> | ||
`; |
63 changes: 63 additions & 0 deletions
63
src/workbench/sidebar/__tests__/__snapshots__/siderbar.test.tsx.snap
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,63 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`The Content Component Match Snapshot 1`] = ` | ||
<div | ||
className="mo-sidebar__content" | ||
> | ||
test | ||
</div> | ||
`; | ||
|
||
exports[`The Header Component Match Snapshot 1`] = ` | ||
<header | ||
className="mo-sidebar__header" | ||
> | ||
<div | ||
className="mo-sidebar__title" | ||
> | ||
<h2> | ||
test | ||
</h2> | ||
</div> | ||
<div | ||
className="mo-sidebar__toolbar" | ||
/> | ||
</header> | ||
`; | ||
|
||
exports[`The SideBar Component Match Snapshot 1`] = ` | ||
<div | ||
className="mo-sidebar" | ||
> | ||
<div | ||
className="mo-sidebar__pane" | ||
data-id="test" | ||
style={ | ||
Object { | ||
"display": "block", | ||
} | ||
} | ||
> | ||
<div | ||
data-testid="test" | ||
> | ||
here is content | ||
</div> | ||
</div> | ||
<div | ||
className="mo-sidebar__pane" | ||
data-id="another" | ||
style={ | ||
Object { | ||
"display": "none", | ||
} | ||
} | ||
> | ||
<div | ||
data-testid="another" | ||
> | ||
here is another content | ||
</div> | ||
</div> | ||
</div> | ||
`; |
Oops, something went wrong.