@@ -10,6 +10,7 @@ import type { Suite } from './types'
1010import { API } from ' ./net'
1111import { Cache } from ' ./cache'
1212import { useI18n } from ' vue-i18n'
13+ import { Magic } from ' ./magicKeys'
1314
1415const { t } = useI18n ()
1516
@@ -61,6 +62,39 @@ const handleTreeClick = (data: Tree) => {
6162 }
6263}
6364
65+ Magic .Keys ((k ) => {
66+ const currentKey = currentNodekey .value
67+
68+ if (treeRef .value ) {
69+ treeRef .value .data .forEach ((n ) => {
70+ if (n .children ) {
71+ n .children .forEach ((c , index ) => {
72+ if (c .id === currentKey ) {
73+ var nextIndex = - 1
74+ if (k .endsWith (' Up' )) {
75+ if (index > 0 ) {
76+ nextIndex = index - 1
77+ }
78+ } else {
79+ if (index < n .children .length - 1 ) {
80+ nextIndex = index + 1
81+ }
82+ }
83+
84+ if (nextIndex >= 0 < n .children .length ) {
85+ const next = n .children [nextIndex ]
86+ currentNodekey .value = next .id
87+ treeRef .value ! .setCurrentKey (next .id )
88+ treeRef .value ! .setCheckedKeys ([next .id ], false )
89+ }
90+ return
91+ }
92+ })
93+ }
94+ })
95+ }
96+ }, [' Alt+ArrowUp' , ' Alt+ArrowDown' ])
97+
6498const treeData = ref ([] as Tree [])
6599const treeRef = ref <InstanceType <typeof ElTree >>()
66100const currentNodekey = ref (' ' )
@@ -327,7 +361,6 @@ const suiteKinds = [{
327361 ref =" treeRef"
328362 node-key =" id"
329363 :filter-node-method =" filterTestCases"
330- @node-click =" handleTreeClick"
331364 @current-change =" handleTreeClick"
332365 data-intro =" This is the test suite tree. You can click the test suite to edit it."
333366 >
0 commit comments