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

Function _verifyTitle

test/jasmine/tests/pie_test.js:359–375  ·  view source on GitHub ↗
(checkLeft, checkRight, checkTop, checkBottom, checkMiddleX)

Source from the content-addressed store, hash-verified

357 });
358
359 function _verifyTitle(checkLeft, checkRight, checkTop, checkBottom, checkMiddleX) {
360 return function() {
361 var title = d3SelectAll('.titletext text');
362 expect(title.size()).toBe(1);
363 var titleBox = d3Select('g.titletext').node().getBoundingClientRect();
364 var pieBox = d3Select('g.trace').node().getBoundingClientRect();
365 // check that margins agree. we leave an error margin of 2.
366 if(checkLeft) expect(Math.abs(titleBox.left - pieBox.left)).toBeLessThan(2);
367 if(checkRight) expect(Math.abs(titleBox.right - pieBox.right)).toBeLessThan(2);
368 if(checkTop) expect(Math.abs(titleBox.top - pieBox.top)).toBeLessThan(2);
369 if(checkBottom) expect(Math.abs(titleBox.bottom - pieBox.bottom)).toBeLessThan(2);
370 if(checkMiddleX) {
371 expect(Math.abs(titleBox.left + titleBox.right - pieBox.left - pieBox.right))
372 .toBeLessThan(2);
373 }
374 };
375 }
376
377 it('shows title top center if hole is zero', function(done) {
378 Plotly.newPlot(gd, [{

Callers 1

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