leaflet-rotate 0.2.7 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +21 -0
- package/README.md +5 -1
- package/build/build.js +69 -0
- package/build/dev.js +24 -0
- package/build/server.js +104 -0
- package/cucumber.mjs +5 -0
- package/dist/leaflet-rotate-src.js +1380 -1853
- package/dist/leaflet-rotate-src.js.map +7 -1
- package/dist/leaflet-rotate.js +1 -1
- package/dist/leaflet-rotate.js.map +7 -1
- package/lib/debug.js +19 -8
- package/lib/debug.min.js +1 -1
- package/misc/leaflet-heat-rotate.js +96 -0
- package/package.json +7 -14
- package/src/control/Rotate.js +5 -1
- package/src/layer/DivOverlay.js +13 -1
- package/src/layer/marker/Marker.js +16 -2
- package/src/layer/vector/Renderer.js +4 -0
- package/src/map/Map.js +62 -3
- package/src/map/handler/CompassBearing.js +5 -3
- package/src/map/handler/TouchGestures.js +8 -0
- package/test/features/example.feature +87 -0
- package/test/features/gestures.feature +33 -0
- package/test/features/overlays.feature +58 -0
- package/test/features/rotation.feature +36 -0
- package/test/steps/bearing.steps.js +235 -0
- package/test/steps/example.steps.js +363 -0
- package/test/steps/gestures.steps.js +145 -0
- package/test/steps/overlays.steps.js +427 -0
- package/test/support/hooks.js +44 -0
- package/build/rollup.config.js +0 -34
- package/test/setup/http_server.js +0 -86
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { suite as uvu_suite } from 'uvu';
|
|
2
|
-
import { exec } from 'child_process';
|
|
3
|
-
import { chromium } from 'playwright';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Start HTTP server
|
|
7
|
-
*/
|
|
8
|
-
export async function setup(ctx) {
|
|
9
|
-
ctx.server = new AbortController();
|
|
10
|
-
exec('http-server', { signal: ctx.server.signal });
|
|
11
|
-
ctx.localhost = 'http://localhost:8080';
|
|
12
|
-
ctx.browser = await chromium.launch();
|
|
13
|
-
ctx.context = await ctx.browser.newContext();
|
|
14
|
-
ctx.context.route(/.html$/, mock_cdn_urls);
|
|
15
|
-
ctx.page = await ctx.context.newPage();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Stop HTTP server
|
|
20
|
-
*/
|
|
21
|
-
export async function reset(ctx) {
|
|
22
|
-
await ctx.context.close();
|
|
23
|
-
await ctx.browser.close();
|
|
24
|
-
try { ctx.server.abort(); } catch(e) { }
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Sample wrapper for uvu `suite`
|
|
29
|
-
*
|
|
30
|
-
* @example start a new test session at: http://localhost:8080/examples/leaflet-rotate.html
|
|
31
|
-
*
|
|
32
|
-
* ```js
|
|
33
|
-
* const test = suite('examples/leaflet-rotate.html');
|
|
34
|
-
*
|
|
35
|
-
* test('rotatePane', async ({ page }) => {
|
|
36
|
-
* const rotatePane = await page.evaluate(() => new Promise(resolve => {
|
|
37
|
-
* resolve(map._rotatePane)
|
|
38
|
-
* }));
|
|
39
|
-
* assert.not.type(rotatePane, 'undefined');
|
|
40
|
-
* });
|
|
41
|
-
* ```
|
|
42
|
-
*
|
|
43
|
-
* @see https://github.com/lukeed/uvu
|
|
44
|
-
*/
|
|
45
|
-
export function suite() {
|
|
46
|
-
const test = uvu_suite(...arguments);
|
|
47
|
-
test.before(setup);
|
|
48
|
-
test.after(reset);
|
|
49
|
-
test.before.each(async ({ localhost, page }) => {
|
|
50
|
-
await page.goto((new URL(arguments[0], localhost)).toString());
|
|
51
|
-
});
|
|
52
|
-
// augment uvu `test` function with a third parameter `timeout`
|
|
53
|
-
return new Proxy(test, {
|
|
54
|
-
apply: (object, _, argsList) => {
|
|
55
|
-
return object(argsList[0], timeout(argsList[1], argsList[2]));
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Sets maximum execution time for a function
|
|
62
|
-
*
|
|
63
|
-
* @see https://github.com/lukeed/uvu/issues/33#issuecomment-879870292
|
|
64
|
-
*/
|
|
65
|
-
function timeout(handler, ms=10000) {
|
|
66
|
-
return (ctx) => {
|
|
67
|
-
let timer
|
|
68
|
-
return Promise.race([
|
|
69
|
-
handler(ctx),
|
|
70
|
-
new Promise((_, reject) => { timer = setTimeout(() => reject(new Error('[TIMEOUT] Maximum execution time exceeded: ' + ms + 'ms')), ms) })
|
|
71
|
-
]).finally(() => { clearTimeout(timer) })
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Replace CDN URLs with locally developed files within Network response.
|
|
77
|
-
*
|
|
78
|
-
* @requires playwright
|
|
79
|
-
*/
|
|
80
|
-
async function mock_cdn_urls(route) {
|
|
81
|
-
const response = await route.fetch();
|
|
82
|
-
let body = await response.text();
|
|
83
|
-
body = body.replace(new RegExp('https://unpkg.com/leaflet-rotate@(.*?)/', 'g'), '../');
|
|
84
|
-
body = body.replace(new RegExp('leaflet-rotate@(.*?)/', 'g'), '../');
|
|
85
|
-
route.fulfill({ response, body, headers: response.headers() });
|
|
86
|
-
}
|