Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 44e361d

Browse filesBrowse files
committed
unit tests for sankey link label defaults
1 parent 0f08952 commit 44e361d
Copy full SHA for 44e361d

File tree

1 file changed

+36
-0
lines changed
Filter options

1 file changed

+36
-0
lines changed

‎test/jasmine/tests/sankey_test.js

Copy file name to clipboardExpand all lines: test/jasmine/tests/sankey_test.js
+36Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ describe('sankey tests', function() {
112112
expect(fullTrace.link.target)
113113
.toEqual([], 'presence of link target array is guaranteed');
114114

115+
expect(fullTrace.link.label)
116+
.toEqual([], 'presence of link target array is guaranteed');
115117
});
116118

117119
it('\'Sankey\' specification should have proper types',
@@ -179,6 +181,40 @@ describe('sankey tests', function() {
179181

180182
});
181183

184+
it('fills \'link\' labels if not specified', function() {
185+
186+
var fullTrace = _supply({
187+
node: {
188+
label: ['a', 'b']
189+
},
190+
link: {
191+
source: [0, 1],
192+
target: [1, 0],
193+
value: [1, 2]
194+
}
195+
});
196+
197+
expect(Lib.isArray(fullTrace.link.label)).toBe(true, 'must be an array');
198+
expect(fullTrace.link.label).toEqual(['', ''], 'an array of empty strings');
199+
});
200+
201+
it('preserves \'link\' labels if specified', function() {
202+
203+
var fullTrace = _supply({
204+
node: {
205+
label: ['a', 'b']
206+
},
207+
link: {
208+
source: [0, 1],
209+
target: [1, 0],
210+
value: [1, 2],
211+
label: ['a', 'b']
212+
}
213+
});
214+
215+
expect(Lib.isArray(fullTrace.link.label)).toBe(true, 'must be an array');
216+
expect(fullTrace.link.label).toEqual(['a', 'b'], 'an array of the supplied values');
217+
});
182218
});
183219

184220
describe('sankey calc', function() {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.