(checkLeft, checkRight, checkTop, checkBottom, checkMiddleX)
| 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, [{ |
no outgoing calls
no test coverage detected
searching dependent graphs…