MCPcopy Index your code
hub / github.com/plotly/plotly.js / _assert

Function _assert

test/jasmine/tests/histogram_test.js:198–236  ·  view source on GitHub ↗
(msg, exp, warnMsg)

Source from the content-addressed store, hash-verified

196 });
197
198 function _assert(msg, exp, warnMsg) {
199 var allBinOpts = gd._fullLayout._histogramBinOpts;
200 var groups = Object.keys(allBinOpts);
201
202 expect(groups.length).toBe(exp.length, 'same # of bin groups| ' + msg);
203
204 var eGroups = exp.map(function(expi) { return expi[0]; });
205 expect(groups).toEqual(eGroups, 'same bin groups| ' + msg);
206
207 exp.forEach(function(expi) {
208 var k = expi[0];
209 var binOpts = allBinOpts[k];
210
211 if(!binOpts) {
212 return fail('bingroup ' + k + ' does NOT exist| ' + msg);
213 }
214
215 var traces = binOpts.traces || [];
216
217 if(!traces.length) {
218 return fail('traces list for bingroup ' + k + ' is empty| ' + msg);
219 }
220
221 expect(traces.length).toBe(expi[1].length, 'same # of tracked traces|' + msg);
222
223 traces.forEach(function(t, i) {
224 expect(t.index)
225 .toBe(expi[1][i], 'tracks same traces[' + i + ']|' + msg);
226 expect(t['_' + binOpts.dirs[i] + 'bingroup'])
227 .toBe(k, '_(x|y)bingroup key in trace' + i + '| ' + msg);
228 });
229 });
230
231 if(warnMsg) {
232 expect(Lib.warn).toHaveBeenCalledWith(warnMsg);
233 } else {
234 expect(Lib.warn).toHaveBeenCalledTimes(0);
235 }
236 }
237
238 it('should group traces w/ same axes and w/ same orientation', function() {
239 var barModes = ['group', 'stack'];

Callers 1

histogram_test.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…