@@ -26,7 +26,7 @@ interface Tree {
2626const testCaseName = ref (' ' )
2727const testSuite = ref (' ' )
2828const testSuiteKind = ref (' ' )
29- const handleNodeClick = (data : Tree ) => {
29+ const handleTreeClick = (data : Tree ) => {
3030 if (data .children ) {
3131 Cache .SetCurrentStore (data .store )
3232 viewName .value = ' testsuite'
@@ -59,7 +59,7 @@ const handleNodeClick = (data: Tree) => {
5959 }
6060}
6161
62- const data = ref ([] as Tree [])
62+ const treeData = ref ([] as Tree [])
6363const treeRef = ref <InstanceType <typeof ElTree >>()
6464const currentNodekey = ref (' ' )
6565
@@ -97,7 +97,7 @@ function loadTestSuites(storeName: string) {
9797 parentID: suite .id
9898 } as Tree )
9999 })
100- data .value .push (suite )
100+ treeData .value .push (suite )
101101 })
102102 })
103103 }
@@ -122,7 +122,7 @@ function loadStores() {
122122 .then (API .DefaultResponseProcess )
123123 .then (async (d ) => {
124124 stores .value = d .data
125- data .value = [] as Tree []
125+ treeData .value = [] as Tree []
126126 Cache .SetStores (d .data )
127127
128128 for (const item of d .data ) {
@@ -131,14 +131,14 @@ function loadStores() {
131131 }
132132 }
133133
134- if (data .value .length > 0 ) {
134+ if (treeData .value .length > 0 ) {
135135 const key = Cache .GetLastTestCaseLocation ()
136136
137137 let targetSuite = {} as Tree
138138 let targetChild = {} as Tree
139139 if (key .suite !== ' ' && key .testcase !== ' ' ) {
140- for (var i = 0 ; i < data .value .length ; i ++ ) {
141- const item = data .value [i ]
140+ for (var i = 0 ; i < treeData .value .length ; i ++ ) {
141+ const item = treeData .value [i ]
142142 if (item .id === key .suite && item .children ) {
143143 for (var j = 0 ; j < item .children .length ; j ++ ) {
144144 const child = item .children [j ]
@@ -154,16 +154,18 @@ function loadStores() {
154154 }
155155
156156 if (! targetChild .id || targetChild .id === ' ' ) {
157- targetSuite = data .value [0 ]
157+ targetSuite = treeData .value [0 ]
158158 if (targetSuite .children && targetSuite .children .length > 0 ) {
159159 targetChild = targetSuite .children [0 ]
160160 }
161161 }
162162
163163 viewName .value = ' testsuite'
164164 currentNodekey .value = targetChild .id
165+
165166 treeRef .value ! .setCurrentKey (targetChild .id )
166167 treeRef .value ! .setCheckedKeys ([targetChild .id ], false )
168+
167169 testSuite .value = targetSuite .label
168170 Cache .SetCurrentStore (targetSuite .store )
169171 testSuiteKind .value = targetChild .kind
@@ -261,7 +263,7 @@ watch(filterText, (val) => {
261263})
262264const filterTestCases = (value : string , data : Tree ) => {
263265 if (! value ) return true
264- return data .label .includes (value )
266+ return data .label .toLocaleLowerCase (). includes (value . toLocaleLowerCase () )
265267}
266268
267269const viewName = ref (' ' )
@@ -315,15 +317,16 @@ const suiteKinds = [{
315317
316318 <el-tree
317319 v-loading =" storesLoading"
318- :data =data
320+ :data =treeData
319321 highlight-current
320322 :check-on-click-node =" true"
321323 :expand-on-click-node =" false"
322324 :current-node-key =" currentNodekey"
323325 ref =" treeRef"
324326 node-key =" id"
325327 :filter-node-method =" filterTestCases"
326- @node-click =" handleNodeClick"
328+ @node-click =" handleTreeClick"
329+ @current-change =" handleTreeClick"
327330 data-intro =" This is the test suite tree. You can click the test suite to edit it."
328331 />
329332 <TemplateFunctions />
0 commit comments