-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* feat: Create Google Map web component
- Loading branch information
1 parent
4f1a064
commit 50a8162
Showing
41 changed files
with
2,021 additions
and
195 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testPathIgnorePatterns: ['<rootDir>/src/scripts'], | ||
setupFiles: ['<rootDir>/../../scripts/jest/jest-setup.js'], | ||
collectCoverageFrom: ['<rootDir>/src/**/*.ts', '<rootDir>/src/**/*.svelte'], | ||
coverageDirectory: './src/tests/coverage', | ||
coveragePathIgnorePatterns: ['<rootDir>[/\\\\](node_modules|src/types|src/tests|src/scripts)[/\\\\]'], | ||
transformIgnorePatterns: ['[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$'], | ||
modulePathIgnorePatterns: ['<rootDir>[/\\\\](node_modules|poc-archive)[/\\\\]'], | ||
moduleNameMapper: { | ||
'^.+.(?=.*scss|sass|css|png|jpg).*': '<rootDir>/../../scripts/jest/css-stub.js', | ||
}, | ||
moduleFileExtensions: ['js','ts', 'svelte'], | ||
moduleFileExtensions: ['js', 'ts', 'svelte'], | ||
coverageThreshold: { | ||
global: { | ||
branches: 60, | ||
functions: 90, | ||
lines: 98, | ||
statements: 97, | ||
branches: 75, | ||
functions: 85, | ||
lines: 95, | ||
statements: 95, | ||
}, | ||
}, | ||
transform: { | ||
'^.+\\.svg$': '<rootDir>/../../scripts/jest/svg-transform.js', | ||
'^.+\\.svelte$': ['svelte-jester', { "preprocess": true }], | ||
'^.+\\.svelte$': 'svelte-jester', | ||
}, | ||
coverageReporters: ['json-summary', 'text', 'lcov'], | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,4 +28,4 @@ | |
}) | ||
</script> | ||
</body> | ||
</html> | ||
</html> |
16 changes: 16 additions & 0 deletions
16
packages/web-components/src/common/utils/__tests__/loader.ts
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,16 @@ | ||
import { loader } from '../loader' | ||
|
||
describe('loader utils', () => { | ||
it('should return correctly', () => { | ||
document.body.innerHTML = '<html></html>' | ||
const url = '//maps.googleapis.com/maps/api/js?key=API_KEY&libraries=places&callback=onMapReady' | ||
const callback = jest.fn() | ||
loader(url, callback) | ||
const tags = document.getElementsByTagName('script') | ||
expect(tags.length).toBe(1) | ||
expect(tags[0].hasAttribute('src')).toEqual(true) | ||
expect(tags[0].src).toEqual( | ||
'http://maps.googleapis.com/maps/api/js?key=API_KEY&libraries=places&callback=onMapReady', | ||
) | ||
}) | ||
}) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export const loader = (url: string, callback: () => {}, options = { async: true, defer: true }) => { | ||
const tag = document.createElement('script') | ||
tag.src = url | ||
tag.async = options.async | ||
tag.defer = options.defer | ||
tag.onload = callback | ||
document.body.appendChild(tag) | ||
} |
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
13 changes: 13 additions & 0 deletions
13
...components/src/search-widget/client/components/__tests__/__snapshots__/google-map.ts.snap
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,13 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`google map it matches a snapshot 1`] = ` | ||
<body> | ||
<div> | ||
<div | ||
class="map-wrap svelte-1nt7ax3" | ||
> | ||
</div> | ||
</div> | ||
</body> | ||
`; |
7 changes: 7 additions & 0 deletions
7
...web-components/src/search-widget/client/components/__tests__/__snapshots__/marker.ts.snap
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,7 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Marker it matches a snapshot 1`] = ` | ||
<body> | ||
<div /> | ||
</body> | ||
`; |
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
121 changes: 121 additions & 0 deletions
121
...ponents/src/search-widget/client/components/__tests__/__snapshots__/search-result.ts.snap
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,121 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`SearchResult it matches a snapshot 1`] = ` | ||
<body> | ||
<div> | ||
<div | ||
class="result-item svelte-1r3rfgm" | ||
data-testid="select-property" | ||
> | ||
<div | ||
class="result-image-container selected svelte-1r3rfgm" | ||
> | ||
<img | ||
alt="property image" | ||
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mN88xYAAssB20Ea4T8AAAAASUVORK5CYII=" | ||
/> | ||
</div> | ||
<div> | ||
<div | ||
class="result-item-address-secondary svelte-1r3rfgm" | ||
> | ||
<div | ||
class="result-item-address-primary svelte-1r3rfgm" | ||
> | ||
Sussex Way | ||
</div> | ||
Archway, London, N19 4JF | ||
</div> | ||
</div> | ||
<div | ||
class="result-item-pricing-text svelte-1r3rfgm" | ||
> | ||
Guide Price £0 | ||
</div> | ||
<div | ||
class="result-item-beds-text svelte-1r3rfgm" | ||
> | ||
0 Bed | ||
</div> | ||
<div | ||
class="result-item-description-text svelte-1r3rfgm" | ||
> | ||
This is a flat | ||
</div> | ||
<div | ||
class="result-item-icon-container svelte-1r3rfgm" | ||
> | ||
<span | ||
class="result-item-icon svelte-1r3rfgm" | ||
> | ||
<svg | ||
aria-hidden="true" | ||
class="" | ||
id="" | ||
role="img" | ||
style="height:1em;vertical-align:-.125em;overflow:visible;" | ||
viewBox="0 0 640 512" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<g | ||
transform="translate(256 256)" | ||
> | ||
<g | ||
transform="" | ||
> | ||
<path | ||
d="M176 256c44.11 0 80-35.89 80-80s-35.89-80-80-80-80 35.89-80 80 35.89 80 80 80zm352-128H304c-8.84 0-16 7.16-16 16v144H64V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v352c0 8.84 7.16 16 16 16h32c8.84 0 16-7.16 16-16v-48h512v48c0 8.84 7.16 16 16 16h32c8.84 0 16-7.16 16-16V240c0-61.86-50.14-112-112-112z" | ||
fill="currentColor" | ||
transform="translate(-256 -256)" | ||
/> | ||
</g> | ||
</g> | ||
</svg> | ||
</span> | ||
0 | ||
<span | ||
class="result-item-icon svelte-1r3rfgm" | ||
> | ||
<svg | ||
aria-hidden="true" | ||
class="" | ||
id="" | ||
role="img" | ||
style="height:1em;vertical-align:-.125em;overflow:visible;" | ||
viewBox="0 0 384 512" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<g | ||
transform="translate(256 256)" | ||
> | ||
<g | ||
transform="" | ||
> | ||
<path | ||
d="M368 48c8.8 0 16-7.2 16-16V16c0-8.8-7.2-16-16-16H16C7.2 0 0 7.2 0 16v16c0 8.8 7.2 16 16 16h16v156.7C11.8 214.8 0 226.9 0 240c0 67.2 34.6 126.2 86.8 160.5l-21.4 70.2C59.1 491.2 74.5 512 96 512h192c21.5 0 36.9-20.8 30.6-41.3l-21.4-70.2C349.4 366.2 384 307.2 384 240c0-13.1-11.8-25.2-32-35.3V48h16zM80 72c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v16c0 4.4-3.6 8-8 8H88c-4.4 0-8-3.6-8-8V72zm112 200c-77.1 0-139.6-14.3-139.6-32s62.5-32 139.6-32 139.6 14.3 139.6 32-62.5 32-139.6 32z" | ||
fill="currentColor" | ||
transform="translate(-256 -256)" | ||
/> | ||
</g> | ||
</g> | ||
</svg> | ||
</span> | ||
0 | ||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
`; |
Oops, something went wrong.