MCPcopy
hub / github.com/plotly/plotly.js / _verifyTitle

Function _verifyTitle

test/jasmine/tests/funnelarea_test.js:283–299  ·  view source on GitHub ↗
(checkLeft, checkRight, checkTop, checkBottom, checkMiddleX)

Source from the content-addressed store, hash-verified

281 });
282
283 function _verifyTitle(checkLeft, checkRight, checkTop, checkBottom, checkMiddleX) {
284 return function() {
285 var title = d3SelectAll('.titletext text');
286 expect(title.size()).toBe(1);
287 var titleBox = d3Select('g.titletext').node().getBoundingClientRect();
288 var funnelareaBox = d3Select('g.trace').node().getBoundingClientRect();
289 // check that margins agree. we leave an error margin of 2.
290 if(checkLeft) expect(Math.abs(titleBox.left - funnelareaBox.left)).toBeLessThan(2);
291 if(checkRight) expect(Math.abs(titleBox.right - funnelareaBox.right)).toBeLessThan(2);
292 if(checkTop) expect(Math.abs(titleBox.top - funnelareaBox.top)).toBeLessThan(2);
293 if(checkBottom) expect(Math.abs(titleBox.bottom - funnelareaBox.bottom)).toBeLessThan(2);
294 if(checkMiddleX) {
295 expect(Math.abs(titleBox.left + titleBox.right - funnelareaBox.left - funnelareaBox.right))
296 .toBeLessThan(2);
297 }
298 };
299 }
300
301 it('shows title top center if title.position is undefined', function(done) {
302 Plotly.newPlot(gd, [{

Callers 1

funnelarea_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…