(msg, present, opts)
| 96 | }); |
| 97 | |
| 98 | function assertCB(msg, present, opts) { |
| 99 | var expandedMarginR = opts.expandedMarginR; |
| 100 | var expandedMarginT = opts.expandedMarginT; |
| 101 | var cbTop = opts.top; |
| 102 | var cbHeight = opts.height; |
| 103 | var multiFill = opts.multiFill; |
| 104 | var colorbars = d3Select(gd).selectAll('.colorbar'); |
| 105 | expect(colorbars.size()).toBe(present ? 1 : 0); |
| 106 | |
| 107 | // check that the displayed object has the right size, |
| 108 | // not just that fullLayout._size changed |
| 109 | var plotSizeTest = {}; |
| 110 | if(expandedMarginR) plotSizeTest.widthLessThan = 400; |
| 111 | else plotSizeTest.width = 400; |
| 112 | |
| 113 | if(expandedMarginT) plotSizeTest.heightLessThan = 400; |
| 114 | else plotSizeTest.height = 400; |
| 115 | |
| 116 | assertPlotSize(plotSizeTest); |
| 117 | |
| 118 | if(present) { |
| 119 | var cbbg = colorbars.selectAll('.cbbg'); |
| 120 | var cbfills = colorbars.selectAll('.cbfill'); |
| 121 | |
| 122 | negateIf(multiFill, expect(cbfills.size())).toBe(1); |
| 123 | |
| 124 | if(!cbHeight) cbHeight = 400; |
| 125 | var bgHeight = +cbbg.attr('height'); |
| 126 | if(expandedMarginT) expect(bgHeight).toBeLessThan(cbHeight - 2); |
| 127 | else expect(bgHeight).toBeWithin(cbHeight, 2); |
| 128 | |
| 129 | if(cbTop !== undefined) { |
| 130 | var topShift = cbbg.node().getBoundingClientRect().top - gd.getBoundingClientRect().top; |
| 131 | expect(topShift).toBeWithin(cbTop, 2); |
| 132 | } |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | // let heatmap stand in for all traces with trace.{showscale, colorbar} |
| 137 | // also test impliedEdits for colorbars at the trace root |
no test coverage detected
searching dependent graphs…