orgchart 5.0.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/publish.yml +35 -0
- package/README.md +214 -123
- package/README.zh-cn.md +232 -100
- package/README.zh-tw.md +232 -100
- package/bower.json +6 -9
- package/demo/10000-nodes.html +139 -0
- package/demo/ajax-datasource.html +46 -45
- package/demo/bottom2top.html +12 -9
- package/demo/center-on-selected-node.html +21 -17
- package/demo/color-coded.html +12 -9
- package/demo/css/style.css +28 -0
- package/demo/custom-icons.html +12 -9
- package/demo/custom-template.html +12 -9
- package/demo/data-prop-compact.html +11 -8
- package/demo/data-prop-hybrid.html +79 -50
- package/demo/default-collapsed.html +12 -9
- package/demo/drag-drop-hybrid-chart.html +17 -14
- package/demo/drag-drop.html +21 -16
- package/demo/edit-chart.html +144 -94
- package/demo/edit-hybrid-chart.html +177 -135
- package/demo/expand-to-given-depth.html +30 -22
- package/demo/export-chart-pdf.html +12 -9
- package/demo/export-chart-with-pictures.html +19 -12
- package/demo/export-chart.html +12 -9
- package/demo/family-tree.html +14 -11
- package/demo/familytree-custom-properties.html +108 -0
- package/demo/filter-node.html +104 -57
- package/demo/get-hierarchy.html +17 -12
- package/demo/get-related-nodes.html +27 -17
- package/demo/index.html +10 -3
- package/demo/integrate-map.html +32 -27
- package/demo/left2right.html +12 -9
- package/demo/level-offset.html +16 -15
- package/demo/link-node.html +12 -9
- package/demo/local-datasource.html +11 -8
- package/demo/minimap.html +224 -0
- package/demo/nodes-of-different-widths.html +11 -8
- package/demo/ondemand-loading-data.html +166 -112
- package/demo/option-createNode.html +28 -17
- package/demo/options-compact-drag.html +82 -0
- package/demo/options-export-navigation.html +76 -0
- package/demo/options-horizontal-template.html +80 -0
- package/demo/options-hybrid-navigation.html +71 -0
- package/demo/pan-zoom.html +20 -11
- package/demo/reload-data.html +17 -14
- package/demo/report-path.html +59 -29
- package/demo/responsive-design.html +14 -11
- package/demo/right2left.html +12 -9
- package/demo/toggle-sibs-resp.html +12 -9
- package/demo/ul-datasource.html +11 -8
- package/demo/vertical-level.html +12 -9
- package/dist/css/{jquery.orgchart.css → orgchart.css} +154 -80
- package/dist/css/orgchart.min.css +1 -0
- package/dist/js/orgchart.js +4474 -0
- package/dist/js/orgchart.min.js +2 -0
- package/dist/js/orgchart.min.js.map +1 -0
- package/gulpfile.js +42 -27
- package/package.json +33 -32
- package/src/css/{jquery.orgchart.css → orgchart.css} +154 -80
- package/src/js/orgchart.js +4474 -0
- package/test/compatibility/README.md +123 -0
- package/test/compatibility/browser.tests.js +1279 -0
- package/test/compatibility/options.tests.js +628 -0
- package/test/cypress/e2e/demo-interactions.cy.js +91 -0
- package/test/cypress/e2e/demo-rendering.cy.js +161 -0
- package/test/cypress/e2e/drag-drop-hybrid-chart.cy.js +23 -0
- package/test/cypress/e2e/edit-chart.cy.js +20 -0
- package/test/cypress/e2e/level-offset.cy.js +21 -0
- package/test/cypress/e2e/local-datasource.cy.js +16 -16
- package/test/cypress/e2e/minimap.cy.js +66 -0
- package/test/cypress/e2e/ondemand-loading-data.cy.js +34 -10
- package/test/cypress/e2e/pan-zoom.cy.js +165 -0
- package/test/cypress/e2e/report-path.cy.js +20 -0
- package/test/cypress/e2e/toggle-sibs-resp.cy.js +4 -4
- package/test/cypress/e2e/vertical-vevel.cy.js +7 -5
- package/test/e2e/local-datasource/test.js +1 -1
- package/test/integration/init-tests.js +192 -99
- package/test/integration/tests.js +1043 -57
- package/test/unit/lifecycle-builders-export.tests.js +1487 -0
- package/test/unit/minimap.tests.js +210 -0
- package/test/unit/tests.js +2372 -253
- package/dist/css/jquery.orgchart.min.css +0 -1
- package/dist/js/jquery.orgchart.js +0 -1741
- package/dist/js/jquery.orgchart.min.js +0 -5
- package/dist/js/jquery.orgchart.min.js.map +0 -1
- package/src/js/jquery.orgchart.js +0 -1741
|
@@ -1,49 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const chai = require('chai');
|
|
2
|
+
const sinon = require('sinon');
|
|
3
|
+
const sinonChai = require('sinon-chai').default;
|
|
4
|
+
const should = chai.should();
|
|
5
5
|
chai.use(sinonChai);
|
|
6
6
|
require('jsdom-global')();
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const OrgChart = require('../../src/js/orgchart');
|
|
8
|
+
|
|
9
|
+
function query(selector, root) {
|
|
10
|
+
return (root || document).querySelector(selector);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function queryAll(selector, root) {
|
|
14
|
+
return Array.from((root || document).querySelectorAll(selector));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function createElementFromHtml(html) {
|
|
18
|
+
const template = document.createElement('template');
|
|
19
|
+
|
|
20
|
+
template.innerHTML = html.trim();
|
|
21
|
+
return template.content.firstElementChild;
|
|
22
|
+
}
|
|
9
23
|
|
|
10
24
|
describe('orgchart -- integration tests', function () {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
ds = {
|
|
25
|
+
let container;
|
|
26
|
+
|
|
27
|
+
const ds = {
|
|
14
28
|
'id': 'n1',
|
|
15
29
|
'name': 'Lao Lao',
|
|
16
30
|
'children': [
|
|
17
31
|
{ 'id': 'n2', 'name': 'Bo Miao' },
|
|
18
32
|
{ 'id': 'n3', 'name': 'Su Miao' }
|
|
19
33
|
]
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
'
|
|
24
|
-
'
|
|
25
|
-
'
|
|
26
|
-
'
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const fragment = '<div class="orgchart"><ul class="nodes"><li class="hierarchy"><div id="n1" class="node" tabindex="0"><div clas' +
|
|
37
|
+
's="title"><i class="oci oci-menu parentNodeSymbol"></i>Lao Lao</div></div><ul class="nodes"><li class="hierarc' +
|
|
38
|
+
'hy"><div id="n2" data-parent="n1" class="node" tabindex="0"><div class="title">Bo Miao</div></div></li><li cla' +
|
|
39
|
+
'ss="hierarchy"><div id="n3" data-parent="n1" class="node" tabindex="0"><div class="title">Su Miao</div></div><' +
|
|
40
|
+
'/li></ul></li></ul></div>';
|
|
41
|
+
|
|
42
|
+
let oc = {};
|
|
43
|
+
|
|
44
|
+
beforeEach(function () {
|
|
45
|
+
document.body.innerHTML = '<div id="chart-container"></div>';
|
|
46
|
+
container = document.getElementById('chart-container');
|
|
47
|
+
});
|
|
48
|
+
|
|
33
49
|
afterEach(function () {
|
|
34
|
-
|
|
50
|
+
container.innerHTML = '';
|
|
35
51
|
});
|
|
36
52
|
|
|
37
53
|
describe('init()', function () {
|
|
38
54
|
it('initialize chart with json datasource', function () {
|
|
39
|
-
oc =
|
|
55
|
+
oc = new OrgChart({
|
|
56
|
+
chartContainer: '#chart-container',
|
|
40
57
|
'data': ds
|
|
41
58
|
});
|
|
42
|
-
|
|
59
|
+
container.innerHTML.should.equal(fragment);
|
|
43
60
|
});
|
|
44
61
|
|
|
45
62
|
it('initialize chart with <ul> datasource', function () {
|
|
46
|
-
|
|
63
|
+
const ulElement = createElementFromHtml(
|
|
47
64
|
'<ul id="ul-data">' +
|
|
48
65
|
'<li data-id="n1">Lao Lao' +
|
|
49
66
|
'<ul>' +
|
|
@@ -53,39 +70,41 @@ describe('orgchart -- integration tests', function () {
|
|
|
53
70
|
'</li>' +
|
|
54
71
|
'</ul>'
|
|
55
72
|
);
|
|
56
|
-
|
|
57
|
-
oc =
|
|
58
|
-
|
|
73
|
+
document.body.appendChild(ulElement);
|
|
74
|
+
oc = new OrgChart({
|
|
75
|
+
chartContainer: '#chart-container',
|
|
76
|
+
'data': ulElement
|
|
59
77
|
});
|
|
60
|
-
|
|
61
|
-
|
|
78
|
+
container.innerHTML.should.equal(fragment);
|
|
79
|
+
ulElement.remove();
|
|
62
80
|
});
|
|
63
81
|
|
|
64
82
|
it('initialize chart with the given visible level', function () {
|
|
65
|
-
oc =
|
|
83
|
+
oc = new OrgChart({
|
|
84
|
+
chartContainer: '#chart-container',
|
|
66
85
|
'data': ds,
|
|
67
86
|
'visibleLevel': 1
|
|
68
87
|
});
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
88
|
+
query('.hierarchy', oc.chart).classList.contains('hidden').should.be.false;
|
|
89
|
+
queryAll('.nodes', oc.chart)[1].classList.contains('hidden').should.be.true;
|
|
90
|
+
queryAll('.node.slide-up', oc.chart).should.lengthOf(2);
|
|
72
91
|
});
|
|
73
92
|
|
|
74
93
|
it('initialize chart with the given vertical level', function () {
|
|
75
|
-
|
|
76
|
-
'
|
|
77
|
-
'
|
|
78
|
-
'
|
|
79
|
-
|
|
80
|
-
|
|
94
|
+
const fragment = '<li class="hierarchy"><div id="n1" class="node" tabindex="0"><div class="title"><i class="oci oci-menu parentN' +
|
|
95
|
+
'odeSymbol"></i>Lao Lao</div></div><ul class="nodes vertical"><li class="hierarchy"><div id="n2" data-parent="n' +
|
|
96
|
+
'1" class="node" tabindex="0"><div class="title">Bo Miao</div></div></li><li class="hierarchy"><div id="n3" dat' +
|
|
97
|
+
'a-parent="n1" class="node" tabindex="0"><div class="title">Su Miao</div></div></li></ul></li>';
|
|
98
|
+
oc = new OrgChart({
|
|
99
|
+
chartContainer: '#chart-container',
|
|
81
100
|
'data': ds,
|
|
82
101
|
'verticalLevel': 2
|
|
83
102
|
});
|
|
84
|
-
|
|
103
|
+
query('.nodes', oc.chart).innerHTML.should.equal(fragment);
|
|
85
104
|
});
|
|
86
105
|
|
|
87
106
|
context('initialize chart with various combinations of "visibleLevel" and "verticalLevel" ', function () {
|
|
88
|
-
|
|
107
|
+
const ds = {
|
|
89
108
|
'name': 'Lao Lao',
|
|
90
109
|
'children': [
|
|
91
110
|
{ 'name': 'Bo Miao'
|
|
@@ -100,127 +119,201 @@ describe('orgchart -- integration tests', function () {
|
|
|
100
119
|
};
|
|
101
120
|
|
|
102
121
|
it('verticalLevel=2 and visibleLevel=1', function () {
|
|
103
|
-
|
|
104
|
-
'
|
|
105
|
-
'
|
|
106
|
-
'
|
|
107
|
-
'
|
|
108
|
-
'
|
|
109
|
-
'
|
|
110
|
-
|
|
111
|
-
'
|
|
112
|
-
'<div class="title">Hei Hei</div></div></li></ul></li></ul></li></ul></div>';
|
|
113
|
-
oc = $container.orgchart({
|
|
122
|
+
const fragment = '<div class="orgchart"><ul class="nodes"><li class="hierarchy"><div class="node" tabindex="0"><div class="title' +
|
|
123
|
+
'"><i class="oci oci-menu parentNodeSymbol"></i>Lao Lao</div></div><ul class="nodes hidden vertical"><li class=' +
|
|
124
|
+
'"hierarchy"><div class="node slide-up" tabindex="0"><div class="title">Bo Miao</div></div></li><li class="hier' +
|
|
125
|
+
'archy"><div class="node slide-up" tabindex="0"><div class="title"><i class="oci oci-menu parentNodeSymbol"></i' +
|
|
126
|
+
'>Su Miao</div></div><ul class="nodes hidden"><li class="hierarchy"><div class="node slide-up" tabindex="0"><di' +
|
|
127
|
+
'v class="title">Tie Hua</div></div></li><li class="hierarchy"><div class="node slide-up" tabindex="0"><div cla' +
|
|
128
|
+
'ss="title">Hei Hei</div></div></li></ul></li></ul></li></ul></div>';
|
|
129
|
+
oc = new OrgChart({
|
|
130
|
+
chartContainer: '#chart-container',
|
|
114
131
|
'data': ds,
|
|
115
132
|
'verticalLevel': 2,
|
|
116
133
|
'visibleLevel': 1
|
|
117
134
|
});
|
|
118
|
-
|
|
135
|
+
container.innerHTML.should.equal(fragment);
|
|
119
136
|
});
|
|
120
137
|
|
|
121
138
|
it('verticalLevel=2 and visibleLevel=2', function () {
|
|
122
|
-
|
|
123
|
-
'
|
|
124
|
-
'
|
|
125
|
-
'
|
|
126
|
-
'
|
|
127
|
-
'
|
|
128
|
-
'
|
|
129
|
-
|
|
130
|
-
'
|
|
131
|
-
oc = $container.orgchart({
|
|
139
|
+
const fragment = '<div class="orgchart"><ul class="nodes"><li class="hierarchy"><div class="node" tabindex="0"><div class="title' +
|
|
140
|
+
'"><i class="oci oci-menu parentNodeSymbol"></i>Lao Lao</div></div><ul class="nodes vertical"><li class="hierar' +
|
|
141
|
+
'chy"><div class="node" tabindex="0"><div class="title">Bo Miao</div></div></li><li class="hierarchy"><div clas' +
|
|
142
|
+
's="node" tabindex="0"><div class="title"><i class="oci oci-menu parentNodeSymbol"></i>Su Miao</div></div><ul c' +
|
|
143
|
+
'lass="nodes hidden"><li class="hierarchy"><div class="node slide-up" tabindex="0"><div class="title">Tie Hua</' +
|
|
144
|
+
'div></div></li><li class="hierarchy"><div class="node slide-up" tabindex="0"><div class="title">Hei Hei</div><' +
|
|
145
|
+
'/div></li></ul></li></ul></li></ul></div>';
|
|
146
|
+
oc = new OrgChart({
|
|
147
|
+
chartContainer: '#chart-container',
|
|
132
148
|
'data': ds,
|
|
133
149
|
'verticalLevel': 2,
|
|
134
150
|
'visibleLevel': 2
|
|
135
151
|
});
|
|
136
|
-
|
|
152
|
+
container.innerHTML.should.equal(fragment);
|
|
137
153
|
});
|
|
138
154
|
|
|
139
155
|
it('verticalLevel=2 and visibleLevel=3', function () {
|
|
140
|
-
|
|
141
|
-
'
|
|
142
|
-
'
|
|
143
|
-
'
|
|
144
|
-
'
|
|
145
|
-
'
|
|
146
|
-
'
|
|
147
|
-
|
|
148
|
-
'
|
|
149
|
-
oc = $container.orgchart({
|
|
156
|
+
const fragment = '<div class="orgchart"><ul class="nodes"><li class="hierarchy"><div class="node" tabindex="0"><div class="title' +
|
|
157
|
+
'"><i class="oci oci-menu parentNodeSymbol"></i>Lao Lao</div></div><ul class="nodes vertical"><li class="hierar' +
|
|
158
|
+
'chy"><div class="node" tabindex="0"><div class="title">Bo Miao</div></div></li><li class="hierarchy"><div clas' +
|
|
159
|
+
's="node" tabindex="0"><div class="title"><i class="oci oci-menu parentNodeSymbol"></i>Su Miao</div></div><ul c' +
|
|
160
|
+
'lass="nodes"><li class="hierarchy"><div class="node" tabindex="0"><div class="title">Tie Hua</div></div></li><' +
|
|
161
|
+
'li class="hierarchy"><div class="node" tabindex="0"><div class="title">Hei Hei</div></div></li></ul></li></ul>' +
|
|
162
|
+
'</li></ul></div>';
|
|
163
|
+
oc = new OrgChart({
|
|
164
|
+
chartContainer: '#chart-container',
|
|
150
165
|
'data': ds,
|
|
151
166
|
'verticalLevel': 2,
|
|
152
167
|
'visibleLevel': 3
|
|
153
168
|
});
|
|
154
|
-
|
|
169
|
+
container.innerHTML.should.equal(fragment);
|
|
155
170
|
});
|
|
156
171
|
});
|
|
157
172
|
|
|
158
173
|
it('initCompleted should be invoked immediately after construting one node', function () {
|
|
159
|
-
|
|
160
|
-
oc =
|
|
174
|
+
const spy = sinon.spy();
|
|
175
|
+
oc = new OrgChart({
|
|
176
|
+
chartContainer: '#chart-container',
|
|
161
177
|
'data': ds,
|
|
162
178
|
'createNode': spy
|
|
163
179
|
});
|
|
164
180
|
spy.should.have.been.callCount(3);
|
|
165
|
-
spy.
|
|
166
|
-
spy.
|
|
167
|
-
spy.
|
|
181
|
+
spy.getCall(0).args[0].id.should.equal('n1');
|
|
182
|
+
spy.getCall(0).args[1].id.should.equal('n1');
|
|
183
|
+
spy.getCall(1).args[0].id.should.equal('n2');
|
|
184
|
+
spy.getCall(1).args[1].id.should.equal('n2');
|
|
185
|
+
spy.getCall(2).args[0].id.should.equal('n3');
|
|
186
|
+
spy.getCall(2).args[1].id.should.equal('n3');
|
|
168
187
|
// spy.should.always.have.been.calledOn(oc);
|
|
169
188
|
});
|
|
170
189
|
|
|
190
|
+
it('renders custom data fields and invokes createNode after the node markup is built', function () {
|
|
191
|
+
const createNode = sinon.spy(function (nodeElement, data) {
|
|
192
|
+
nodeElement.setAttribute('data-role', data.role);
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
oc = new OrgChart({
|
|
196
|
+
chartContainer: '#chart-container',
|
|
197
|
+
data: {
|
|
198
|
+
key: 'n1',
|
|
199
|
+
label: 'Director',
|
|
200
|
+
role: 'Operations',
|
|
201
|
+
children: [{ key: 'n2', label: 'Engineer', role: 'Platform' }]
|
|
202
|
+
},
|
|
203
|
+
nodeId: 'key',
|
|
204
|
+
nodeTitle: 'label',
|
|
205
|
+
nodeContent: 'role',
|
|
206
|
+
createNode: createNode
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
query('#n1 .title', oc.chart).textContent.should.equal('Director');
|
|
210
|
+
query('#n1 .content', oc.chart).textContent.should.equal('Operations');
|
|
211
|
+
query('#n2', oc.chart).getAttribute('data-role').should.equal('Platform');
|
|
212
|
+
createNode.should.have.been.calledTwice;
|
|
213
|
+
createNode.firstCall.args[0].querySelector('.title').textContent.should.equal('Director');
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
it('renders custom node templates instead of the default title and content markup', function () {
|
|
217
|
+
oc = new OrgChart({
|
|
218
|
+
chartContainer: '#chart-container',
|
|
219
|
+
data: ds,
|
|
220
|
+
nodeTemplate: function (data) {
|
|
221
|
+
return '<section class="employee-card" data-name="' + data.name + '">' + data.name + '</section>';
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
query('#n1 .employee-card', oc.chart).getAttribute('data-name').should.equal('Lao Lao');
|
|
226
|
+
query('#n2 .employee-card', oc.chart).textContent.should.equal('Bo Miao');
|
|
227
|
+
should.not.exist(query('#n1 > .title', oc.chart));
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
it('dispatches init.orgchart after initCompleted receives the rendered chart', function (done) {
|
|
231
|
+
const initCompleted = sinon.spy(function (chartElement) {
|
|
232
|
+
chartElement.addEventListener('init.orgchart', function () {
|
|
233
|
+
initCompleted.should.have.been.calledOnce;
|
|
234
|
+
initCompleted.firstCall.args[0].should.equal(chartElement);
|
|
235
|
+
done();
|
|
236
|
+
}, { once: true });
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
oc = new OrgChart({
|
|
240
|
+
chartContainer: '#chart-container',
|
|
241
|
+
data: ds,
|
|
242
|
+
initCompleted: initCompleted
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
|
|
171
246
|
it('initialize chart with default className', function () {
|
|
172
|
-
oc =
|
|
247
|
+
oc = new OrgChart({
|
|
248
|
+
chartContainer: '#chart-container',
|
|
173
249
|
'data': ds,
|
|
174
250
|
'chartClass': 'demo'
|
|
175
251
|
});
|
|
176
|
-
oc
|
|
252
|
+
oc.chart.classList.contains('demo').should.be.true;
|
|
177
253
|
});
|
|
178
254
|
|
|
179
255
|
it('initialize chart with export button', function () {
|
|
180
|
-
oc =
|
|
256
|
+
oc = new OrgChart({
|
|
257
|
+
chartContainer: '#chart-container',
|
|
181
258
|
'data': ds,
|
|
182
259
|
'exportButton': true
|
|
183
260
|
});
|
|
184
|
-
|
|
261
|
+
query('.oc-export-btn').outerHTML.should.equal('<button class="oc-export-btn">Export</button>');
|
|
185
262
|
});
|
|
186
263
|
|
|
187
264
|
it('initialize chart with "bottom to top" direction', function () {
|
|
188
|
-
oc =
|
|
265
|
+
oc = new OrgChart({
|
|
266
|
+
chartContainer: '#chart-container',
|
|
189
267
|
'data': ds,
|
|
190
268
|
'direction': 'b2t'
|
|
191
269
|
});
|
|
192
|
-
oc
|
|
270
|
+
oc.chart.classList.contains('b2t').should.be.true;
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
it('applies horizontal direction classes', function () {
|
|
274
|
+
oc = new OrgChart({
|
|
275
|
+
chartContainer: '#chart-container',
|
|
276
|
+
data: ds,
|
|
277
|
+
direction: 'l2r'
|
|
278
|
+
});
|
|
279
|
+
oc.chart.classList.contains('l2r').should.be.true;
|
|
280
|
+
|
|
281
|
+
oc.init({ direction: 'r2l' });
|
|
282
|
+
oc.chart.classList.contains('r2l').should.be.true;
|
|
283
|
+
oc.chart.classList.contains('l2r').should.be.false;
|
|
193
284
|
});
|
|
194
285
|
|
|
195
286
|
it('reinitialize chart with drggable feature', function () {
|
|
196
|
-
oc =
|
|
287
|
+
oc = new OrgChart({
|
|
288
|
+
chartContainer: '#chart-container',
|
|
197
289
|
'data': ds
|
|
198
290
|
});
|
|
199
|
-
|
|
291
|
+
const spy = sinon.spy(oc, 'bindDragDrop');
|
|
200
292
|
oc.init({ 'draggable': true });
|
|
201
293
|
spy.should.have.been.callCount(3);
|
|
202
|
-
spy.
|
|
203
|
-
spy.
|
|
204
|
-
spy.
|
|
294
|
+
spy.getCall(0).args[0].id.should.equal('n1');
|
|
295
|
+
spy.getCall(1).args[0].id.should.equal('n2');
|
|
296
|
+
spy.getCall(2).args[0].id.should.equal('n3');
|
|
205
297
|
});
|
|
206
298
|
|
|
207
299
|
it('reinitialize chart with pan feature', function () {
|
|
208
|
-
oc =
|
|
300
|
+
oc = new OrgChart({
|
|
301
|
+
chartContainer: '#chart-container',
|
|
209
302
|
'data': ds
|
|
210
303
|
});
|
|
211
|
-
|
|
304
|
+
const spy = sinon.spy(oc, 'bindPan');
|
|
212
305
|
oc.init({ 'pan': true });
|
|
213
306
|
spy.should.have.been.callCount(1);
|
|
214
307
|
});
|
|
215
308
|
|
|
216
309
|
it('reinitialize chart with zoom feature', function () {
|
|
217
|
-
oc =
|
|
310
|
+
oc = new OrgChart({
|
|
311
|
+
chartContainer: '#chart-container',
|
|
218
312
|
'data': ds
|
|
219
313
|
});
|
|
220
|
-
|
|
314
|
+
const spy = sinon.spy(oc, 'bindZoom');
|
|
221
315
|
oc.init({ 'zoom': true });
|
|
222
316
|
spy.should.have.been.callCount(1);
|
|
223
317
|
});
|
|
224
318
|
});
|
|
225
|
-
|
|
226
|
-
});
|
|
319
|
+
});
|