| 1195 | var tooltipPosition = meta.data[slice].tooltipPosition(); |
| 1196 | |
| 1197 | async function recursive(left) { |
| 1198 | chart.config.data.labels[slice] = chart.config.data.labels[slice] + class="st">'XX'; |
| 1199 | chart.update(); |
| 1200 | |
| 1201 | await jasmine.triggerMouseEvent(chart, class="st">'mouseout', point); |
| 1202 | await jasmine.triggerMouseEvent(chart, class="st">'mousemove', point); |
| 1203 | var tooltip = chart.tooltip; |
| 1204 | expect(tooltip.dataPoints.length).toBe(1); |
| 1205 | expect(tooltip.x).toBeGreaterThanOrEqual(0); |
| 1206 | if (tooltip.width <= chart.width) { |
| 1207 | expect(tooltip.x + tooltip.width).toBeLessThanOrEqual(chart.width); |
| 1208 | } |
| 1209 | expect(tooltip.caretX).toBeCloseToPixel(tooltipPosition.x); |
| 1210 | class="cm">// if tooltip is longer than chart area then all tests done |
| 1211 | if (left === 0) { |
| 1212 | throw new Error(class="st">'max iterations reached'); |
| 1213 | } |
| 1214 | if (tooltip.width < chart.width) { |
| 1215 | await recursive(left - 1); |
| 1216 | } |
| 1217 | } |
| 1218 | |
| 1219 | await recursive(count); |
| 1220 | } |