(slice, count)
| 1401 | }); |
| 1402 | |
| 1403 | async function testSlice(slice, count) { |
| 1404 | var meta = chart.getDatasetMeta(0); |
| 1405 | var point = meta.data[slice].getCenterPoint(); |
| 1406 | var tooltipPosition = meta.data[slice].tooltipPosition(); |
| 1407 | |
| 1408 | async function recursive(left) { |
| 1409 | chart.config.data.labels[slice] = chart.config.data.labels[slice] + 'XX'; |
| 1410 | chart.update(); |
| 1411 | |
| 1412 | await triggerMouseEvent(chart, 'mouseout', point); |
| 1413 | await triggerMouseEvent(chart, 'mousemove', point); |
| 1414 | var tooltip = chart.tooltip; |
| 1415 | expect(tooltip.dataPoints.length).toBe(1); |
| 1416 | expect(tooltip.x).toBeGreaterThanOrEqual(0); |
| 1417 | if (tooltip.width <= chart.width) { |
| 1418 | expect(tooltip.x + tooltip.width).toBeLessThanOrEqual(chart.width); |
| 1419 | } |
| 1420 | expect(tooltip.caretX).toBeCloseToPixel(tooltipPosition.x); |
| 1421 | // if tooltip is longer than chart area then all tests done |
| 1422 | if (left === 0) { |
| 1423 | throw new Error('max iterations reached'); |
| 1424 | } |
| 1425 | if (tooltip.width < chart.width) { |
| 1426 | await recursive(left - 1); |
| 1427 | } |
| 1428 | } |
| 1429 | |
| 1430 | await recursive(count); |
| 1431 | } |
| 1432 | |
| 1433 | // Trigger an event over top of the slice |
| 1434 | for (var slice = 0; slice < 2; slice++) { |
no test coverage detected