From 2b2c6bbeb3f29dace7d63f920575c46ca14f1fef Mon Sep 17 00:00:00 2001 From: Martin Schuhfuss Date: Thu, 30 Nov 2023 12:17:48 +0100 Subject: [PATCH] fix: initialize element property of AdvancedMarkerElement (#568) Add initialization of the `advancedMarkerEl.element` property. In the real API this is initialized in the constructor and is guaranteed to be an html-element, so it has to be here as well. --- .../advanced-marker-element/advanced-marker-element.test.ts | 2 ++ src/drawing/advanced-marker-element/advanced-marker-element.ts | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/drawing/advanced-marker-element/advanced-marker-element.test.ts b/src/drawing/advanced-marker-element/advanced-marker-element.test.ts index b211808f..e3f7a299 100644 --- a/src/drawing/advanced-marker-element/advanced-marker-element.test.ts +++ b/src/drawing/advanced-marker-element/advanced-marker-element.test.ts @@ -42,4 +42,6 @@ test("registers mocks", () => { }); expect(mockInstances.get(AdvancedMarkerElement)[0].title).toBe("Howdy"); + + expect(mockInstances.get(AdvancedMarkerElement)[0].element).toBeDefined(); }); diff --git a/src/drawing/advanced-marker-element/advanced-marker-element.ts b/src/drawing/advanced-marker-element/advanced-marker-element.ts index fd17683f..9753eab1 100644 --- a/src/drawing/advanced-marker-element/advanced-marker-element.ts +++ b/src/drawing/advanced-marker-element/advanced-marker-element.ts @@ -49,6 +49,9 @@ export class AdvancedMarkerElement constructor(options?: google.maps.marker.AdvancedMarkerElementOptions) { super(); + + this.element = document.createElement("div"); + __registerMockInstance(this.constructor, this); } }