Skip to content

Commit 9d450b2

Browse files
committed
Apply code formatting to tests and mapmlify-layer
Run `npm run format` to apply Prettier formatting across test files and mapmlify-layer.js. No logic changes — only line wrapping for long strings, function arguments, and chained method calls.
1 parent 32f3f62 commit 9d450b2

File tree

8 files changed

+117
-33
lines changed

8 files changed

+117
-33
lines changed

src/script/mapmlify-layer.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,10 @@ class MapmlifyLayer extends HTMLElement {
649649
this.#addDataLayerToViewer(viewer);
650650

651651
// Insert viewer before the textarea so it appears above it
652-
if (this.#sourceCodeTextarea && this.#sourceCodeTextarea.parentNode === container) {
652+
if (
653+
this.#sourceCodeTextarea &&
654+
this.#sourceCodeTextarea.parentNode === container
655+
) {
653656
container.insertBefore(viewer, this.#sourceCodeTextarea);
654657
} else {
655658
container.appendChild(viewer);
@@ -1904,7 +1907,8 @@ class MapmlifyLayer extends HTMLElement {
19041907
this.#sourceCodeTextarea.value = this.#serializeViewer(viewer);
19051908
// Auto-size to fit content without scrollbars
19061909
this.#sourceCodeTextarea.style.height = 'auto';
1907-
this.#sourceCodeTextarea.style.height = this.#sourceCodeTextarea.scrollHeight + 'px';
1910+
this.#sourceCodeTextarea.style.height =
1911+
this.#sourceCodeTextarea.scrollHeight + 'px';
19081912
}
19091913

19101914
#serializeViewer(viewer) {

tests/esri-imageserver.spec.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import {
99
viewerLocator,
1010
} from './helpers.js';
1111

12-
const SERVICE_URL = 'https://test.example.com/arcgis/rest/services/Elevation/ImageServer?f=json';
12+
const SERVICE_URL =
13+
'https://test.example.com/arcgis/rest/services/Elevation/ImageServer?f=json';
1314

1415
test.beforeEach(async ({ page }) => {
1516
await interceptTileRequests(page);
@@ -22,7 +23,9 @@ test.describe('ESRI ImageServer — Service Info', () => {
2223
await loadService(page, SERVICE_URL);
2324
const details = page.locator('#service-details');
2425
await expect(details).toContainText('Test Elevation Raster');
25-
await expect(page.locator('.service-type-badge')).toContainText('ImageServer');
26+
await expect(page.locator('.service-type-badge')).toContainText(
27+
'ImageServer'
28+
);
2629
});
2730

2831
test('creates single layer element', async ({ page }) => {
@@ -86,12 +89,17 @@ test.describe('ESRI ImageServer — Viewer Generation', () => {
8689
const mapLayer = viewerLocator(page, 0, 'map-layer[data-esri-layer]');
8790
const license = mapLayer.locator('map-link[rel="license"]');
8891
await expect(license).toHaveCount(1);
89-
await expect(license).toHaveAttribute('title', 'Test ImageServer Copyright');
92+
await expect(license).toHaveAttribute(
93+
'title',
94+
'Test ImageServer Copyright'
95+
);
9096
});
9197
});
9298

9399
test.describe('ESRI ImageServer — Query', () => {
94-
test('query toggle is present (Catalog/Metadata capabilities)', async ({ page }) => {
100+
test('query toggle is present (Catalog/Metadata capabilities)', async ({
101+
page,
102+
}) => {
95103
await loadService(page, SERVICE_URL);
96104
const layer = page.locator('mapmlify-layer').nth(0);
97105
await expect(layer.locator('.query-format-selector')).toHaveCount(1);

tests/esri-mapserver.spec.js

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,19 @@ import {
99
viewerLocator,
1010
} from './helpers.js';
1111

12-
const TILED_URL = 'https://test.example.com/arcgis/rest/services/Tiled/MapServer?f=json';
13-
const DYNAMIC_URL = 'https://test.example.com/arcgis/rest/services/Dynamic/MapServer?f=json';
12+
const TILED_URL =
13+
'https://test.example.com/arcgis/rest/services/Tiled/MapServer?f=json';
14+
const DYNAMIC_URL =
15+
'https://test.example.com/arcgis/rest/services/Dynamic/MapServer?f=json';
1416

1517
test.describe('ESRI MapServer (Tiled)', () => {
1618
test.beforeEach(async ({ page }) => {
1719
await interceptTileRequests(page);
18-
await routeFixture(page, '**/test.example.com/**', 'esri-mapserver-tiled.json');
20+
await routeFixture(
21+
page,
22+
'**/test.example.com/**',
23+
'esri-mapserver-tiled.json'
24+
);
1925
await page.goto('/index.html');
2026
});
2127

@@ -85,15 +91,21 @@ test.describe('ESRI MapServer (Tiled)', () => {
8591
test.describe('ESRI MapServer (Dynamic)', () => {
8692
test.beforeEach(async ({ page }) => {
8793
await interceptTileRequests(page);
88-
await routeFixture(page, '**/test.example.com/**', 'esri-mapserver-dynamic.json');
94+
await routeFixture(
95+
page,
96+
'**/test.example.com/**',
97+
'esri-mapserver-dynamic.json'
98+
);
8999
await page.goto('/index.html');
90100
});
91101

92102
test('displays service title and MapServer badge', async ({ page }) => {
93103
await loadService(page, DYNAMIC_URL);
94104
const details = page.locator('#service-details');
95105
await expect(details).toContainText('Test Dynamic MapServer');
96-
await expect(page.locator('.service-type-badge')).toContainText('ESRI MapServer');
106+
await expect(page.locator('.service-type-badge')).toContainText(
107+
'ESRI MapServer'
108+
);
97109
});
98110

99111
test('lists correct number of layers', async ({ page }) => {
@@ -122,7 +134,9 @@ test.describe('ESRI MapServer (Dynamic)', () => {
122134
expect(tref).toContain('layers=');
123135
});
124136

125-
test('location inputs present (xmin, ymin, xmax, ymax, w, h)', async ({ page }) => {
137+
test('location inputs present (xmin, ymin, xmax, ymax, w, h)', async ({
138+
page,
139+
}) => {
126140
await loadService(page, DYNAMIC_URL);
127141
await activateLayer(page, 0);
128142
const mapLayer = viewerLocator(page, 0, 'map-layer[data-esri-layer]');

tests/helpers.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ export function readFixture(filename) {
2525
* @param {string} fixtureFilename - File in tests/fixtures/
2626
* @param {string} [contentType] - Override content type (auto-detected from extension)
2727
*/
28-
export async function routeFixture(page, urlPattern, fixtureFilename, contentType) {
28+
export async function routeFixture(
29+
page,
30+
urlPattern,
31+
fixtureFilename,
32+
contentType
33+
) {
2934
const body = readFixture(fixtureFilename);
3035
if (!contentType) {
3136
contentType = fixtureFilename.endsWith('.json')

tests/service-detection.spec.js

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,20 @@ test.beforeEach(async ({ page }) => {
1414
test.describe('Service Detection — WMS', () => {
1515
test('detects WMS 1.3.0 from XML', async ({ page }) => {
1616
await routeFixture(page, '**/test.example.com/**', 'wms-130.xml');
17-
await loadService(page, 'https://test.example.com/wms?SERVICE=WMS&REQUEST=GetCapabilities');
17+
await loadService(
18+
page,
19+
'https://test.example.com/wms?SERVICE=WMS&REQUEST=GetCapabilities'
20+
);
1821
await expect(page.locator('.service-type-badge')).toContainText('WMS');
1922
await expect(getLayerElements(page)).not.toHaveCount(0);
2023
});
2124

2225
test('detects WMS 1.1.1 from XML', async ({ page }) => {
2326
await routeFixture(page, '**/test.example.com/**', 'wms-111.xml');
24-
await loadService(page, 'https://test.example.com/wms111?SERVICE=WMS&REQUEST=GetCapabilities');
27+
await loadService(
28+
page,
29+
'https://test.example.com/wms111?SERVICE=WMS&REQUEST=GetCapabilities'
30+
);
2531
await expect(page.locator('.service-type-badge')).toContainText('WMS');
2632
await expect(getLayerElements(page)).not.toHaveCount(0);
2733
});
@@ -30,29 +36,53 @@ test.describe('Service Detection — WMS', () => {
3036
test.describe('Service Detection — WMTS', () => {
3137
test('detects WMTS from XML', async ({ page }) => {
3238
await routeFixture(page, '**/test.example.com/**', 'wmts-100.xml');
33-
await loadService(page, 'https://test.example.com/wmts?SERVICE=WMTS&REQUEST=GetCapabilities');
39+
await loadService(
40+
page,
41+
'https://test.example.com/wmts?SERVICE=WMTS&REQUEST=GetCapabilities'
42+
);
3443
await expect(page.locator('.service-type-badge')).toContainText('WMTS');
3544
await expect(getLayerElements(page)).not.toHaveCount(0);
3645
});
3746
});
3847

3948
test.describe('Service Detection — ESRI', () => {
4049
test('detects ESRI MapServer (tiled) from JSON', async ({ page }) => {
41-
await routeFixture(page, '**/test.example.com/**', 'esri-mapserver-tiled.json');
42-
await loadService(page, 'https://test.example.com/arcgis/rest/services/Tiled/MapServer?f=json');
50+
await routeFixture(
51+
page,
52+
'**/test.example.com/**',
53+
'esri-mapserver-tiled.json'
54+
);
55+
await loadService(
56+
page,
57+
'https://test.example.com/arcgis/rest/services/Tiled/MapServer?f=json'
58+
);
4359
await expect(page.locator('.service-type-badge')).toContainText('Tiled');
4460
});
4561

4662
test('detects ESRI MapServer (dynamic) from JSON', async ({ page }) => {
47-
await routeFixture(page, '**/test.example.com/**', 'esri-mapserver-dynamic.json');
48-
await loadService(page, 'https://test.example.com/arcgis/rest/services/Dynamic/MapServer?f=json');
49-
await expect(page.locator('.service-type-badge')).toContainText('ESRI MapServer');
63+
await routeFixture(
64+
page,
65+
'**/test.example.com/**',
66+
'esri-mapserver-dynamic.json'
67+
);
68+
await loadService(
69+
page,
70+
'https://test.example.com/arcgis/rest/services/Dynamic/MapServer?f=json'
71+
);
72+
await expect(page.locator('.service-type-badge')).toContainText(
73+
'ESRI MapServer'
74+
);
5075
});
5176

5277
test('detects ESRI ImageServer from JSON', async ({ page }) => {
5378
await routeFixture(page, '**/test.example.com/**', 'esri-imageserver.json');
54-
await loadService(page, 'https://test.example.com/arcgis/rest/services/Elevation/ImageServer?f=json');
55-
await expect(page.locator('.service-type-badge')).toContainText('ImageServer');
79+
await loadService(
80+
page,
81+
'https://test.example.com/arcgis/rest/services/Elevation/ImageServer?f=json'
82+
);
83+
await expect(page.locator('.service-type-badge')).toContainText(
84+
'ImageServer'
85+
);
5686
});
5787
});
5888

@@ -69,12 +99,18 @@ test.describe('Edge Cases', () => {
6999
test('each service type creates layers independently', async ({ page }) => {
70100
// Load WMS first
71101
await routeFixture(page, '**/wms-service/**', 'wms-130.xml');
72-
await loadService(page, 'https://test.example.com/wms-service/?SERVICE=WMS&REQUEST=GetCapabilities');
102+
await loadService(
103+
page,
104+
'https://test.example.com/wms-service/?SERVICE=WMS&REQUEST=GetCapabilities'
105+
);
73106
await expect(getLayerElements(page)).toHaveCount(2);
74107

75108
// Now load WMTS (should replace)
76109
await routeFixture(page, '**/wmts-service/**', 'wmts-100.xml');
77-
await loadService(page, 'https://test.example.com/wmts-service/?SERVICE=WMTS&REQUEST=GetCapabilities');
110+
await loadService(
111+
page,
112+
'https://test.example.com/wmts-service/?SERVICE=WMTS&REQUEST=GetCapabilities'
113+
);
78114
await expect(page.locator('.service-type-badge')).toContainText('WMTS');
79115
});
80116
});

tests/wms-111.spec.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import {
88
viewerLocator,
99
} from './helpers.js';
1010

11-
const SERVICE_URL = 'https://test.example.com/wms111?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities';
11+
const SERVICE_URL =
12+
'https://test.example.com/wms111?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities';
1213

1314
test.beforeEach(async ({ page }) => {
1415
await interceptTileRequests(page);
@@ -61,7 +62,9 @@ test.describe('WMS 1.1.1 — Version-Specific Parameters', () => {
6162
expect(tref).not.toContain('J={j}');
6263
});
6364

64-
test('BBOX uses standard xmin,ymin,xmax,ymax order even for EPSG:4326', async ({ page }) => {
65+
test('BBOX uses standard xmin,ymin,xmax,ymax order even for EPSG:4326', async ({
66+
page,
67+
}) => {
6568
await loadService(page, SERVICE_URL);
6669
// Switch to WGS84 projection
6770
const layer = page.locator('mapmlify-layer').nth(0);

tests/wms-130.spec.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import {
99
viewerLocator,
1010
} from './helpers.js';
1111

12-
const SERVICE_URL = 'https://test.example.com/wms?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities';
12+
const SERVICE_URL =
13+
'https://test.example.com/wms?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities';
1314

1415
test.beforeEach(async ({ page }) => {
1516
await interceptTileRequests(page);
@@ -82,8 +83,14 @@ test.describe('WMS 1.3.0 — Viewer Generation', () => {
8283
);
8384
}
8485
// Size inputs
85-
await expect(extent.locator('map-input[name="w"]')).toHaveAttribute('type', 'width');
86-
await expect(extent.locator('map-input[name="h"]')).toHaveAttribute('type', 'height');
86+
await expect(extent.locator('map-input[name="w"]')).toHaveAttribute(
87+
'type',
88+
'width'
89+
);
90+
await expect(extent.locator('map-input[name="h"]')).toHaveAttribute(
91+
'type',
92+
'height'
93+
);
8794
// Click coordinate inputs
8895
await expect(extent.locator('map-input[name="i"]')).toHaveCount(1);
8996
await expect(extent.locator('map-input[name="j"]')).toHaveCount(1);

tests/wmts.spec.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import {
99
viewerLocator,
1010
} from './helpers.js';
1111

12-
const SERVICE_URL = 'https://test.example.com/wmts?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetCapabilities';
12+
const SERVICE_URL =
13+
'https://test.example.com/wmts?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetCapabilities';
1314

1415
test.beforeEach(async ({ page }) => {
1516
await interceptTileRequests(page);
@@ -85,8 +86,14 @@ test.describe('WMTS — Viewer Generation', () => {
8586
const extent = mapLayer.locator('map-extent');
8687
await expect(extent.locator('map-input[name="x"]')).toHaveCount(1);
8788
await expect(extent.locator('map-input[name="y"]')).toHaveCount(1);
88-
await expect(extent.locator('map-input[name="x"]')).toHaveAttribute('units', 'tilematrix');
89-
await expect(extent.locator('map-input[name="y"]')).toHaveAttribute('units', 'tilematrix');
89+
await expect(extent.locator('map-input[name="x"]')).toHaveAttribute(
90+
'units',
91+
'tilematrix'
92+
);
93+
await expect(extent.locator('map-input[name="y"]')).toHaveAttribute(
94+
'units',
95+
'tilematrix'
96+
);
9097
});
9198
});
9299

0 commit comments

Comments
 (0)