Jest says getInputElement is not a function

I use Jest for unit testing. It works great. But one weird issue appears when using the getInputElement method on HTMLIonInputElement. It exists on browser. But not in Jest (jsdom, jest-preset-angular) does not know that function.

It’s werid because this is a custom function from Ionic to get the native input element. (see docs).

I use it correctly. On runtime it works.

// Some directive.
constructor(el: ElementRef<HTMLIonInputElement>) {
  void el.nativeElement.getInputElement().then((inputEl) => (this.nativeInputElement = inputEl));

Jest throws:

TypeError: el.nativeElement.getInputElement is not a function

I know that Jest uses either node or jsdom. Not the real browser. But I cannot explain why is this custom method not available here. Maybe it has something to do with web components? But all other stuff I tested works fine.

Some ideas / exp advice? I would be grateful.

Hi, Dovel, did you find any solution for this issue?