highcharts / highcharts-react

The official Highcharts supported wrapper for React

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem with tooltip formatter in unit tests

ppotaczek opened this issue · comments

I am using JEST and RTL for writing unit tests. I can see charts being rendered inside tests when I check below assertion it is true
expect(container.getElementsByClassName("highcharts-point").length).toBeGreaterThan(0)

when I trigger event on the highcharts-point I also see highcharts-series-hover also gets applied which means hover was successful but the issue is formatter function is not triggered from tooltip options for highcharts due to which tooltip is not displayed and I am not able to test further assertions. can someone help what am I missing here?

tooltip: {
  useHTML: true,
  crosshairs: [{
      dashStyle: "dash"
    }, {
      dashStyle: "dash"
    }],
  shared: false,
  snap: 15,
  formatter(): string {
    return getTooltipData(this);
  }
}
    ```

_Originally posted by @abhirocks550 in https://github.com/highcharts/highcharts-react/issues/23#issuecomment-1837119770_
            

<!-- ASANA TASK ID (do not delete): 1206091779405042 -->

Hi @abhirocks550,

Thank you for contacting us!

It's hard to guess what might be causing the problem, so could you reproduce the issue in some minimal project and add it here as a .rar archive?

Best regards!