Skip to content

Commit 13a6810

Browse files
committed
Merge branch 'master' into ci/add-e2e-tests
2 parents 5b2fae1 + 1423e5b commit 13a6810

6 files changed

Lines changed: 32 additions & 13 deletions

File tree

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@ typings/
8080
.cache
8181
.DS_Store
8282

83-
# Automatically generated version.ts
84-
/src/version.ts
85-
8683
# Playwright
8784
/test-results/
8885
/playwright-report/

e2e/basic.spec.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,28 @@ test.describe('1. 基本的な地図表示', () => {
5353
await waitForMapLoad(page);
5454
expect(consoleErrors).toHaveLength(0);
5555
});
56+
57+
test('1.4 アトリビューションが表示されていること', async ({ page }) => {
58+
await page.goto(`${TEST_URL}/basic.html`);
59+
await waitForMapLoad(page);
60+
61+
// CustomAttributionControl は Shadow DOM 内にアトリビューションを描画する
62+
const attributionText = await page.evaluate(() => {
63+
const containers = document.querySelectorAll('.geolonia .maplibregl-control-container .maplibregl-ctrl-bottom-right > div');
64+
for (const container of containers) {
65+
const shadow = container.shadowRoot;
66+
if (shadow) {
67+
const inner = shadow.querySelector('.maplibregl-ctrl-attrib-inner');
68+
if (inner) {
69+
return inner.innerHTML;
70+
}
71+
}
72+
}
73+
return null;
74+
});
75+
76+
expect(attributionText).not.toBeNull();
77+
expect(attributionText).not.toBe('');
78+
});
5679
});
5780

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@geolonia/embed",
3-
"version": "5.2.1",
3+
"version": "5.2.2",
44
"description": "Geolonia embed JS API",
55
"main": "dist/embed.js",
66
"types": "dist/src/embed.d.ts",
@@ -15,8 +15,6 @@
1515
}
1616
},
1717
"scripts": {
18-
"prestart": "npm run build:version",
19-
"prelint": "npm run build:version",
2018
"start": "MAP_PLATFORM_STAGE=v1 webpack serve --config ./docs/webpack.config.js",
2119
"build": "npm run build:version && npm run build:embed",
2220
"build:version": "node ./scripts/build-version.mjs",

src/lib/CustomAttributionControl.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -311,11 +311,11 @@ class CustomAttributionControl implements IControl {
311311
this.styleId = stylesheet.id;
312312
}
313313

314-
const sourceCaches = this._map.style.sourceCaches;
315-
for (const id in sourceCaches) {
316-
const sourceCache = sourceCaches[id];
317-
if (sourceCache.used || sourceCache.usedForTerrain) {
318-
const source = sourceCache.getSource();
314+
const tileManagers = this._map.style.tileManagers;
315+
for (const id in tileManagers) {
316+
const tileManager = tileManagers[id];
317+
if (tileManager.used || tileManager.usedForTerrain) {
318+
const source = tileManager.getSource();
319319
if (
320320
source.attribution &&
321321
attributions.indexOf(source.attribution) < 0

src/version.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const VERSION = '5.2.1';

0 commit comments

Comments
 (0)