1
1
import React from "react" ;
2
- import TestingList , { TestingAPI } from "./index" ;
2
+ import { TestingList , Options , TestingAPI } from "./index" ;
3
3
import { ItemPath } from "../../List" ;
4
4
import { RunStatus } from "../testing" ;
5
5
import { TestingItem } from "../testing-api" ;
@@ -10,19 +10,25 @@ function randList<T>(list: T[]): T {
10
10
}
11
11
12
12
export const demoAPI : TestingAPI = {
13
- delete : function ( item : TestingItem , path : ItemPath ) : Promise < void > {
13
+ delete : function ( item : TestingItem , opts : Options ) : Promise < void > {
14
14
throw new Error ( "Function not implemented." ) ;
15
15
} ,
16
- run : function ( item : TestingItem , path : ItemPath ) : Promise < RunStatus > {
16
+ run : function ( item : TestingItem , opts : Options ) : Promise < RunStatus > {
17
17
// the API can be designed to have rate limit
18
18
return new Promise ( ( resolve ) => {
19
19
setTimeout ( ( ) => resolve ( randList ( [ "success" , /* "fail", "error", "skip" */ ] as RunStatus [ ] ) ) , ( 1 + Math . random ( ) * 3 ) * 1000 )
20
20
} )
21
21
} ,
22
- duplicate : function ( item : TestingItem , path : ItemPath ) : Promise < void > {
22
+ duplicate : function ( item : TestingItem , opts : Options ) : Promise < void > {
23
23
throw new Error ( "Function not implemented." ) ;
24
24
} ,
25
- add : async function ( item : TestingItem , path : ItemPath ) : Promise < void > {
25
+ add : async function ( item : TestingItem , opts : Options ) : Promise < void > {
26
+
27
+ } ,
28
+ addFolder : async function ( item : TestingItem , opts : Options ) : Promise < void > {
29
+
30
+ } ,
31
+ delFolder : async function ( item : TestingItem , opts : Options ) : Promise < void > {
26
32
27
33
}
28
34
}
@@ -38,6 +44,7 @@ function newArray(n) {
38
44
export default function ( ) {
39
45
return < TestingList
40
46
data = { demoData }
47
+ showEditActions = { false }
41
48
style = { {
42
49
width : "400px" ,
43
50
minHeight : "600px" ,
@@ -67,6 +74,10 @@ export const demoData: TestingItem[] = [
67
74
{
68
75
name : "WhatInterface to test?" ,
69
76
kind : "case" ,
77
+ children : [ {
78
+ name : "sub_case" ,
79
+ kind : "case" ,
80
+ } ]
70
81
} ,
71
82
...newArray ( 25 ) . map ( ( e , i ) : TestingItem => ( {
72
83
name : `Test_${ i } ` ,
0 commit comments