-
Notifications
You must be signed in to change notification settings - Fork 16
fix for issue-319 #993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
fix for issue-319 #993
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3da82e9
Yushan commit fix line endings.
prushforth fea5707
Added test cases for unnamed layers (flaky atm)
yushan-mu b31f77b
Added timeout
yushan-mu 4be0be4
Added 500ms timeout
yushan-mu e72b14b
Cleaned up some parts
be36044
Edited formatting
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
|
|
||
| <head> | ||
| <meta charset="utf-8"> | ||
| <meta name="viewport" content="width=device-width,initial-scale=1"> | ||
| <title>Layer Control Tests</title> | ||
| <script type="module" src="mapml.js"></script> | ||
| <style> | ||
| html, | ||
| body { | ||
| height: 100%; | ||
| } | ||
|
|
||
| * { | ||
| margin: 0; | ||
| padding: 0; | ||
| } | ||
|
|
||
| /* Specifying the `:defined` selector is recommended to style the map | ||
| element, such that styles don't apply when fallback content is in use | ||
| (e.g. when scripting is disabled or when custom/built-in elements isn't | ||
| supported in the browser). */ | ||
| mapml-viewer:defined { | ||
| /* Responsive map. */ | ||
| max-width: 100%; | ||
|
|
||
| /* Full viewport. */ | ||
| width: 100%; | ||
| height: 100%; | ||
|
|
||
| /* Remove default (native-like) border. */ | ||
| /* border: none; */ | ||
| } | ||
|
|
||
| /* Pre-style to avoid FOUC of inline layer- and fallback content. */ | ||
| mapml-viewer:not(:defined)>* { | ||
| display: none; | ||
| } | ||
|
|
||
| /* Ensure inline layer content is hidden if custom/built-in elements isn't | ||
| supported, or if javascript is disabled. This needs to be defined separately | ||
| from the above, because the `:not(:defined)` selector invalidates the entire | ||
| declaration in browsers that do not support it. */ | ||
| layer- { | ||
| display: none; | ||
| } | ||
| </style> | ||
| <noscript> | ||
| <style> | ||
| /* Ensure fallback content (children of the map element) is displayed if | ||
| custom/built-in elements is supported but javascript is disabled. */ | ||
| mapml-viewer:not(:defined)> :not(layer-) { | ||
| display: initial; | ||
| } | ||
| </style> | ||
| </noscript> | ||
| </head> | ||
|
|
||
| <body> | ||
| <mapml-viewer projection="CBMTILE" zoom="3" lat="37.176710163979834" lon="-62.070013924549045" controls> | ||
|
|
||
| <!-- Layer without a label --> | ||
| <layer- checked> | ||
| <map-meta name="projection" content="CBMTILE"></map-meta> | ||
| <map-feature zoom="10"> | ||
| <map-properties>Layer with no label</map-properties> | ||
| <map-geometry cs="gcrs"> | ||
| <map-point> | ||
| <map-coordinates>-75.866089 45.463020</map-coordinates> | ||
| </map-point> | ||
| </map-geometry> | ||
| </map-feature> | ||
| </layer-> | ||
|
|
||
| </mapml-viewer> | ||
| </body> | ||
|
|
||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import { test, expect, chromium } from '@playwright/test'; | ||
|
|
||
| test.describe('Layer Label Tests', () => { | ||
|
|
||
| let page; | ||
| let context; | ||
| test.beforeAll(async function () { | ||
| context = await chromium.launchPersistentContext(''); | ||
| page = | ||
| context.pages().find((page) => page.url() === 'about:blank') || | ||
| (await context.newPage()); | ||
| await page.goto('layerLabel.html'); | ||
| }); | ||
|
|
||
| test.afterAll(async function () { | ||
| await context.close(); | ||
| }); | ||
|
|
||
| test('Name of unnamed layer is Layer', async () => { | ||
| const map = await page.locator('body > mapml-viewer'); | ||
| await map.evaluate((map) => | ||
| map.querySelector('layer-').removeAttribute('hidden') | ||
| ); | ||
|
|
||
| const label = await page.locator( | ||
| 'body > mapml-viewer > layer-' | ||
| ); | ||
| expect(await label.evaluate(elem => elem.label)).toEqual('Layer'); | ||
| }); | ||
|
|
||
| test('Unnamed layer shows up as Layer in layer control', async () => { | ||
| const text = await page.locator( | ||
| 'body > mapml-viewer >> css=div > label.mapml-layer-item-toggle' | ||
| ); | ||
| expect(await text.evaluate(text => text.textContent)).toEqual('Layer'); | ||
| }); | ||
| }); | ||
|
|
||
| // to do: check that the thing's name is 'Layer' | ||
| // check that the thing on the layer control panel shows 'Layer' | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed, as the layer does not have a "hidden" attribute, I think we copied this over from a previous test.