Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6556fa0

Browse files
add layerConnectedEventEmittedCount to the options attribute test
1 parent 7b80c2e commit 6556fa0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/l-tile-layer-wms.test.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ it("should reload the layer when the options attribute changes", async () => {
102102
el.setAttribute("layers", "example layer ere");
103103
el.setAttribute("options", initialOptions);
104104

105+
let layerConnectedEventEmittedCount = 0;
105106
let promise = new Promise((resolve) => {
106107
el.addEventListener(layerConnected, (ev) => {
108+
layerConnectedEventEmittedCount += 1;
107109
resolve(ev.detail);
108110
});
109111
});
@@ -121,11 +123,13 @@ it("should reload the layer when the options attribute changes", async () => {
121123
resolve(ev.detail);
122124
});
123125
});
126+
127+
// Update the options attribute
124128
el.setAttribute("options", updatedOptions);
125129

126130
// Wait for the layer to reload
127131
detail = await promise;
128132
expect(detail.layer.options.height).toBe(202);
129133
expect(detail.layer.options.bbox).toBe("new coords");
134+
expect(layerConnectedEventEmittedCount).toBe(2); // initial layer creation + reload
130135
});
131-

0 commit comments

Comments
 (0)