-
Notifications
You must be signed in to change notification settings - Fork 393
Change leaflet map background color #7718
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
+112
−19
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
138ac4c
Set leaflet container background color from base map settings.
na9da c5b7560
Update all base map definition traits.
na9da 16d5439
Fix type.
na9da db96340
Fix import.
na9da 5862486
Inject style only if backgroundColor is specified.
na9da 22daa9e
Add specs.
na9da 09a7dca
Use a hook and ref to set container background instead of global style.
na9da ffb5716
Update CHANGES.md.
na9da 1cf5398
Merge branch 'main' into leaflet-background
na9da 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
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
48 changes: 48 additions & 0 deletions
48
test/ReactViews/Map/TerriaViewerWrapper/TerriaViewerWrapperSpec.tsx
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,48 @@ | ||
| import { screen } from "@testing-library/react"; | ||
| import { runInAction } from "mobx"; | ||
| import CommonStrata from "../../../../lib/Models/Definition/CommonStrata"; | ||
| import Terria from "../../../../lib/Models/Terria"; | ||
| import ViewerMode from "../../../../lib/Models/ViewerMode"; | ||
| import ViewState from "../../../../lib/ReactViewModels/ViewState"; | ||
| import { TerriaViewerWrapper } from "../../../../lib/ReactViews/Map/TerriaViewerWrapper"; | ||
| import { renderWithContexts } from "../../withContext"; | ||
|
|
||
| describe("TerriaViewerWrapper", function () { | ||
| let viewState: ViewState; | ||
| let terria: Terria; | ||
|
|
||
| beforeEach(function () { | ||
| terria = new Terria(); | ||
| viewState = new ViewState({ terria, catalogSearchProvider: undefined }); | ||
| }); | ||
|
|
||
| describe("when main viewer is in leaflet mode", function () { | ||
| beforeEach(function () { | ||
| runInAction(() => { | ||
| terria.mainViewer.viewerMode = ViewerMode.Leaflet; | ||
| }); | ||
| }); | ||
|
|
||
| it("sets container background if the active base map specifies a backgroundColor", async function () { | ||
| terria.baseMapsModel.loadFromJson(CommonStrata.user, { | ||
| items: [ | ||
| { | ||
| item: { | ||
| id: "test-basemap", | ||
| type: "url-template-imagery" | ||
| }, | ||
| backgroundColor: "lime" | ||
| } | ||
| ] | ||
| }); | ||
| await terria.mainViewer.setBaseMap( | ||
| terria.baseMapsModel.baseMapItems[0].item | ||
| ); | ||
|
|
||
| renderWithContexts(<TerriaViewerWrapper />, viewState); | ||
| const container = screen.queryByTestId("mapContainer"); | ||
| console.log(container?.dataset, container?.classList); | ||
| expect(container).toHaveStyle(`background-color: rgb(0, 255, 0)`); | ||
| }); | ||
| }); | ||
| }); |
Oops, something went wrong.
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.
Actual (non-prettier) change is this line which updates all traits from the new definition instead of just the
imagetrait.