forked from caplin/FlexLayout
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.ts
executable file
·80 lines (64 loc) · 1.76 KB
/
main.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import Model from "../src/model/Model";
import Actions from "../src/model/Actions";
import DockLocation from "../src/DockLocation";
describe("Tree", function()
{
it("adds a tab to center of empty tabset using add action", function()
{
const model = Model.fromJson(
{
global: {},
layout: {
type: "row",
id: "0",
children: [
{
type: "tabset",
name: "one",
id: "1",
enableDeleteWhenEmpty: false,
children: []
}
]
}
}
);
model.doAction(Actions.addNode({id:"2", name: "newtab1", component: "grid"}, "1", DockLocation.CENTER, -1));
let expected :any= {
"global": {},
"layout": {
"type": "row",
"id": "0",
"children": [
{
"type": "tabset",
"name": "one",
"enableDeleteWhenEmpty": false,
"active": true,
"id": "1",
"children": [
{
"type": "tab",
"id":"2",
"name": "newtab1",
"component": "grid"
}
]
}
]
},
"borders": []
};
const json = model.toJson();
expect(json).toEqual(expected);
console.log(JSON.stringify(json, null, "\t"));
})
// todo:
// adding into tabset with position: 0, middle, end
// adding into rows (ie splitting a tabset)
// auto assignment of ids
// dividers moving
// moving tabs and tidying tree
// removing tabs and tidying tree
// setting attributes
});