-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- #61
- Loading branch information
Showing
3 changed files
with
60 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Map, ZoomControl } from "react-kakao-maps-sdk" | ||
import useKakaoLoader from "./useKakaoLoader" | ||
import { useState } from "react" | ||
|
||
export default function AddMapZoomChangedEvent() { | ||
useKakaoLoader() | ||
const [result, setResult] = useState("") | ||
|
||
return ( | ||
<> | ||
<Map // 지도를 표시할 Container | ||
id="map" | ||
center={{ | ||
// 지도의 중심좌표 | ||
lat: 33.450701, | ||
lng: 126.570667, | ||
}} | ||
style={{ | ||
width: "100%", | ||
height: "350px", | ||
}} | ||
level={3} // 지도의 확대 레벨 | ||
onZoomChanged={(map) => { | ||
const level = map.getLevel() | ||
setResult(`현재 지도 레벨은 ${level} 입니다`) | ||
}} | ||
> | ||
<ZoomControl /> | ||
</Map> | ||
<p> | ||
<em>지도를 확대 또는 축소 해주세요!</em> | ||
</p> | ||
<p id="result">{result}</p> | ||
</> | ||
) | ||
} |
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
21 changes: 21 additions & 0 deletions
21
packages/react-kakao-maps-sdk/__test__/addMapZoomChangedEvent.spec.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,21 @@ | ||
import { test, expect } from "@playwright/test" | ||
import { getTestUrl, waitNetworkIdleWithTimeout } from "./util" | ||
|
||
test("ScreenShot 렌더링 결과 비교", async ({ page }, testInfo) => { | ||
const url = getTestUrl( | ||
"addMapZoomChangedEvent", | ||
testInfo.config.updateSnapshots === "all", | ||
) | ||
await page.goto(url, { waitUntil: "networkidle" }) | ||
await waitNetworkIdleWithTimeout(page) | ||
await expect(page).toHaveScreenshot() | ||
|
||
await page.getByTitle("확대").click() | ||
await expect(page.locator("#result")).toHaveText("현재 지도 레벨은 2 입니다") | ||
|
||
await page.getByTitle("축소").click() | ||
await waitNetworkIdleWithTimeout(page) | ||
await page.getByTitle("축소").click() | ||
await waitNetworkIdleWithTimeout(page) | ||
await expect(page.locator("#result")).toHaveText("현재 지도 레벨은 4 입니다") | ||
}) |