@m3ui-vue/m3ui-vue 1.6.2 → 1.7.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/dist/API.md +649 -28
- package/dist/{MButton-OQ4wIERQ.js → MButton-CN3wYwIG.js} +2 -2
- package/dist/{MButton-OQ4wIERQ.js.map → MButton-CN3wYwIG.js.map} +1 -1
- package/dist/{MColorPickerModal-NtkihoK6.js → MColorPickerModal-BKM1CHxr.js} +4 -4
- package/dist/{MColorPickerModal-NtkihoK6.js.map → MColorPickerModal-BKM1CHxr.js.map} +1 -1
- package/dist/{MDialog-DYMnaBlt.js → MDialog-1LAk9WAO.js} +2 -2
- package/dist/{MDialog-DYMnaBlt.js.map → MDialog-1LAk9WAO.js.map} +1 -1
- package/dist/{MListItem-D2cNUyzP.js → MListItem-BU5KDRCB.js} +376 -270
- package/dist/MListItem-BU5KDRCB.js.map +1 -0
- package/dist/{MLoadingIndicator-DWUj0BAB.js → MLoadingIndicator-RykOo5tf.js} +2 -2
- package/dist/{MLoadingIndicator-DWUj0BAB.js.map → MLoadingIndicator-RykOo5tf.js.map} +1 -1
- package/dist/{MSeekBar-C4cn9RIF.js → MSeekBar-B_Y3MpVz.js} +2 -2
- package/dist/{MSeekBar-C4cn9RIF.js.map → MSeekBar-B_Y3MpVz.js.map} +1 -1
- package/dist/MSegmentedButton-CiOOY1-N.js +105 -0
- package/dist/MSegmentedButton-CiOOY1-N.js.map +1 -0
- package/dist/MSlider-BCeVIxcq.js +739 -0
- package/dist/MSlider-BCeVIxcq.js.map +1 -0
- package/dist/{MSpinner-DZkXZJpc.js → MSpinner-Cs03qoqE.js} +2 -2
- package/dist/{MSpinner-DZkXZJpc.js.map → MSpinner-Cs03qoqE.js.map} +1 -1
- package/dist/{MTextField-CNH-byir.js → MTextField-NaFbMkjv.js} +162 -115
- package/dist/MTextField-NaFbMkjv.js.map +1 -0
- package/dist/_useFieldValidation-Bz34IAQY.js +191 -0
- package/dist/_useFieldValidation-Bz34IAQY.js.map +1 -0
- package/dist/api.json +1 -1
- package/dist/code-editor.js +184 -103
- package/dist/code-editor.js.map +1 -1
- package/dist/components/MAddressField.vue.d.ts +18 -3
- package/dist/components/MAppBarWithSearch.vue.d.ts +1 -1
- package/dist/components/MAudioRecorder.vue.d.ts +2 -2
- package/dist/components/MAutocomplete.vue.d.ts +22 -3
- package/dist/components/MCheckbox.vue.d.ts +23 -1
- package/dist/components/MCodeEditor.vue.d.ts +23 -1
- package/dist/components/MColorPicker.vue.d.ts +24 -3
- package/dist/components/MConfirmDialog.vue.d.ts +2 -2
- package/dist/components/MCountrySelect.vue.d.ts +13 -2
- package/dist/components/MCreditCardInput.vue.d.ts +33 -0
- package/dist/components/MCronField.vue.d.ts +23 -1
- package/dist/components/MDataTable.vue.d.ts +1 -1
- package/dist/components/MDatePicker.vue.d.ts +24 -3
- package/dist/components/MDateRangePicker.vue.d.ts +24 -3
- package/dist/components/MFileUpload.vue.d.ts +23 -2
- package/dist/components/MForm.vue.d.ts +61 -0
- package/dist/components/MJsonEditor.vue.d.ts +23 -1
- package/dist/components/MMapRoute.vue.d.ts +168 -0
- package/dist/components/MMaskField.vue.d.ts +20 -2
- package/dist/components/MMentionField.vue.d.ts +13 -2
- package/dist/components/MMultiAutocomplete.vue.d.ts +22 -3
- package/dist/components/MMultiSelect.vue.d.ts +22 -3
- package/dist/components/MNavigationRail.vue.d.ts +1 -1
- package/dist/components/MNotificationCenter.vue.d.ts +2 -2
- package/dist/components/MNumberField.vue.d.ts +20 -2
- package/dist/components/MPhoneInput.vue.d.ts +19 -4
- package/dist/components/MPinInput.vue.d.ts +24 -3
- package/dist/components/MPosKeypad.vue.d.ts +2 -2
- package/dist/components/MRadioGroup.vue.d.ts +23 -1
- package/dist/components/MRating.vue.d.ts +23 -1
- package/dist/components/MRichTextEditor.vue.d.ts +23 -1
- package/dist/components/MSearchBar.vue.d.ts +1 -1
- package/dist/components/MSegmentedButton.vue.d.ts +23 -2
- package/dist/components/MSelect.vue.d.ts +22 -3
- package/dist/components/MSignaturePad.vue.d.ts +19 -0
- package/dist/components/MSlider.vue.d.ts +23 -1
- package/dist/components/MSwitch.vue.d.ts +23 -1
- package/dist/components/MTable.vue.d.ts +1 -1
- package/dist/components/MTagInput.vue.d.ts +20 -2
- package/dist/components/MText.vue.d.ts +1 -1
- package/dist/components/MTextField.vue.d.ts +26 -3
- package/dist/components/MTimePicker.vue.d.ts +24 -3
- package/dist/components/MTimezoneSelect.vue.d.ts +13 -2
- package/dist/components/MTour.vue.d.ts +2 -2
- package/dist/components/MTrackingTimeline.vue.d.ts +75 -0
- package/dist/components/MWindow.vue.d.ts +2 -2
- package/dist/composables/_routeGeometry.d.ts +26 -0
- package/dist/composables/_useFieldValidation.d.ts +91 -0
- package/dist/composables/mapRouting.d.ts +35 -0
- package/dist/composables/useLocale.d.ts +23 -0
- package/dist/composables/validation.d.ts +82 -0
- package/dist/draw.js +2 -2
- package/dist/flow.js +1 -1
- package/dist/gantt.js +2 -2
- package/dist/index.d.ts +5 -0
- package/dist/locales/index.js +154 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +6768 -5602
- package/dist/m3ui.js.map +1 -1
- package/dist/map.d.ts +4 -0
- package/dist/map.js +1230 -784
- package/dist/map.js.map +1 -1
- package/dist/media.js +4 -4
- package/dist/pdf.js +4 -4
- package/dist/rich-text-editor.js +189 -146
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/{useLocale-DaVSTdm0.js → useLocale-Dh1xZZ8i.js} +22 -1
- package/dist/useLocale-Dh1xZZ8i.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/MForm.test.ts +325 -0
- package/src/__tests__/MMapRoute.test.ts +384 -0
- package/src/__tests__/MPhoneInput.test.ts +5 -2
- package/src/__tests__/MRichTextEditor.test.ts +2 -1
- package/src/__tests__/MTrackingTimeline.test.ts +66 -0
- package/src/__tests__/_fakeMaplibre.ts +4 -1
- package/src/__tests__/_osrmRoutes.ts +10 -0
- package/src/__tests__/attrsFallthrough.test.ts +11 -0
- package/src/__tests__/fieldsValidation.test.ts +229 -0
- package/src/__tests__/ssr.test.ts +1 -0
- package/src/__tests__/validation.test.ts +77 -0
- package/src/components/MAddressField.vue +45 -8
- package/src/components/MAutocomplete.vue +69 -23
- package/src/components/MCheckbox.vue +80 -17
- package/src/components/MCodeEditor.vue +59 -2
- package/src/components/MColorPicker.vue +65 -16
- package/src/components/MCountrySelect.vue +17 -3
- package/src/components/MCreditCardInput.vue +76 -7
- package/src/components/MCronField.vue +60 -10
- package/src/components/MDatePicker.vue +65 -16
- package/src/components/MDateRangePicker.vue +66 -16
- package/src/components/MFileUpload.vue +71 -8
- package/src/components/MForm.vue +208 -0
- package/src/components/MJsonEditor.vue +57 -3
- package/src/components/MMapRoute.vue +470 -0
- package/src/components/MMaskField.vue +55 -13
- package/src/components/MMentionField.vue +17 -2
- package/src/components/MMultiAutocomplete.vue +70 -23
- package/src/components/MMultiSelect.vue +70 -23
- package/src/components/MNumberField.vue +58 -16
- package/src/components/MPhoneInput.vue +60 -18
- package/src/components/MPinInput.vue +58 -10
- package/src/components/MRadioGroup.vue +65 -4
- package/src/components/MRating.vue +62 -6
- package/src/components/MRichTextEditor.vue +64 -4
- package/src/components/MSegmentedButton.vue +59 -2
- package/src/components/MSelect.vue +72 -26
- package/src/components/MSignaturePad.vue +71 -6
- package/src/components/MSlider.vue +61 -10
- package/src/components/MSwitch.vue +63 -8
- package/src/components/MTagInput.vue +67 -25
- package/src/components/MTextField.vue +68 -14
- package/src/components/MTimePicker.vue +65 -16
- package/src/components/MTimezoneSelect.vue +17 -3
- package/src/components/MTrackingTimeline.vue +257 -0
- package/src/composables/_routeGeometry.ts +140 -0
- package/src/composables/_useFieldValidation.ts +287 -0
- package/src/composables/mapRouting.ts +55 -0
- package/src/composables/useLocale.ts +46 -0
- package/src/composables/validation.ts +178 -0
- package/src/index.ts +5 -0
- package/src/locales/de.ts +21 -0
- package/src/locales/es.ts +28 -7
- package/src/locales/fr.ts +21 -0
- package/src/locales/ja.ts +21 -0
- package/src/locales/ko.ts +21 -0
- package/src/locales/pt.ts +21 -0
- package/src/locales/zh.ts +21 -0
- package/src/map.ts +4 -0
- package/dist/MListItem-D2cNUyzP.js.map +0 -1
- package/dist/MSegmentedButton-BEB4gXLA.js +0 -64
- package/dist/MSegmentedButton-BEB4gXLA.js.map +0 -1
- package/dist/MSlider-BIkA6DiE.js +0 -690
- package/dist/MSlider-BIkA6DiE.js.map +0 -1
- package/dist/MTextField-CNH-byir.js.map +0 -1
- package/dist/useLocale-DaVSTdm0.js.map +0 -1
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
2
|
+
import { flushPromises, mount } from '@vue/test-utils'
|
|
3
|
+
import { h, nextTick, ref } from 'vue'
|
|
4
|
+
import { created, type FakeMap } from './_fakeMaplibre'
|
|
5
|
+
import { bearing, bounds, cumulative, pointAlong, project, projectForward, slicePath } from '../composables/_routeGeometry'
|
|
6
|
+
import { roundabout, roundTrip, costanera, roundaboutMeta } from './_osrmRoutes'
|
|
7
|
+
import { pathLength } from '../composables/_mapGeometry'
|
|
8
|
+
import type { LngLat } from '../composables/_mapGeometry'
|
|
9
|
+
|
|
10
|
+
vi.mock('maplibre-gl', async () => (await import('./_fakeMaplibre')).fakeModule)
|
|
11
|
+
|
|
12
|
+
const { MMap, MMapRoute, osrmRouteProvider } = await import('../map')
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
created.maps = []
|
|
16
|
+
created.markers = []
|
|
17
|
+
created.popups = []
|
|
18
|
+
document.documentElement.style.setProperty('--color-primary', '#6750a4')
|
|
19
|
+
document.documentElement.style.setProperty('--color-outline', '#79747e')
|
|
20
|
+
document.documentElement.style.setProperty('--color-surface', '#fef7ff')
|
|
21
|
+
// Reduced motion: moves jump, so tests don't wait for frames
|
|
22
|
+
vi.stubGlobal('matchMedia', (q: string) => ({ matches: q.includes('reduce'), addEventListener() {}, removeEventListener() {} }))
|
|
23
|
+
})
|
|
24
|
+
afterEach(() => {
|
|
25
|
+
document.body.innerHTML = ''
|
|
26
|
+
vi.unstubAllGlobals()
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
// An L: 1 km-ish east, then north
|
|
30
|
+
const path: LngLat[] = [[-64.19, -31.42], [-64.18, -31.42], [-64.18, -31.41]]
|
|
31
|
+
|
|
32
|
+
describe('route geometry', () => {
|
|
33
|
+
const cum = cumulative(path)
|
|
34
|
+
|
|
35
|
+
it('accumulates distances and matches the path length', () => {
|
|
36
|
+
expect(cum[0]).toBe(0)
|
|
37
|
+
expect(cum[2]).toBeCloseTo(pathLength(path), 6)
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
it('walks along the path, with the heading of each leg', () => {
|
|
41
|
+
const half = pointAlong(path, cum, cum[1]! / 2)
|
|
42
|
+
expect(half.lngLat[0]).toBeCloseTo(-64.185, 6)
|
|
43
|
+
expect(half.bearing).toBeCloseTo(90, 0) // east
|
|
44
|
+
expect(pointAlong(path, cum, cum[1]! + 1).bearing).toBeCloseTo(0, 0) // north
|
|
45
|
+
expect(pointAlong(path, cum, 1e9).lngLat).toEqual(path[2]) // clamped
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
it('slices the path between two distances, through its corners', () => {
|
|
49
|
+
const part = slicePath(path, cum, cum[1]! / 2, cum[1]! + (cum[2]! - cum[1]!) / 2)
|
|
50
|
+
expect(part).toHaveLength(3)
|
|
51
|
+
expect(part[1]).toEqual(path[1])
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
it('projects an off-road point onto the route', () => {
|
|
55
|
+
// A GPS fix a little north of the first leg's middle lands on it
|
|
56
|
+
expect(project(path, cum, [-64.185, -31.4195])).toBeCloseTo(cum[1]! / 2, -1)
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
it('bearing and bounds', () => {
|
|
60
|
+
expect(bearing([0, 0], [0, 1])).toBeCloseTo(0, 6)
|
|
61
|
+
expect(bearing([0, 0], [-1, 0])).toBeCloseTo(270, 6)
|
|
62
|
+
expect(bounds(path)).toEqual([[-64.19, -31.42], [-64.18, -31.41]])
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
async function mountRoute(props: Record<string, unknown>) {
|
|
67
|
+
const p = ref(props)
|
|
68
|
+
const wrapper = mount(() => h(MMap, { mapStyle: 's' }, () => h(MMapRoute, p.value)), { attachTo: document.body })
|
|
69
|
+
await flushPromises()
|
|
70
|
+
const map = created.maps.at(-1)! as FakeMap
|
|
71
|
+
map.load()
|
|
72
|
+
await nextTick()
|
|
73
|
+
await nextTick()
|
|
74
|
+
return { wrapper, map, p }
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const routeData = (map: FakeMap) => {
|
|
78
|
+
const source = [...map.sources.entries()].find(([id]) => id.startsWith('m3-route'))![1]
|
|
79
|
+
return source.data as { features: { properties: { part: string }; geometry: { coordinates: LngLat[] } }[] }
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
describe('MMapRoute', () => {
|
|
83
|
+
const stops = [{ lngLat: path[0]!, label: 'Restaurant' }, { lngLat: path[2]!, label: 'Home' }]
|
|
84
|
+
|
|
85
|
+
it('draws the route, split into done and ahead, and fits the map to it', async () => {
|
|
86
|
+
const { map } = await mountRoute({ stops, path, progress: 0.5 })
|
|
87
|
+
expect(map.layers.map((l) => l.id).filter((id) => id.startsWith('m3-route'))).toHaveLength(3)
|
|
88
|
+
const [rest, done] = routeData(map).features
|
|
89
|
+
expect(rest!.properties.part).toBe('rest')
|
|
90
|
+
expect(done!.geometry.coordinates[0]).toEqual(path[0])
|
|
91
|
+
expect(rest!.geometry.coordinates.at(-1)).toEqual(path[2])
|
|
92
|
+
expect(map.flights.some(([kind]) => kind === 'fitBounds')).toBe(true)
|
|
93
|
+
// Ahead is the whole route, unchanging (its dots don't crawl); the exact shape, no simplification
|
|
94
|
+
expect(rest!.geometry.coordinates).toEqual(path)
|
|
95
|
+
expect((map.sources.get([...map.sources.keys()].find((id) => id.startsWith('m3-route'))!)!.spec as { tolerance?: number }).tolerance).toBe(0)
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
it('places the vehicle along the road, and a GPS position on the nearest point', async () => {
|
|
99
|
+
const { map, p } = await mountRoute({ stops, path, progress: 0 })
|
|
100
|
+
const vehicle = created.markers.find((m) => (m.getElement() as HTMLElement).classList?.contains('m3-map-route-vehicle'))!
|
|
101
|
+
expect(vehicle.getLngLat()).toEqual({ lng: path[0]![0], lat: path[0]![1] })
|
|
102
|
+
p.value = { stops, path, vehicle: [-64.18, -31.4152] } // off the road, near the second leg
|
|
103
|
+
await nextTick()
|
|
104
|
+
await flushPromises()
|
|
105
|
+
expect(vehicle.getLngLat().lng).toBeCloseTo(-64.18, 6)
|
|
106
|
+
expect(routeData(map).features[1]!.geometry.coordinates).toContainEqual(path[1])
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
it('marks the stops reached and emits arrive at the end', async () => {
|
|
110
|
+
const onArrive = vi.fn()
|
|
111
|
+
const { p, wrapper } = await mountRoute({ stops, path, progress: 0, onArrive })
|
|
112
|
+
const stopEls = () => [...document.querySelectorAll('.m3-map-route-stop')]
|
|
113
|
+
expect(stopEls()[0]!.classList.contains('bg-primary')).toBe(true) // the start is reached at 0
|
|
114
|
+
expect(stopEls()[1]!.classList.contains('bg-primary')).toBe(false)
|
|
115
|
+
p.value = { stops, path, progress: 1, onArrive }
|
|
116
|
+
await nextTick()
|
|
117
|
+
await flushPromises()
|
|
118
|
+
expect(stopEls()[1]!.classList.contains('bg-primary')).toBe(true)
|
|
119
|
+
expect(onArrive).toHaveBeenCalledTimes(1)
|
|
120
|
+
expect(stopEls()[1]!.getAttribute('aria-label')).toBe('Home')
|
|
121
|
+
wrapper.unmount()
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
it('without progress or vehicle there is no vehicle; straight lines when there is no path', async () => {
|
|
125
|
+
const { map } = await mountRoute({ stops })
|
|
126
|
+
expect(created.markers.find((m) => (m.getElement() as HTMLElement).classList?.contains('m3-map-route-vehicle'))?.map).toBeUndefined()
|
|
127
|
+
expect(routeData(map).features[0]!.geometry.coordinates).toEqual([path[0], path[2]])
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
it('removes its layers and source on unmount', async () => {
|
|
131
|
+
const { map, wrapper } = await mountRoute({ stops, path, progress: 0.3 })
|
|
132
|
+
wrapper.unmount()
|
|
133
|
+
expect(map.layers.some((l) => l.id.startsWith('m3-route'))).toBe(false)
|
|
134
|
+
expect([...map.sources.keys()].some((id) => id.startsWith('m3-route'))).toBe(false)
|
|
135
|
+
})
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
// ── Real streets (OSRM routes in Córdoba) ─────────────────────────────
|
|
139
|
+
const M = 111_320
|
|
140
|
+
const offRoad = (path: LngLat[], p: LngLat) => {
|
|
141
|
+
// Distance (m) from p to the polyline, flat approximation
|
|
142
|
+
const k = Math.cos((p[1] * Math.PI) / 180)
|
|
143
|
+
let best = Infinity
|
|
144
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
145
|
+
const [ax, ay] = [path[i]![0] * k, path[i]![1]], [bx, by] = [path[i + 1]![0] * k, path[i + 1]![1]]
|
|
146
|
+
const [dx, dy] = [bx - ax, by - ay]
|
|
147
|
+
const l2 = dx * dx + dy * dy
|
|
148
|
+
const t = l2 ? Math.max(0, Math.min(1, ((p[0] * k - ax) * dx + (p[1] - ay) * dy) / l2)) : 0
|
|
149
|
+
best = Math.min(best, Math.hypot(ax + dx * t - p[0] * k, ay + dy * t - p[1]) * M)
|
|
150
|
+
}
|
|
151
|
+
return best
|
|
152
|
+
}
|
|
153
|
+
/** A point of the return half that lies on the outbound half too (the stretch both ways share) */
|
|
154
|
+
function sharedPoint(path: LngLat[], cum: number[]) {
|
|
155
|
+
const half = cum.at(-1)! / 2
|
|
156
|
+
const outbound = slicePath(path, cum, 0, half * 0.9)
|
|
157
|
+
for (let i = path.length - 1; i >= 0; i--) {
|
|
158
|
+
if (cum[i]! > half * 1.1 && offRoad(outbound, path[i]!) < 3) return { point: path[i]!, at: cum[i]! }
|
|
159
|
+
}
|
|
160
|
+
throw new Error('no shared stretch')
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
describe('route geometry on real streets', () => {
|
|
164
|
+
it('follows curves and roundabouts: every point along it is on the road, heading every way it turns', () => {
|
|
165
|
+
const cum = cumulative(roundabout)
|
|
166
|
+
expect(cum.at(-1)!).toBeCloseTo(roundaboutMeta.distance, -2) // our length ≈ OSRM's
|
|
167
|
+
const headings: number[] = []
|
|
168
|
+
for (let d = 0; d <= cum.at(-1)!; d += 15) {
|
|
169
|
+
const { lngLat, bearing: b } = pointAlong(roundabout, cum, d)
|
|
170
|
+
expect(offRoad(roundabout, lngLat)).toBeLessThan(0.5)
|
|
171
|
+
headings.push(b)
|
|
172
|
+
}
|
|
173
|
+
// Diagonals and the roundabout: headings well away from the four grid directions
|
|
174
|
+
expect(headings.some((b) => Math.min(...[0, 90, 180, 270, 360].map((g) => Math.abs(b - g))) > 25)).toBe(true)
|
|
175
|
+
// Turning through the roundabout and the boulevard's curves: headings in at least 5 of the 8 compass sectors
|
|
176
|
+
expect(new Set(headings.map((b) => Math.floor(b / 45) % 8)).size).toBeGreaterThanOrEqual(5)
|
|
177
|
+
const curvy = cumulative(costanera)
|
|
178
|
+
expect(slicePath(costanera, curvy, 0, curvy.at(-1)!)).toHaveLength(costanera.length)
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
it('keeps a heading over repeated points (routing output has them)', () => {
|
|
182
|
+
const p: LngLat[] = [[0, 0], [0.001, 0], [0.001, 0], [0.002, 0]]
|
|
183
|
+
const cum = cumulative(p)
|
|
184
|
+
expect(pointAlong(p, cum, cum[1]!).bearing).toBeCloseTo(90, 3)
|
|
185
|
+
})
|
|
186
|
+
|
|
187
|
+
it('forward snapping: on the way back, a fix on the shared stretch stays on the way back', () => {
|
|
188
|
+
const cum = cumulative(roundTrip)
|
|
189
|
+
const { point, at } = sharedPoint(roundTrip, cum)
|
|
190
|
+
expect(project(roundTrip, cum, point)).toBeLessThan(cum.at(-1)! / 2) // the plain nearest point is on the way out
|
|
191
|
+
expect(projectForward(roundTrip, cum, point, at - 80)).toBeCloseTo(at, -1)
|
|
192
|
+
// Never backwards, even with jitter behind it
|
|
193
|
+
expect(projectForward(roundTrip, cum, roundTrip[0]!, at)).toBe(at)
|
|
194
|
+
})
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
describe('MMapRoute on real streets', () => {
|
|
198
|
+
const depot = roundTrip[0]!
|
|
199
|
+
const drop = roundTrip[Math.floor(roundTrip.length / 2)]!
|
|
200
|
+
const trip = [{ lngLat: depot, label: 'Depot' }, { lngLat: drop, label: 'Drop' }, { lngLat: depot, label: 'Back' }]
|
|
201
|
+
const route = (w: ReturnType<typeof mount>) => w.findComponent(MMapRoute as never).vm as unknown as { travelled: number; length: number }
|
|
202
|
+
const stopDone = (i: number) => document.querySelectorAll('.m3-map-route-stop')[i]!.classList.contains('bg-primary')
|
|
203
|
+
|
|
204
|
+
it('a round trip: the last stop (where the first is) is reached at the end, not at the start', async () => {
|
|
205
|
+
const { p } = await mountRoute({ stops: trip, path: roundTrip, progress: 0.1 })
|
|
206
|
+
expect(stopDone(0)).toBe(true)
|
|
207
|
+
expect(stopDone(2)).toBe(false)
|
|
208
|
+
p.value = { stops: trip, path: roundTrip, progress: 1 }
|
|
209
|
+
await nextTick()
|
|
210
|
+
await flushPromises()
|
|
211
|
+
expect(stopDone(2)).toBe(true)
|
|
212
|
+
})
|
|
213
|
+
|
|
214
|
+
it('a GPS fix on the shared stretch, on the way back, keeps the van on the way back (snap: forward)', async () => {
|
|
215
|
+
const cum = cumulative(roundTrip)
|
|
216
|
+
const { point, at } = sharedPoint(roundTrip, cum)
|
|
217
|
+
const before = pointAlong(roundTrip, cum, at - 60).lngLat
|
|
218
|
+
const { wrapper, p } = await mountRoute({ stops: trip, path: roundTrip, vehicle: before })
|
|
219
|
+
p.value = { stops: trip, path: roundTrip, vehicle: [point[0] + 0.00005, point[1] + 0.00005] } // ~7 m off, as GPS is
|
|
220
|
+
await nextTick()
|
|
221
|
+
await flushPromises()
|
|
222
|
+
expect(route(wrapper).travelled).toBeGreaterThan(cum.at(-1)! / 2)
|
|
223
|
+
})
|
|
224
|
+
|
|
225
|
+
it("snap: 'nearest' takes the closest point of the whole route", async () => {
|
|
226
|
+
const cum = cumulative(roundTrip)
|
|
227
|
+
const { point, at } = sharedPoint(roundTrip, cum)
|
|
228
|
+
const { wrapper, p } = await mountRoute({ stops: trip, path: roundTrip, vehicle: pointAlong(roundTrip, cum, at - 60).lngLat, snap: 'nearest' })
|
|
229
|
+
p.value = { stops: trip, path: roundTrip, vehicle: point, snap: 'nearest' }
|
|
230
|
+
await nextTick()
|
|
231
|
+
await flushPromises()
|
|
232
|
+
expect(route(wrapper).travelled).toBeLessThan(cum.at(-1)! / 2)
|
|
233
|
+
})
|
|
234
|
+
|
|
235
|
+
it('provider: fetches the road between the stops, emits route, and redraws on it', async () => {
|
|
236
|
+
const provider = vi.fn(async () => ({ path: roundabout, ...roundaboutMeta }))
|
|
237
|
+
const onRoute = vi.fn()
|
|
238
|
+
const stops = [{ lngLat: roundabout[0]! }, { lngLat: roundabout.at(-1)! }]
|
|
239
|
+
const { map } = await mountRoute({ stops, provider, onRoute, progress: 0 })
|
|
240
|
+
await flushPromises()
|
|
241
|
+
expect(provider).toHaveBeenCalledWith([roundabout[0], roundabout.at(-1)], expect.objectContaining({ signal: expect.any(AbortSignal) }))
|
|
242
|
+
expect(onRoute).toHaveBeenCalledWith(expect.objectContaining({ distance: roundaboutMeta.distance }))
|
|
243
|
+
expect(routeData(map).features[0]!.geometry.coordinates.length).toBeGreaterThan(100) // the streets, not a straight line
|
|
244
|
+
})
|
|
245
|
+
|
|
246
|
+
it('provider: a failure emits error and keeps straight lines; a newer request aborts the older one', async () => {
|
|
247
|
+
const signals: AbortSignal[] = []
|
|
248
|
+
const provider = vi.fn((_: LngLat[], { signal }: { signal?: AbortSignal }) => {
|
|
249
|
+
signals.push(signal!)
|
|
250
|
+
return Promise.reject(new Error('down'))
|
|
251
|
+
})
|
|
252
|
+
const onError = vi.fn()
|
|
253
|
+
const stops = [{ lngLat: path[0]! }, { lngLat: path[2]! }]
|
|
254
|
+
const { map, p } = await mountRoute({ stops, provider, onError })
|
|
255
|
+
await flushPromises()
|
|
256
|
+
expect(onError).toHaveBeenCalled()
|
|
257
|
+
expect(routeData(map).features[0]!.geometry.coordinates).toEqual([path[0], path[2]])
|
|
258
|
+
p.value = { stops: [stops[0]!, { lngLat: path[1]! }], provider, onError }
|
|
259
|
+
await nextTick()
|
|
260
|
+
expect(signals[0]!.aborted).toBe(true)
|
|
261
|
+
})
|
|
262
|
+
})
|
|
263
|
+
|
|
264
|
+
describe('osrmRouteProvider', () => {
|
|
265
|
+
it('asks OSRM for the full GeoJSON geometry and returns path, distance, duration', async () => {
|
|
266
|
+
const fetchMock = vi.fn(async () => ({ ok: true, json: async () => ({ code: 'Ok', routes: [{ geometry: { coordinates: roundabout }, ...roundaboutMeta }] }) }))
|
|
267
|
+
vi.stubGlobal('fetch', fetchMock)
|
|
268
|
+
const result = await osrmRouteProvider({ url: 'https://osrm.test/', params: { exclude: 'toll' } })([[-64.189, -31.4199], [-64.1752, -31.433]], {})
|
|
269
|
+
const url = String((fetchMock.mock.calls[0] as unknown[])[0])
|
|
270
|
+
expect(url).toBe('https://osrm.test/route/v1/driving/-64.189,-31.4199;-64.1752,-31.433?overview=full&geometries=geojson&exclude=toll')
|
|
271
|
+
expect(result).toEqual({ path: roundabout, ...roundaboutMeta })
|
|
272
|
+
})
|
|
273
|
+
|
|
274
|
+
it('throws on an OSRM error (NoRoute…) or a bad status', async () => {
|
|
275
|
+
vi.stubGlobal('fetch', vi.fn(async () => ({ ok: true, json: async () => ({ code: 'NoRoute', message: 'Impossible route' }) })))
|
|
276
|
+
await expect(osrmRouteProvider()([[0, 0], [1, 1]], {})).rejects.toThrow('Impossible route')
|
|
277
|
+
vi.stubGlobal('fetch', vi.fn(async () => ({ ok: false, status: 429 })))
|
|
278
|
+
await expect(osrmRouteProvider()([[0, 0], [1, 1]], {})).rejects.toThrow('429')
|
|
279
|
+
})
|
|
280
|
+
})
|
|
281
|
+
|
|
282
|
+
describe('MMapRoute vehicle steadiness', () => {
|
|
283
|
+
it("an icon heading south on a wobbly road doesn't flip back and forth; it turns around when clearly heading west", async () => {
|
|
284
|
+
// South, wobbling a hair east and west (bearings around 180°, as a real road's short segments)
|
|
285
|
+
const wobbly: LngLat[] = Array.from({ length: 12 }, (_, i) => [-64.18 + (i % 2 ? 0.000004 : -0.000004), -31.41 - i * 0.0005])
|
|
286
|
+
const westward: LngLat[] = [...wobbly, [-64.19, -31.4155]]
|
|
287
|
+
const stops = [{ lngLat: wobbly[0]! }, { lngLat: westward.at(-1)! }]
|
|
288
|
+
const { p } = await mountRoute({ stops, path: westward, progress: 0, vehicleIcon: 'two_wheeler' })
|
|
289
|
+
const icon = () => [...document.querySelectorAll('.m3-map-route-vehicle *')].find((e) => e.textContent?.trim() === 'two_wheeler' && !e.children.length) as HTMLElement
|
|
290
|
+
const states: boolean[] = []
|
|
291
|
+
const total = cumulative(westward).at(-1)!
|
|
292
|
+
const southEnd = cumulative(wobbly).at(-1)! / total
|
|
293
|
+
for (let k = 1; k <= 20; k++) {
|
|
294
|
+
p.value = { stops, path: westward, progress: (k / 20) * southEnd * 0.95, vehicleIcon: 'two_wheeler' }
|
|
295
|
+
await nextTick()
|
|
296
|
+
await flushPromises()
|
|
297
|
+
states.push(!!icon().style.transform)
|
|
298
|
+
}
|
|
299
|
+
expect(new Set(states).size).toBe(1) // never flipped on the way south
|
|
300
|
+
p.value = { stops, path: westward, progress: 0.99, vehicleIcon: 'two_wheeler' }
|
|
301
|
+
await nextTick()
|
|
302
|
+
await flushPromises()
|
|
303
|
+
expect(icon().style.transform).toBe('scaleX(-1)') // heading west at the end
|
|
304
|
+
})
|
|
305
|
+
|
|
306
|
+
it('positions the vehicle with subpixel precision', async () => {
|
|
307
|
+
await mountRoute({ stops: [{ lngLat: path[0]! }, { lngLat: path[2]! }], path, progress: 0.3 })
|
|
308
|
+
const vehicle = created.markers.find((m) => (m.getElement() as HTMLElement).classList?.contains('m3-map-route-vehicle'))!
|
|
309
|
+
expect((vehicle as unknown as { options: Record<string, unknown> }).options.subpixelPositioning).toBe(true)
|
|
310
|
+
})
|
|
311
|
+
})
|
|
312
|
+
|
|
313
|
+
describe('MMapRoute custom vehicle', () => {
|
|
314
|
+
it('#vehicle gets { bearing, west }; rotateVehicle makes the marker turn it with the road', async () => {
|
|
315
|
+
const scopes: { bearing: number; west: boolean }[] = []
|
|
316
|
+
const p = ref<Record<string, unknown>>({ stops: [{ lngLat: path[0]! }, { lngLat: path[2]! }], path, progress: 0.25, rotateVehicle: true })
|
|
317
|
+
mount(() => h(MMap, { mapStyle: 's' }, () => h(MMapRoute, p.value, {
|
|
318
|
+
vehicle: (scope: { bearing: number; west: boolean }) => { scopes.push(scope); return h('img', { class: 'my-car', src: 'car.svg' }) },
|
|
319
|
+
})), { attachTo: document.body })
|
|
320
|
+
await flushPromises()
|
|
321
|
+
const map = created.maps.at(-1)! as FakeMap
|
|
322
|
+
map.load()
|
|
323
|
+
await nextTick()
|
|
324
|
+
await nextTick()
|
|
325
|
+
expect(document.querySelector('.m3-map-route-vehicle .my-car')).not.toBeNull()
|
|
326
|
+
const vehicle = created.markers.find((m) => (m.getElement() as HTMLElement).classList?.contains('m3-map-route-vehicle'))! as unknown as { options: Record<string, unknown>; rotation: number }
|
|
327
|
+
expect(vehicle.options.rotationAlignment).toBe('map')
|
|
328
|
+
expect(vehicle.rotation).toBeCloseTo(90, 0) // the first leg heads east
|
|
329
|
+
expect(scopes.at(-1)).toEqual(expect.objectContaining({ west: false }))
|
|
330
|
+
})
|
|
331
|
+
})
|
|
332
|
+
|
|
333
|
+
describe('MMapRoute flow', () => {
|
|
334
|
+
it('the dots ahead stream toward the destination by shifting the dash pattern; the geometry stays put', async () => {
|
|
335
|
+
vi.stubGlobal('matchMedia', () => ({ matches: false, addEventListener() {}, removeEventListener() {} }))
|
|
336
|
+
let t = 0
|
|
337
|
+
const frames: FrameRequestCallback[] = []
|
|
338
|
+
vi.stubGlobal('requestAnimationFrame', (cb: FrameRequestCallback) => frames.push(cb))
|
|
339
|
+
vi.stubGlobal('cancelAnimationFrame', () => {})
|
|
340
|
+
vi.spyOn(performance, 'now').mockImplementation(() => t)
|
|
341
|
+
// Runs every callback queued (other parts of the map may ask for frames too)
|
|
342
|
+
const tick = (ms: number) => { t += ms; frames.splice(0).forEach((cb) => cb(t)) }
|
|
343
|
+
const { map, p } = await mountRoute({ stops: [{ lngLat: path[0]! }, { lngLat: path[2]! }], path, progress: 0 })
|
|
344
|
+
const paint = vi.spyOn(map, 'setPaintProperty')
|
|
345
|
+
const data = routeData(map)
|
|
346
|
+
const dashes = () => paint.mock.calls.filter(([id, prop]) => String(id).endsWith('-rest') && prop === 'line-dasharray').map((c) => c[2] as number[])
|
|
347
|
+
tick(16)
|
|
348
|
+
tick(60)
|
|
349
|
+
tick(60)
|
|
350
|
+
const seen = dashes()
|
|
351
|
+
expect(seen.length).toBeGreaterThanOrEqual(2)
|
|
352
|
+
// Each pattern covers one period (dot + gap), the dot a little further along each time
|
|
353
|
+
for (const d of seen) expect(d.reduce((a, b) => a + b, 0)).toBeCloseTo(2.6, 6)
|
|
354
|
+
expect(seen[1]![1]!).toBeGreaterThan(seen[0]![1]!)
|
|
355
|
+
expect(routeData(map)).toBe(data) // no geometry re-sent for the flow
|
|
356
|
+
// flow: false stops it, back to the unshifted pattern
|
|
357
|
+
p.value = { stops: [{ lngLat: path[0]! }, { lngLat: path[2]! }], path, progress: 0, flow: false }
|
|
358
|
+
await nextTick()
|
|
359
|
+
expect(dashes().at(-1)).toEqual([0, 0, 1, 1.6])
|
|
360
|
+
})
|
|
361
|
+
|
|
362
|
+
it('pauses while the map is off screen', async () => {
|
|
363
|
+
vi.stubGlobal('matchMedia', () => ({ matches: false, addEventListener() {}, removeEventListener() {} }))
|
|
364
|
+
let report: (entries: { isIntersecting: boolean }[]) => void = () => {}
|
|
365
|
+
vi.stubGlobal('IntersectionObserver', class { constructor(cb: typeof report) { report = cb } observe() {} disconnect() {} })
|
|
366
|
+
let t = 0
|
|
367
|
+
const frames: FrameRequestCallback[] = []
|
|
368
|
+
vi.stubGlobal('requestAnimationFrame', (cb: FrameRequestCallback) => frames.push(cb))
|
|
369
|
+
vi.stubGlobal('cancelAnimationFrame', () => { frames.length = 0 })
|
|
370
|
+
vi.spyOn(performance, 'now').mockImplementation(() => t)
|
|
371
|
+
const tick = (ms: number) => { t += ms; frames.splice(0).forEach((cb) => cb(t)) }
|
|
372
|
+
const { map } = await mountRoute({ stops: [{ lngLat: path[0]! }, { lngLat: path[2]! }], path, progress: 0 })
|
|
373
|
+
const paint = vi.spyOn(map, 'setPaintProperty')
|
|
374
|
+
report([{ isIntersecting: false }])
|
|
375
|
+
paint.mockClear()
|
|
376
|
+
tick(100)
|
|
377
|
+
tick(100)
|
|
378
|
+
expect(paint).not.toHaveBeenCalled()
|
|
379
|
+
report([{ isIntersecting: true }])
|
|
380
|
+
tick(16)
|
|
381
|
+
tick(100)
|
|
382
|
+
expect(paint).toHaveBeenCalled()
|
|
383
|
+
})
|
|
384
|
+
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, it, expect, afterEach } from 'vitest'
|
|
2
2
|
import { nextTick } from 'vue'
|
|
3
|
-
import { mount } from '@vue/test-utils'
|
|
3
|
+
import { mount, flushPromises } from '@vue/test-utils'
|
|
4
4
|
import MPhoneInput from '../components/MPhoneInput.vue'
|
|
5
5
|
import { formatPhone, isValidPhone, parsePhone } from '../composables/phoneNumber'
|
|
6
6
|
|
|
@@ -69,7 +69,10 @@ describe('MPhoneInput', () => {
|
|
|
69
69
|
it('flags an incomplete number after leaving the field', async () => {
|
|
70
70
|
const w = mount(MPhoneInput, { props: { label: 'Phone', country: 'AR', modelValue: '+54112', locale: 'en' } })
|
|
71
71
|
expect(w.text()).not.toContain('Incomplete')
|
|
72
|
-
|
|
72
|
+
// Leaving the field (focusout, which a real blur always brings) shows it once focus has settled elsewhere
|
|
73
|
+
await input(w).trigger('focusout')
|
|
74
|
+
await new Promise((r) => setTimeout(r))
|
|
75
|
+
await flushPromises()
|
|
73
76
|
expect(w.text()).toContain('Incomplete phone number')
|
|
74
77
|
})
|
|
75
78
|
|
|
@@ -13,7 +13,8 @@ describe('MRichTextEditor fill', () => {
|
|
|
13
13
|
|
|
14
14
|
it('fills its height and scrolls the text inside with fill', () => {
|
|
15
15
|
const w = mount(MRichTextEditor, { props: { modelValue: '', fill: true } })
|
|
16
|
-
|
|
16
|
+
// The editor box (the root is the box plus its validation message)
|
|
17
|
+
expect(w.find('div.rounded-lg').classes()).toContain('flex-col')
|
|
17
18
|
const content = w.find('.rte-content')
|
|
18
19
|
expect(content.classes()).toEqual(expect.arrayContaining(['flex-1', 'min-h-0', 'overflow-y-auto']))
|
|
19
20
|
expect((content.element as HTMLElement).style.minHeight).toBe('')
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
2
|
+
import { flushPromises, mount } from '@vue/test-utils'
|
|
3
|
+
import MTrackingTimeline from '../components/MTrackingTimeline.vue'
|
|
4
|
+
import { defaultLocale } from '../composables/useLocale'
|
|
5
|
+
|
|
6
|
+
const steps = [
|
|
7
|
+
{ label: 'Order placed', icon: 'receipt_long', time: '2026-11-27T14:00:00' },
|
|
8
|
+
{ label: 'Preparing', icon: 'skillet', time: '2026-11-27T14:05:00' },
|
|
9
|
+
{ label: 'On the way', icon: 'two_wheeler' },
|
|
10
|
+
{ label: 'Delivered', icon: 'home', time: '2026-11-27T14:41:00' },
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
vi.useFakeTimers()
|
|
15
|
+
vi.setSystemTime(new Date('2026-11-27T14:20:00'))
|
|
16
|
+
document.documentElement.lang = 'en'
|
|
17
|
+
})
|
|
18
|
+
afterEach(() => vi.useRealTimers())
|
|
19
|
+
|
|
20
|
+
const legs = (w: ReturnType<typeof mount>) => w.findAll('li[aria-hidden="true"] > span').map((s) => (s.element as HTMLElement).style.width)
|
|
21
|
+
|
|
22
|
+
describe('MTrackingTimeline', () => {
|
|
23
|
+
it('titles the current stage, marks it, and fills the legs up to it', () => {
|
|
24
|
+
const w = mount(MTrackingTimeline, { props: { steps, current: 2, stepProgress: 0.4 } })
|
|
25
|
+
expect(w.find('h3').text()).toBe('On the way')
|
|
26
|
+
expect(w.find('[aria-current="step"]').attributes('title')).toBe('On the way')
|
|
27
|
+
expect(legs(w)).toEqual(['100%', '100%', '40%'])
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
it('shows the minutes left and the arrival time, and keeps counting down', async () => {
|
|
31
|
+
const w = mount(MTrackingTimeline, { props: { steps, current: 2, eta: new Date('2026-11-27T14:32:00') } })
|
|
32
|
+
expect(w.text()).toContain('12 min')
|
|
33
|
+
expect(w.text()).toContain('Arrives 2:32')
|
|
34
|
+
vi.advanceTimersByTime(11 * 60_000)
|
|
35
|
+
await flushPromises()
|
|
36
|
+
expect(w.text()).toContain(defaultLocale.trackingArrivingNow)
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it('all done: Delivered with the last stage time, every leg full, no current step', () => {
|
|
40
|
+
const w = mount(MTrackingTimeline, { props: { steps, current: 3, eta: new Date('2026-11-27T14:32:00') } })
|
|
41
|
+
expect(w.text()).toContain('Delivered · 2:41')
|
|
42
|
+
expect(w.text()).not.toContain('min')
|
|
43
|
+
expect(legs(w)).toEqual(['100%', '100%', '100%'])
|
|
44
|
+
expect(w.find('[aria-current="step"]').exists()).toBe(false)
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
it('delayed and canceled states', () => {
|
|
48
|
+
const late = mount(MTrackingTimeline, { props: { steps, current: 1, status: 'delayed' } })
|
|
49
|
+
expect(late.text()).toContain(defaultLocale.trackingDelayed)
|
|
50
|
+
expect(late.find('[aria-current="step"] span.relative').classes()).toContain('bg-tertiary-container')
|
|
51
|
+
const off = mount(MTrackingTimeline, { props: { steps, current: 1, status: 'canceled', stepProgress: 0.5 } })
|
|
52
|
+
expect(off.text()).toContain(defaultLocale.trackingCanceled)
|
|
53
|
+
expect(legs(off)[1]).toBe('0%') // nothing moves once canceled
|
|
54
|
+
expect(off.find('[aria-current="step"]').text()).toContain('close')
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
it('opens the stages with their times (v-model:expanded)', async () => {
|
|
58
|
+
const w = mount(MTrackingTimeline, { props: { steps, current: 2 } })
|
|
59
|
+
const button = w.find('button[aria-expanded]')
|
|
60
|
+
expect(button.attributes('aria-expanded')).toBe('false')
|
|
61
|
+
await button.trigger('click')
|
|
62
|
+
expect(w.emitted('update:expanded')![0]).toEqual([true])
|
|
63
|
+
expect(button.attributes('aria-expanded')).toBe('true')
|
|
64
|
+
expect(w.text()).toContain('2:05')
|
|
65
|
+
})
|
|
66
|
+
})
|
|
@@ -141,7 +141,10 @@ export class FakeMarker extends Evented {
|
|
|
141
141
|
setPopup(p: FakePopup) { this.popup = p; return this }
|
|
142
142
|
getPopup() { return this.popup }
|
|
143
143
|
setDraggable() { return this }
|
|
144
|
-
|
|
144
|
+
rotation = 0
|
|
145
|
+
rotationAlignment: unknown
|
|
146
|
+
setRotation(r = 0) { this.rotation = r; return this }
|
|
147
|
+
setRotationAlignment(a: unknown) { this.rotationAlignment = a; return this }
|
|
145
148
|
setOffset() { return this }
|
|
146
149
|
remove() { this.map = undefined; return this }
|
|
147
150
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Real routes in Córdoba from the OSRM demo server (car profile), kept here so tests need no network.
|
|
2
|
+
// roundabout: Patio Olmos → Parque Sarmiento through Plaza España's roundabout; costanera: along the river (curves);
|
|
3
|
+
// roundTrip: warehouse → drop → warehouse, back partly by other streets (one-way streets)
|
|
4
|
+
|
|
5
|
+
export const roundabout: [number, number][] = [[-64.189009,-31.419963],[-64.18928,-31.419934],[-64.189473,-31.419896],[-64.189832,-31.419802],[-64.189976,-31.419802],[-64.190263,-31.419718],[-64.191479,-31.419398],[-64.19279,-31.419035],[-64.194047,-31.418698],[-64.194079,-31.418776],[-64.192824,-31.419115],[-64.191511,-31.419475],[-64.190294,-31.419806],[-64.190007,-31.419899],[-64.189885,-31.419937],[-64.189615,-31.420014],[-64.189404,-31.420085],[-64.18918,-31.420189],[-64.189123,-31.420212],[-64.189101,-31.420221],[-64.188948,-31.420282],[-64.18891,-31.4203],[-64.188869,-31.420313],[-64.188847,-31.420318],[-64.188829,-31.420322],[-64.188734,-31.420338],[-64.188686,-31.420476],[-64.188614,-31.420637],[-64.188602,-31.420666],[-64.188216,-31.421509],[-64.188008,-31.421909],[-64.187455,-31.423057],[-64.187282,-31.423421],[-64.187225,-31.42354],[-64.187179,-31.423635],[-64.186727,-31.424578],[-64.18644,-31.425174],[-64.186032,-31.426085],[-64.186005,-31.426146],[-64.185991,-31.426177],[-64.185638,-31.426928],[-64.185591,-31.427033],[-64.185475,-31.427292],[-64.185452,-31.42734],[-64.185317,-31.427621],[-64.185278,-31.427701],[-64.185251,-31.427773],[-64.18524,-31.427801],[-64.185211,-31.427886],[-64.185203,-31.42792],[-64.185197,-31.427969],[-64.185195,-31.427999],[-64.185198,-31.42802],[-64.185201,-31.428042],[-64.185215,-31.428094],[-64.18523,-31.428147],[-64.185282,-31.428181],[-64.18533,-31.428221],[-64.185372,-31.428265],[-64.185414,-31.42832],[-64.185448,-31.42838],[-64.185473,-31.428443],[-64.185488,-31.428508],[-64.185494,-31.428577],[-64.185489,-31.428647],[-64.185473,-31.428715],[-64.185452,-31.428769],[-64.185425,-31.42882],[-64.185392,-31.428868],[-64.185374,-31.42889],[-64.185353,-31.428914],[-64.18529,-31.42897],[-64.185242,-31.429003],[-64.185187,-31.429034],[-64.185128,-31.429059],[-64.185067,-31.429079],[-64.185004,-31.429094],[-64.184939,-31.429102],[-64.184873,-31.429105],[-64.18483,-31.429103],[-64.184758,-31.429095],[-64.184688,-31.42908],[-64.18462,-31.429055],[-64.184557,-31.429028],[-64.184479,-31.428983],[-64.184455,-31.428963],[-64.184435,-31.428946],[-64.184419,-31.428931],[-64.184363,-31.428928],[-64.184253,-31.428923],[-64.184208,-31.42892],[-64.184162,-31.428916],[-64.184097,-31.428914],[-64.184004,-31.428911],[-64.183927,-31.428913],[-64.183864,-31.428916],[-64.183711,-31.428936],[-64.183639,-31.428944],[-64.183507,-31.428957],[-64.183383,-31.428974],[-64.183269,-31.428993],[-64.183175,-31.429012],[-64.183069,-31.429035],[-64.18294,-31.429071],[-64.182833,-31.4291],[-64.182725,-31.42914],[-64.182592,-31.429191],[-64.182491,-31.429238],[-64.182377,-31.429312],[-64.182195,-31.429436],[-64.181951,-31.429592],[-64.181533,-31.429848],[-64.181431,-31.429908],[-64.181276,-31.429997],[-64.181188,-31.430046],[-64.181172,-31.430068],[-64.18115,-31.430085],[-64.18117,-31.430154],[-64.18141,-31.430423],[-64.181495,-31.430531],[-64.181555,-31.430629],[-64.181593,-31.430708],[-64.181607,-31.430751],[-64.181642,-31.430859],[-64.181661,-31.430952],[-64.181661,-31.430971],[-64.18166,-31.43104],[-64.181639,-31.431129],[-64.181621,-31.43119],[-64.181576,-31.431335],[-64.181528,-31.43147],[-64.181455,-31.431636],[-64.181403,-31.431722],[-64.181278,-31.431878],[-64.181169,-31.43198],[-64.18102,-31.432087],[-64.180879,-31.432183],[-64.180626,-31.432314],[-64.180447,-31.432389],[-64.18024,-31.43247],[-64.180053,-31.43253],[-64.17994,-31.432563],[-64.179282,-31.432706],[-64.179092,-31.432741],[-64.178896,-31.432771],[-64.178703,-31.43279],[-64.178303,-31.432803],[-64.178034,-31.432803],[-64.177837,-31.43279],[-64.177509,-31.432761],[-64.177179,-31.432748],[-64.176902,-31.432756],[-64.176674,-31.432783],[-64.176393,-31.432837],[-64.176225,-31.432876],[-64.175955,-31.432965],[-64.175693,-31.433072],[-64.175584,-31.433129],[-64.175394,-31.433241]]
|
|
6
|
+
export const roundaboutMeta = { distance: 3339.7, duration: 381.6 }
|
|
7
|
+
export const costanera: [number, number][] = [[-64.202828,-31.4046],[-64.202603,-31.404671],[-64.202589,-31.404677],[-64.202577,-31.404686],[-64.202508,-31.404762],[-64.202496,-31.404772],[-64.20248,-31.404778],[-64.202397,-31.404802],[-64.202219,-31.404854],[-64.202432,-31.40537],[-64.201194,-31.405757],[-64.201034,-31.405806],[-64.200518,-31.405962],[-64.199872,-31.406155],[-64.199562,-31.405373],[-64.199533,-31.4053],[-64.199504,-31.405233],[-64.199479,-31.40517],[-64.199223,-31.404517],[-64.199214,-31.404496],[-64.199193,-31.404448],[-64.19869,-31.404604],[-64.198191,-31.404761],[-64.198105,-31.404792],[-64.197982,-31.404852],[-64.197905,-31.404894],[-64.197753,-31.404977],[-64.197596,-31.405024],[-64.196823,-31.405211],[-64.195498,-31.40545],[-64.194805,-31.405555],[-64.194195,-31.405628],[-64.193599,-31.405724],[-64.193059,-31.4058],[-64.192812,-31.405821],[-64.192707,-31.405825],[-64.192555,-31.405818],[-64.192494,-31.405757],[-64.192455,-31.405708],[-64.192433,-31.405662],[-64.192426,-31.405597],[-64.192409,-31.40535],[-64.1912,-31.405405],[-64.190023,-31.405451],[-64.189028,-31.405504],[-64.188867,-31.405514],[-64.187857,-31.405569],[-64.187738,-31.405576],[-64.187192,-31.405617],[-64.186937,-31.405566],[-64.186561,-31.405492],[-64.185362,-31.405221],[-64.184239,-31.404954],[-64.184038,-31.404907],[-64.183041,-31.404693],[-64.182941,-31.404705],[-64.182861,-31.404723],[-64.182794,-31.404759],[-64.182701,-31.404839],[-64.182719,-31.40491],[-64.182707,-31.405138],[-64.182699,-31.405207],[-64.182685,-31.405265],[-64.182671,-31.405309],[-64.182649,-31.405339],[-64.182626,-31.405361],[-64.182595,-31.405383],[-64.18255,-31.405402],[-64.182506,-31.405415],[-64.182456,-31.405424],[-64.182382,-31.405421],[-64.181508,-31.405299],[-64.180836,-31.405253],[-64.18055,-31.405252],[-64.180483,-31.405258],[-64.180357,-31.405268],[-64.180142,-31.405304],[-64.179772,-31.40539],[-64.179564,-31.405456],[-64.177419,-31.406158],[-64.177342,-31.406179],[-64.177066,-31.406279],[-64.176988,-31.406308],[-64.176883,-31.406354],[-64.176461,-31.406541],[-64.176066,-31.406755],[-64.175749,-31.40695],[-64.175465,-31.407153],[-64.175403,-31.407211],[-64.175313,-31.407296],[-64.175097,-31.40754],[-64.174983,-31.407682],[-64.174907,-31.407796],[-64.174855,-31.40791],[-64.174827,-31.408021],[-64.174806,-31.408117],[-64.17477,-31.408307],[-64.174751,-31.408412],[-64.174523,-31.409171],[-64.17449,-31.409332],[-64.174471,-31.409471],[-64.174464,-31.40961],[-64.174472,-31.411496],[-64.17411,-31.411446],[-64.173911,-31.41141],[-64.173821,-31.411377],[-64.173746,-31.411337],[-64.173665,-31.411291],[-64.173613,-31.411244],[-64.173515,-31.411128],[-64.173252,-31.4108],[-64.173195,-31.410704],[-64.173239,-31.411119],[-64.172318,-31.410868],[-64.171142,-31.410542],[-64.170737,-31.411583],[-64.170534,-31.412141]]
|
|
8
|
+
export const costaneraMeta = { distance: 4136, duration: 479.3 }
|
|
9
|
+
export const roundTrip: [number, number][] = [[-64.198944,-31.412861],[-64.199314,-31.412753],[-64.199727,-31.413883],[-64.199254,-31.414026],[-64.198305,-31.414312],[-64.19696,-31.414729],[-64.19736,-31.415864],[-64.19773,-31.416882],[-64.197979,-31.417614],[-64.198006,-31.417685],[-64.197377,-31.417859],[-64.196695,-31.418052],[-64.195918,-31.418261],[-64.195368,-31.418412],[-64.194652,-31.418615],[-64.194079,-31.418776],[-64.192824,-31.419115],[-64.191511,-31.419475],[-64.190294,-31.419806],[-64.190007,-31.419899],[-64.189885,-31.419937],[-64.189615,-31.420014],[-64.189404,-31.420085],[-64.18918,-31.420189],[-64.189123,-31.420212],[-64.189101,-31.420221],[-64.188948,-31.420282],[-64.18891,-31.4203],[-64.188869,-31.420313],[-64.188847,-31.420318],[-64.188829,-31.420322],[-64.188734,-31.420338],[-64.188686,-31.420476],[-64.188614,-31.420637],[-64.188602,-31.420666],[-64.188216,-31.421509],[-64.188139,-31.421536],[-64.187971,-31.421596],[-64.187883,-31.421621],[-64.186582,-31.422025],[-64.185253,-31.422438],[-64.185197,-31.422455],[-64.183898,-31.422858],[-64.183052,-31.423121],[-64.182631,-31.423252],[-64.182244,-31.42231],[-64.182096,-31.421946],[-64.182055,-31.421848],[-64.183332,-31.421513],[-64.183646,-31.421431],[-64.184303,-31.421259],[-64.184705,-31.421154],[-64.186053,-31.420801],[-64.186264,-31.420749],[-64.187394,-31.420469],[-64.187439,-31.420456],[-64.187877,-31.420332],[-64.188038,-31.420286],[-64.188169,-31.420245],[-64.188208,-31.420233],[-64.188297,-31.420206],[-64.188431,-31.42015],[-64.188553,-31.4201],[-64.188617,-31.420073],[-64.188664,-31.420053],[-64.188709,-31.420032],[-64.188747,-31.420017],[-64.188791,-31.420004],[-64.188816,-31.419999],[-64.188834,-31.419994],[-64.188873,-31.419986],[-64.188977,-31.419966],[-64.18928,-31.419934],[-64.189473,-31.419896],[-64.189832,-31.419802],[-64.189976,-31.419802],[-64.190263,-31.419718],[-64.191479,-31.419398],[-64.19279,-31.419035],[-64.194047,-31.418698],[-64.195343,-31.418339],[-64.195893,-31.418187],[-64.196665,-31.417972],[-64.197822,-31.417657],[-64.197979,-31.417614],[-64.198433,-31.417486],[-64.198706,-31.4174],[-64.199394,-31.417167],[-64.199011,-31.416135],[-64.198747,-31.415458],[-64.198615,-31.41512],[-64.198305,-31.414312],[-64.197897,-31.413168],[-64.198944,-31.412861]]
|
|
10
|
+
export const roundTripMeta = { distance: 4890.8, duration: 627.9 }
|
|
@@ -20,6 +20,11 @@ import MDialog from '../components/MDialog.vue'
|
|
|
20
20
|
import MOverlay from '../components/MOverlay.vue'
|
|
21
21
|
import MAddressField from '../components/MAddressField.vue'
|
|
22
22
|
import MMentionField from '../components/MMentionField.vue'
|
|
23
|
+
import MRating from '../components/MRating.vue'
|
|
24
|
+
import MSegmentedButton from '../components/MSegmentedButton.vue'
|
|
25
|
+
import MSignaturePad from '../components/MSignaturePad.vue'
|
|
26
|
+
import MRichTextEditor from '../components/MRichTextEditor.vue'
|
|
27
|
+
import MCodeEditor from '../components/MCodeEditor.vue'
|
|
23
28
|
|
|
24
29
|
// These components render more than one root node (an element plus a Teleport, a v-if/v-show
|
|
25
30
|
// pair, a comment before the root...), which makes Vue drop a consumer's class/attrs silently.
|
|
@@ -54,6 +59,12 @@ const cases: [name: string, component: Component, props: Record<string, unknown>
|
|
|
54
59
|
['MDialog (fullscreen)', MDialog, { modelValue: true, title: 'T', fullscreen: true }, 'DIV'],
|
|
55
60
|
// A Teleport root: the attrs go on the content layer, over the scrim
|
|
56
61
|
['MOverlay', MOverlay, { modelValue: true }, 'DIV'],
|
|
62
|
+
// The control plus its validation message: the attrs go on the control
|
|
63
|
+
['MRating', MRating, { modelValue: 3, error: 'E' }, 'DIV'],
|
|
64
|
+
['MSegmentedButton', MSegmentedButton, { modelValue: 'a', options: [{ value: 'a', label: 'A' }], error: 'E' }, 'DIV'],
|
|
65
|
+
['MSignaturePad', MSignaturePad, { error: 'E' }, 'DIV'],
|
|
66
|
+
['MRichTextEditor', MRichTextEditor, { modelValue: '', error: 'E' }, 'DIV'],
|
|
67
|
+
['MCodeEditor', MCodeEditor, { modelValue: '', error: 'E' }, 'DIV'],
|
|
57
68
|
]
|
|
58
69
|
|
|
59
70
|
describe('consumer attrs reach multi-root components', () => {
|