Skip to content

Commit 0d59631

Browse files
committed
Manually add class that leaflet may not be adding due to ??? on CI
1 parent a424ff6 commit 0d59631

File tree

2 files changed

+37
-14
lines changed

2 files changed

+37
-14
lines changed

src/mapml/elementSupport/layers/createLayerControlForLayer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ export var createLayerControlHTML = async function () {
114114
(e) => {
115115
let layerControl = this._layer._layerEl._layerControl._container;
116116
if (!layerControl._isExpanded && e.pointerType === 'touch') {
117+
layerControl.classList.add('leaflet-control-layers-expanded');
117118
layerControl._isExpanded = true;
118119
return;
119120
}

test/e2e/core/touchDevice.test.js

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,33 +22,55 @@ test.describe('Playwright touch device tests', () => {
2222
const layerControl = await page.locator('.leaflet-control-layers');
2323

2424
// Initial state logging
25-
console.log("Initial class list:", await layerControl.evaluate(el => el.className));
26-
console.log("Initial _isExpanded:", await layerControl.evaluate(el => el._isExpanded));
25+
console.log(
26+
'Initial class list:',
27+
await layerControl.evaluate((el) => el.className)
28+
);
29+
console.log(
30+
'Initial _isExpanded:',
31+
await layerControl.evaluate((el) => el._isExpanded)
32+
);
2733

2834
// Initial tap
2935
await layerControl.tap();
3036
await page.waitForTimeout(1000);
3137

3238
// Log after tap
33-
console.log("Class list after tap:", await layerControl.evaluate(el => el.className));
34-
console.log("Is expanded after tap:", await layerControl.evaluate(el => el._isExpanded));
39+
console.log(
40+
'Class list after tap:',
41+
await layerControl.evaluate((el) => el.className)
42+
);
43+
console.log(
44+
'Is expanded after tap:',
45+
await layerControl.evaluate((el) => el._isExpanded)
46+
);
3547

3648
// Long press simulation using touchstart/touchend
37-
await layerControl.evaluate((el) => el.dispatchEvent(new TouchEvent('touchstart')));
49+
await layerControl.evaluate((el) =>
50+
el.dispatchEvent(new TouchEvent('touchstart'))
51+
);
3852
await page.waitForTimeout(1000); // Extended delay for long press
39-
await layerControl.evaluate((el) => el.dispatchEvent(new TouchEvent('touchend')));
53+
await layerControl.evaluate((el) =>
54+
el.dispatchEvent(new TouchEvent('touchend'))
55+
);
4056

4157
// Log after long press
42-
console.log("Class list after long press:", await layerControl.evaluate(el => el.className));
43-
console.log("Is expanded after long press:", await layerControl.evaluate(el => el._isExpanded));
58+
console.log(
59+
'Class list after long press:',
60+
await layerControl.evaluate((el) => el.className)
61+
);
62+
console.log(
63+
'Is expanded after long press:',
64+
await layerControl.evaluate((el) => el._isExpanded)
65+
);
4466

67+
const layerControlExpanded = page.locator(
68+
'.leaflet-control-layers-expanded'
69+
);
70+
await layerControlExpanded.waitFor({ timeout: 10000 });
4571

46-
const layerControlExpanded = page.locator('.leaflet-control-layers-expanded');
47-
await layerControlExpanded.waitFor({ timeout: 10000 });
48-
49-
50-
const finalClassList = await layerControl.evaluate(el => el.className);
51-
console.log("Final class list:", finalClassList);
72+
const finalClassList = await layerControl.evaluate((el) => el.className);
73+
console.log('Final class list:', finalClassList);
5274
expect(finalClassList).toMatch(/leaflet-control-layers-expanded/);
5375
});
5476
});

0 commit comments

Comments
 (0)