-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Psp 9943 highway layer url display (#4667)
* psp-9813 ensure error messages from backend display properly. * psp-9943 show hyperlink for highway layer popup. * support multiple highway layer properties at the same click location. --------- Co-authored-by: Alejandro Sanchez <[email protected]>
- Loading branch information
1 parent
cc2e364
commit 406d872
Showing
23 changed files
with
1,174 additions
and
69 deletions.
There are no files selected for viewing
This file contains 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 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 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
58 changes: 58 additions & 0 deletions
58
source/frontend/src/components/maps/leaflet/LayerPopup/LayerPopupContainer.test.tsx
This file contains 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,58 @@ | ||
import { screen } from '@testing-library/react'; | ||
import { describe, it, expect, vi } from 'vitest'; | ||
import { LayerPopupContainer } from './LayerPopupContainer'; | ||
import { IMapStateMachineContext } from '@/components/common/mapFSM/MapStateMachineContext'; | ||
import { render } from '@/utils/test-utils'; | ||
import { mapMachineBaseMock } from '@/mocks/mapFSM.mock'; | ||
import { getMockLocationFeatureDataset } from '@/mocks/featureset.mock'; | ||
import getMockISSResult from '@/mocks/mockISSResult'; | ||
import { Popup } from 'react-leaflet/Popup'; | ||
|
||
const mockMapStateMachine = { | ||
...mapMachineBaseMock, | ||
mapLocationFeatureDataset: getMockLocationFeatureDataset(), | ||
}; | ||
|
||
vi.mock('react-leaflet/Popup', () => ({ | ||
Popup: ({ children }: any) => <>{children}</>, | ||
})); | ||
|
||
describe('LayerPopupContainer', () => { | ||
beforeEach(() => { | ||
vi.resetAllMocks(); | ||
}); | ||
|
||
const setup = (context?: IMapStateMachineContext) => { | ||
return render(<LayerPopupContainer />, { mockMapMachine: context ?? mockMapStateMachine }); | ||
}; | ||
|
||
it('matches snapshot', () => { | ||
const { asFragment } = setup(); | ||
expect(asFragment()).toMatchSnapshot(); | ||
}); | ||
|
||
it('displays the correct title for parcel data', () => { | ||
setup(); | ||
expect(screen.getByText('LTSA ParcelMap data')).toBeInTheDocument(); | ||
}); | ||
|
||
it('displays multiple highway layers correctly', () => { | ||
setup({ | ||
...mapMachineBaseMock, | ||
mapLocationFeatureDataset: { | ||
...getMockLocationFeatureDataset(), | ||
pimsFeature: null, | ||
parcelFeature: null, | ||
municipalityFeature: null, | ||
highwayFeatures: getMockISSResult().features, | ||
}, | ||
}); | ||
expect(screen.getByText('Highway Research (1 of 2)')).toBeInTheDocument(); | ||
expect(screen.getByText('Hyperlink to plan documents:')).toBeInTheDocument(); | ||
expect( | ||
screen.getByText( | ||
'https://bcgov.sharepoint.com/teams/01157/Shared Documents/General/LTSA Packages/RS 4284_VIP2490RW', | ||
), | ||
).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains 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 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
Oops, something went wrong.