@geode/opengeodeweb-front 10.3.0 → 10.3.1
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/.eslintrc.cjs +1 -0
- package/app/assets/geode_objects.js +1 -3
- package/app/components/Carousel.vue +7 -4
- package/app/components/CrsSelector.vue +5 -6
- package/app/components/DragAndDrop.vue +18 -8
- package/app/components/ExtensionSelector.vue +9 -17
- package/app/components/FeedBack/ErrorBanner.vue +1 -1
- package/app/components/FeedBack/Snackers.vue +4 -1
- package/app/components/FileSelector.vue +21 -10
- package/app/components/FileUploader.vue +15 -32
- package/app/components/HybridRenderingView.vue +5 -3
- package/app/components/Inspector/InspectionButton.vue +2 -2
- package/app/components/Inspector/ResultPanel.vue +4 -4
- package/app/components/Launcher.vue +1 -1
- package/app/components/Loading.vue +6 -6
- package/app/components/MissingFilesSelector.vue +23 -29
- package/app/components/ObjectSelector.vue +11 -10
- package/app/components/OptionCard.vue +1 -1
- package/app/components/PackagesVersions.vue +5 -3
- package/app/components/Recaptcha.vue +6 -4
- package/app/components/RemoteRenderingView.vue +4 -3
- package/app/components/Screenshot.vue +4 -4
- package/app/components/Step.vue +7 -7
- package/app/components/VeaseViewToolbar.vue +3 -3
- package/app/components/Viewer/BreadCrumb.vue +2 -4
- package/app/components/Viewer/ContextMenu.vue +77 -45
- package/app/components/Viewer/ContextMenuItem.vue +42 -33
- package/app/components/Viewer/EdgedCurve/PointsOptions.vue +3 -3
- package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +5 -5
- package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +6 -6
- package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +5 -5
- package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +5 -5
- package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +6 -7
- package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +6 -6
- package/app/components/Viewer/Generic/Model/EdgesOptions.vue +3 -3
- package/app/components/Viewer/Generic/Model/PointsOptions.vue +4 -4
- package/app/components/Viewer/Grid/2D/CellsOptions.vue +3 -3
- package/app/components/Viewer/Grid/2D/EdgesOptions.vue +3 -3
- package/app/components/Viewer/Grid/2D/PointsOptions.vue +3 -3
- package/app/components/Viewer/Grid/3D/CellsOptions.vue +3 -3
- package/app/components/Viewer/Grid/3D/EdgesOptions.vue +3 -3
- package/app/components/Viewer/Grid/3D/FacetsOptions.vue +3 -3
- package/app/components/Viewer/Grid/3D/PointsOptions.vue +3 -3
- package/app/components/Viewer/HybridSolid/EdgesOptions.vue +3 -3
- package/app/components/Viewer/HybridSolid/PointsOptions.vue +3 -3
- package/app/components/Viewer/HybridSolid/PolygonsOptions.vue +3 -3
- package/app/components/Viewer/HybridSolid/PolyhedraOptions.vue +3 -3
- package/app/components/Viewer/Options/CellAttributeSelector.vue +23 -20
- package/app/components/Viewer/Options/ColorMapList.vue +75 -50
- package/app/components/Viewer/Options/ColorMapPicker.vue +38 -32
- package/app/components/Viewer/Options/ColorPicker.vue +3 -3
- package/app/components/Viewer/Options/ColoringTypeSelector.vue +29 -21
- package/app/components/Viewer/Options/EdgeAttributeSelector.vue +7 -7
- package/app/components/Viewer/Options/PolygonAttributeSelector.vue +7 -7
- package/app/components/Viewer/Options/PolyhedronAttributeSelector.vue +7 -7
- package/app/components/Viewer/Options/TextureItem.vue +5 -5
- package/app/components/Viewer/Options/TexturesSelector.vue +5 -5
- package/app/components/Viewer/Options/VertexAttributeSelector.vue +7 -7
- package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +5 -5
- package/app/components/Viewer/PolygonalSurface/EdgesOptions.vue +3 -3
- package/app/components/Viewer/PolygonalSurface/PointsOptions.vue +3 -3
- package/app/components/Viewer/PolygonalSurface/SpecificPolygonsOptions.vue +6 -6
- package/app/components/Viewer/Solid/EdgesOptions.vue +3 -3
- package/app/components/Viewer/Solid/PointsOptions.vue +3 -3
- package/app/components/Viewer/Solid/PolygonsOptions.vue +3 -3
- package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +6 -6
- package/app/components/Viewer/TetrahedralSolid/TetrahedraOptions.vue +3 -3
- package/app/components/Viewer/TetrahedralSolid/TrianglesOptions.vue +3 -3
- package/app/components/Viewer/Tree/ObjectTree.vue +7 -9
- package/app/components/Viewer/TreeComponent.vue +9 -13
- package/app/components/Viewer/TreeObject.vue +8 -9
- package/app/components/Viewer/TriangulatedSurface/EdgesOptions.vue +3 -3
- package/app/components/Viewer/TriangulatedSurface/PointsOptions.vue +3 -3
- package/app/components/Viewer/TriangulatedSurface/TrianglesOptions.vue +3 -3
- package/app/components/Wrapper.vue +1 -2
- package/app/components/ZScaling.vue +1 -1
- package/app/composables/project_manager.js +6 -6
- package/app/plugins/auto_store_register.js +1 -1
- package/app/stores/app.js +45 -41
- package/app/stores/data.js +52 -51
- package/app/stores/data_style.js +12 -11
- package/app/stores/feedback.js +5 -1
- package/app/stores/geode.js +16 -13
- package/app/stores/hybrid_viewer.js +72 -44
- package/app/stores/infra.js +18 -16
- package/app/stores/lambda.js +1 -9
- package/app/stores/menu.js +13 -13
- package/app/stores/treeview.js +15 -13
- package/app/stores/viewer.js +39 -33
- package/app/utils/app_mode.js +4 -3
- package/app/utils/default_styles.js +55 -47
- package/app/utils/file_import_workflow.js +4 -17
- package/app/utils/local.js +195 -184
- package/app/utils/upload_file.js +1 -2
- package/eslint.config.js +2 -2
- package/internal/database/database.js +17 -32
- package/internal/database/extended_database.js +25 -0
- package/internal/stores/data_style/mesh/cells/cell.js +3 -3
- package/internal/stores/data_style/mesh/cells/color.js +1 -1
- package/internal/stores/data_style/mesh/cells/index.js +7 -7
- package/internal/stores/data_style/mesh/cells/textures.js +1 -1
- package/internal/stores/data_style/mesh/cells/vertex.js +3 -3
- package/internal/stores/data_style/mesh/cells/visibility.js +1 -1
- package/internal/stores/data_style/mesh/edges/color.js +1 -1
- package/internal/stores/data_style/mesh/edges/edge.js +22 -22
- package/internal/stores/data_style/mesh/edges/index.js +7 -7
- package/internal/stores/data_style/mesh/edges/vertex.js +3 -3
- package/internal/stores/data_style/mesh/edges/visibility.js +1 -1
- package/internal/stores/data_style/mesh/edges/width.js +1 -1
- package/internal/stores/data_style/mesh/index.js +4 -5
- package/internal/stores/data_style/mesh/points/color.js +1 -1
- package/internal/stores/data_style/mesh/points/index.js +6 -6
- package/internal/stores/data_style/mesh/points/size.js +1 -1
- package/internal/stores/data_style/mesh/points/vertex.js +3 -3
- package/internal/stores/data_style/mesh/points/visibility.js +1 -1
- package/internal/stores/data_style/mesh/polygons/color.js +1 -1
- package/internal/stores/data_style/mesh/polygons/index.js +7 -7
- package/internal/stores/data_style/mesh/polygons/polygon.js +3 -3
- package/internal/stores/data_style/mesh/polygons/textures.js +1 -1
- package/internal/stores/data_style/mesh/polygons/vertex.js +3 -3
- package/internal/stores/data_style/mesh/polygons/visibility.js +1 -1
- package/internal/stores/data_style/mesh/polyhedra/color.js +1 -1
- package/internal/stores/data_style/mesh/polyhedra/index.js +6 -6
- package/internal/stores/data_style/mesh/polyhedra/polyhedron.js +3 -3
- package/internal/stores/data_style/mesh/polyhedra/vertex.js +3 -3
- package/internal/stores/data_style/mesh/polyhedra/visibility.js +1 -1
- package/internal/stores/data_style/model/edges.js +1 -1
- package/internal/stores/data_style/model/index.js +32 -22
- package/internal/utils/api_fetch.js +8 -5
- package/internal/utils/viewer_call.js +42 -46
- package/nuxt.config.js +3 -3
- package/package.json +1 -1
- package/scripts/generate_geode_objects.js +8 -7
- package/tests/integration/setup.js +28 -21
- package/tests/integration/stores/data_style/mesh/cells.nuxt.test.js +18 -10
- package/tests/integration/stores/data_style/mesh/edges.nuxt.test.js +18 -10
- package/tests/integration/stores/data_style/mesh/index.nuxt.test.js +9 -5
- package/tests/integration/stores/data_style/mesh/points.nuxt.test.js +17 -10
- package/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js +18 -10
- package/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js +18 -10
- package/tests/integration/stores/data_style/model/blocks.nuxt.test.js +10 -6
- package/tests/integration/stores/data_style/model/corners.nuxt.test.js +10 -6
- package/tests/integration/stores/data_style/model/edges.nuxt.test.js +9 -5
- package/tests/integration/stores/data_style/model/index.nuxt.test.js +9 -5
- package/tests/integration/stores/data_style/model/lines.nuxt.test.js +10 -6
- package/tests/integration/stores/data_style/model/points.nuxt.test.js +9 -5
- package/tests/integration/stores/data_style/model/surfaces.nuxt.test.js +10 -6
- package/tests/integration/stores/viewer.nuxt.test.js +55 -39
- package/tests/setup_indexeddb.js +1 -0
- package/tests/unit/components/CrsSelector.nuxt.test.js +18 -19
- package/tests/unit/components/ExtensionSelector.nuxt.test.js +24 -19
- package/tests/unit/components/FeedBack/ErrorsBanner.nuxt.test.js +23 -36
- package/tests/unit/components/FeedBack/Snackers.nuxt.test.js +20 -25
- package/tests/unit/components/FileSelector.nuxt.test.js +27 -27
- package/tests/unit/components/FileUploader.nuxt.test.js +18 -17
- package/tests/unit/components/Inspector/InspectionButton.nuxt.test.js +9 -16
- package/tests/unit/components/Inspector/ResultPanel.nuxt.test.js +8 -6
- package/tests/unit/components/Launcher.nuxt.test.js +12 -17
- package/tests/unit/components/MissingFilesSelector.nuxt.test.js +16 -19
- package/tests/unit/components/ObjectSelector.nuxt.test.js +30 -34
- package/tests/unit/components/PackagesVersions.nuxt.test.js +8 -11
- package/tests/unit/components/Step.nuxt.test.js +8 -7
- package/tests/unit/components/Stepper.nuxt.test.js +14 -12
- package/tests/unit/composables/ProjectManager.nuxt.test.js +142 -100
- package/tests/unit/composables/api_fetch.nuxt.test.js +12 -39
- package/tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js +36 -61
- package/tests/unit/composables/upload_file.nuxt.test.js +21 -25
- package/tests/unit/plugins/project_load.nuxt.test.js +22 -21
- package/tests/unit/stores/App.nuxt.test.js +45 -43
- package/tests/unit/stores/Feedback.nuxt.test.js +16 -18
- package/tests/unit/stores/Geode.nuxt.test.js +135 -137
- package/tests/unit/stores/Infra.nuxt.test.js +20 -26
- package/tests/unit/stores/Lambda.nuxt.test.js +30 -31
- package/tests/unit/stores/Treeview.nuxt.test.js +53 -55
- package/tests/unit/stores/Viewer.nuxt.test.js +16 -23
- package/tests/unit/utils/validate_schema.nuxt.test.js +18 -18
- package/tests/utils.js +15 -2
- package/tests/vitest.config.js +6 -2
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { describe, expect, test, vi } from "vitest"
|
|
2
|
-
import { registerEndpoint, mountSuspended } from "@nuxt/test-utils/runtime"
|
|
3
|
-
import { flushPromises } from "@vue/test-utils"
|
|
4
1
|
import * as components from "vuetify/components"
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { describe, expect, test } from "vitest"
|
|
3
|
+
import { mountSuspended, registerEndpoint } from "@nuxt/test-utils/runtime"
|
|
4
|
+
import { flushPromises } from "@vue/test-utils"
|
|
7
5
|
|
|
8
|
-
import
|
|
6
|
+
import { setupActivePinia, vuetify } from "../../utils"
|
|
9
7
|
import ObjectSelector from "@ogw_front/components/ObjectSelector"
|
|
8
|
+
import schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
|
|
10
9
|
import { useGeodeStore } from "@ogw_front/stores/geode"
|
|
11
|
-
import { vuetify } from "../../utils"
|
|
12
10
|
|
|
13
|
-
const
|
|
11
|
+
const EXPECTED_LENGTH = 1
|
|
12
|
+
const FIRST_INDEX = 0
|
|
13
|
+
const LOADABLE_SCORE = 1
|
|
14
|
+
const PRIORITY_1 = 1
|
|
15
|
+
const PRIORITY_2 = 2
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
})
|
|
20
|
-
setActivePinia(pinia)
|
|
17
|
+
const { allowed_objects } = schemas.opengeodeweb_back
|
|
18
|
+
|
|
19
|
+
describe(ObjectSelector, () => {
|
|
20
|
+
const pinia = setupActivePinia()
|
|
21
21
|
const geodeStore = useGeodeStore()
|
|
22
22
|
geodeStore.base_url = ""
|
|
23
23
|
|
|
24
24
|
test(`test loadable with one class`, async () => {
|
|
25
|
-
|
|
25
|
+
const response = {
|
|
26
26
|
allowed_objects: {},
|
|
27
27
|
}
|
|
28
28
|
const geode_object_1 = "BRep"
|
|
29
29
|
response["allowed_objects"][geode_object_1] = { is_loadable: true }
|
|
30
30
|
registerEndpoint(allowed_objects.$id, {
|
|
31
|
-
method: allowed_objects.methods[
|
|
31
|
+
method: allowed_objects.methods[FIRST_INDEX],
|
|
32
32
|
handler: () => response,
|
|
33
33
|
})
|
|
34
34
|
const wrapper = await mountSuspended(ObjectSelector, {
|
|
@@ -41,15 +41,15 @@ describe("ObjectSelector", async () => {
|
|
|
41
41
|
const v_img = v_card.findComponent(components.VImg)
|
|
42
42
|
expect(v_img.vm.src).toContain(`${geode_object_1}.svg`)
|
|
43
43
|
expect(wrapper.emitted()).toHaveProperty("update_values")
|
|
44
|
-
expect(wrapper.emitted().update_values).toHaveLength(
|
|
45
|
-
expect(wrapper.emitted().update_values[
|
|
44
|
+
expect(wrapper.emitted().update_values).toHaveLength(EXPECTED_LENGTH)
|
|
45
|
+
expect(wrapper.emitted().update_values[FIRST_INDEX][FIRST_INDEX]).toEqual({
|
|
46
46
|
geode_object_type: geode_object_1,
|
|
47
47
|
})
|
|
48
48
|
wrapper.unmount()
|
|
49
49
|
})
|
|
50
50
|
|
|
51
51
|
test(`test loabable with multiple classes`, async () => {
|
|
52
|
-
|
|
52
|
+
const response = {
|
|
53
53
|
allowed_objects: {},
|
|
54
54
|
}
|
|
55
55
|
const geode_object_1 = "BRep"
|
|
@@ -57,7 +57,7 @@ describe("ObjectSelector", async () => {
|
|
|
57
57
|
response["allowed_objects"][geode_object_1] = { is_loadable: true }
|
|
58
58
|
response["allowed_objects"][geode_object_2] = { is_loadable: true }
|
|
59
59
|
registerEndpoint(allowed_objects.$id, {
|
|
60
|
-
method: allowed_objects.methods[
|
|
60
|
+
method: allowed_objects.methods[FIRST_INDEX],
|
|
61
61
|
handler: () => response,
|
|
62
62
|
})
|
|
63
63
|
const wrapper = await mountSuspended(ObjectSelector, {
|
|
@@ -73,31 +73,27 @@ describe("ObjectSelector", async () => {
|
|
|
73
73
|
await v_card.trigger("click")
|
|
74
74
|
await flushPromises()
|
|
75
75
|
expect(wrapper.emitted()).toHaveProperty("update_values")
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
wrapper.emitted().update_values,
|
|
79
|
-
)
|
|
80
|
-
expect(wrapper.emitted().update_values).toHaveLength(1)
|
|
81
|
-
expect(wrapper.emitted().update_values[0][0]).toEqual({
|
|
76
|
+
expect(wrapper.emitted().update_values).toHaveLength(EXPECTED_LENGTH)
|
|
77
|
+
expect(wrapper.emitted().update_values[FIRST_INDEX][FIRST_INDEX]).toEqual({
|
|
82
78
|
geode_object_type: geode_object_1,
|
|
83
79
|
})
|
|
84
80
|
wrapper.unmount()
|
|
85
81
|
})
|
|
86
82
|
|
|
87
83
|
test(`test object_priority when is_loadable scores equal`, async () => {
|
|
88
|
-
|
|
84
|
+
const response = { allowed_objects: {} }
|
|
89
85
|
const geode_object_1 = "BRep"
|
|
90
86
|
const geode_object_2 = "EdgedCurve3D"
|
|
91
87
|
response["allowed_objects"][geode_object_1] = {
|
|
92
|
-
is_loadable:
|
|
93
|
-
object_priority:
|
|
88
|
+
is_loadable: LOADABLE_SCORE,
|
|
89
|
+
object_priority: PRIORITY_2,
|
|
94
90
|
}
|
|
95
91
|
response["allowed_objects"][geode_object_2] = {
|
|
96
|
-
is_loadable:
|
|
97
|
-
object_priority:
|
|
92
|
+
is_loadable: LOADABLE_SCORE,
|
|
93
|
+
object_priority: PRIORITY_1,
|
|
98
94
|
}
|
|
99
95
|
registerEndpoint(allowed_objects.$id, {
|
|
100
|
-
method: allowed_objects.methods[
|
|
96
|
+
method: allowed_objects.methods[FIRST_INDEX],
|
|
101
97
|
handler: () => response,
|
|
102
98
|
})
|
|
103
99
|
const wrapper = await mountSuspended(ObjectSelector, {
|
|
@@ -109,8 +105,8 @@ describe("ObjectSelector", async () => {
|
|
|
109
105
|
|
|
110
106
|
await flushPromises()
|
|
111
107
|
expect(wrapper.emitted()).toHaveProperty("update_values")
|
|
112
|
-
expect(wrapper.emitted().update_values).toHaveLength(
|
|
113
|
-
expect(wrapper.emitted().update_values[
|
|
108
|
+
expect(wrapper.emitted().update_values).toHaveLength(EXPECTED_LENGTH)
|
|
109
|
+
expect(wrapper.emitted().update_values[FIRST_INDEX][FIRST_INDEX]).toEqual({
|
|
114
110
|
geode_object_type: geode_object_1,
|
|
115
111
|
})
|
|
116
112
|
wrapper.unmount()
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import { describe, expect, test
|
|
1
|
+
import { describe, expect, test } from "vitest"
|
|
2
2
|
import { mountSuspended, registerEndpoint } from "@nuxt/test-utils/runtime"
|
|
3
|
-
import { setActivePinia } from "pinia"
|
|
4
|
-
import { createTestingPinia } from "@pinia/testing"
|
|
5
3
|
|
|
4
|
+
import { setupActivePinia, vuetify } from "../../utils"
|
|
6
5
|
import PackagesVersions from "@ogw_front/components/PackagesVersions"
|
|
7
6
|
import { useGeodeStore } from "@ogw_front/stores/geode"
|
|
8
|
-
import { vuetify } from "../../utils"
|
|
9
7
|
|
|
10
|
-
|
|
8
|
+
const FIRST_INDEX = 0
|
|
9
|
+
|
|
10
|
+
describe(PackagesVersions, async () => {
|
|
11
11
|
test(`Mount`, async () => {
|
|
12
|
-
const pinia =
|
|
13
|
-
createSpy: vi.fn,
|
|
14
|
-
})
|
|
15
|
-
setActivePinia(pinia)
|
|
12
|
+
const pinia = setupActivePinia()
|
|
16
13
|
const geodeStore = useGeodeStore()
|
|
17
14
|
geodeStore.base_url = ""
|
|
18
15
|
|
|
@@ -24,7 +21,7 @@ describe("PackagesVersions", async () => {
|
|
|
24
21
|
additionalProperties: false,
|
|
25
22
|
}
|
|
26
23
|
registerEndpoint(schema.$id, {
|
|
27
|
-
method: schema.methods[
|
|
24
|
+
method: schema.methods[FIRST_INDEX],
|
|
28
25
|
handler: () => ({
|
|
29
26
|
versions: [
|
|
30
27
|
{
|
|
@@ -40,6 +37,6 @@ describe("PackagesVersions", async () => {
|
|
|
40
37
|
},
|
|
41
38
|
props: { schema },
|
|
42
39
|
})
|
|
43
|
-
expect(wrapper.exists()).
|
|
40
|
+
expect(wrapper.exists()).toBeTruthy()
|
|
44
41
|
})
|
|
45
42
|
})
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
import { computed, reactive, ref, shallowRef } from "vue"
|
|
1
2
|
import { describe, expect, test } from "vitest"
|
|
3
|
+
import ResizeObserver from "resize-observer-polyfill"
|
|
2
4
|
import { mount } from "@vue/test-utils"
|
|
3
|
-
|
|
5
|
+
|
|
4
6
|
import ObjectSelector from "@ogw_front/components/ObjectSelector"
|
|
7
|
+
import Step from "@ogw_front/components/Step"
|
|
5
8
|
|
|
6
9
|
import { vuetify } from "../../utils"
|
|
7
10
|
|
|
8
|
-
|
|
11
|
+
globalThis.ResizeObserver = ResizeObserver
|
|
9
12
|
|
|
10
|
-
describe(
|
|
13
|
+
describe(Step, () => {
|
|
11
14
|
test(`BRep`, async () => {
|
|
12
15
|
const geode_object_type = ref("BRep")
|
|
13
16
|
const files = ref([])
|
|
@@ -20,9 +23,7 @@ describe("Step", async () => {
|
|
|
20
23
|
component: {
|
|
21
24
|
component_name: shallowRef(ObjectSelector),
|
|
22
25
|
component_options: {
|
|
23
|
-
filenames: computed(() =>
|
|
24
|
-
return files.value.map((file) => file.name)
|
|
25
|
-
}),
|
|
26
|
+
filenames: computed(() => files.value.map((file) => file.name)),
|
|
26
27
|
key: "",
|
|
27
28
|
},
|
|
28
29
|
},
|
|
@@ -43,6 +44,6 @@ describe("Step", async () => {
|
|
|
43
44
|
},
|
|
44
45
|
props: { step_index: 0 },
|
|
45
46
|
})
|
|
46
|
-
expect(wrapper.exists()).
|
|
47
|
+
expect(wrapper.exists()).toBeTruthy()
|
|
47
48
|
})
|
|
48
49
|
})
|
|
@@ -1,19 +1,24 @@
|
|
|
1
|
+
// Third party imports
|
|
2
|
+
import { computed, reactive, ref, shallowRef } from "vue"
|
|
1
3
|
import { describe, expect, test } from "vitest"
|
|
2
|
-
import
|
|
4
|
+
import ResizeObserver from "resize-observer-polyfill"
|
|
5
|
+
import { mountSuspended } from "@nuxt/test-utils/runtime"
|
|
3
6
|
|
|
4
|
-
|
|
7
|
+
// Local imports
|
|
5
8
|
import ObjectSelector from "@ogw_front/components/ObjectSelector"
|
|
6
|
-
import
|
|
9
|
+
import Stepper from "@ogw_front/components/Stepper"
|
|
7
10
|
import { vuetify } from "../../utils"
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
const FIRST_INDEX = 0
|
|
13
|
+
|
|
14
|
+
globalThis.ResizeObserver = ResizeObserver
|
|
10
15
|
|
|
11
|
-
describe(
|
|
16
|
+
describe(Stepper, () => {
|
|
12
17
|
test(`Mount`, async () => {
|
|
13
18
|
const geode_object_type = ref("BRep")
|
|
14
19
|
const files = ref([])
|
|
15
20
|
const stepper_tree = reactive({
|
|
16
|
-
current_step_index: ref(
|
|
21
|
+
current_step_index: ref(FIRST_INDEX),
|
|
17
22
|
geode_object_type,
|
|
18
23
|
steps: [
|
|
19
24
|
{
|
|
@@ -21,18 +26,15 @@ describe("Stepper", async () => {
|
|
|
21
26
|
component: {
|
|
22
27
|
component_name: shallowRef(ObjectSelector),
|
|
23
28
|
component_options: {
|
|
24
|
-
filenames: computed(() =>
|
|
25
|
-
return files.value.map((file) => file.name)
|
|
26
|
-
}),
|
|
29
|
+
filenames: computed(() => files.value.map((file) => file.name)),
|
|
27
30
|
key: "",
|
|
28
31
|
},
|
|
29
32
|
},
|
|
30
33
|
chips: computed(() => {
|
|
31
34
|
if (geode_object_type.value === "") {
|
|
32
35
|
return []
|
|
33
|
-
} else {
|
|
34
|
-
return [geode_object_type.value]
|
|
35
36
|
}
|
|
37
|
+
return [geode_object_type.value]
|
|
36
38
|
}),
|
|
37
39
|
},
|
|
38
40
|
],
|
|
@@ -43,6 +45,6 @@ describe("Stepper", async () => {
|
|
|
43
45
|
provide: { stepper_tree },
|
|
44
46
|
},
|
|
45
47
|
})
|
|
46
|
-
expect(wrapper.exists()).
|
|
48
|
+
expect(wrapper.exists()).toBeTruthy()
|
|
47
49
|
})
|
|
48
50
|
})
|
|
@@ -1,10 +1,32 @@
|
|
|
1
|
+
// Third party imports
|
|
1
2
|
import { beforeEach, describe, expect, test, vi } from "vitest"
|
|
2
|
-
import { setActivePinia } from "pinia"
|
|
3
|
-
import { createTestingPinia } from "@pinia/testing"
|
|
4
3
|
|
|
5
4
|
// Local imports
|
|
6
|
-
import { useProjectManager } from "@ogw_front/composables/project_manager"
|
|
7
5
|
import { appMode } from "@ogw_front/utils/app_mode"
|
|
6
|
+
import { setupActivePinia } from "../../utils"
|
|
7
|
+
import { useProjectManager } from "@ogw_front/composables/project_manager"
|
|
8
|
+
|
|
9
|
+
// Constants
|
|
10
|
+
const PANEL_WIDTH = 300
|
|
11
|
+
const Z_SCALE = 1.5
|
|
12
|
+
const FOCAL_POINT1 = 1
|
|
13
|
+
const FOCAL_POINT2 = 2
|
|
14
|
+
const FOCAL_POINT3 = 3
|
|
15
|
+
const FOCAL_POINT = [FOCAL_POINT1, FOCAL_POINT2, FOCAL_POINT3]
|
|
16
|
+
const VIEW_UP1 = 0
|
|
17
|
+
const VIEW_UP2 = 1
|
|
18
|
+
const VIEW_UP3 = 0
|
|
19
|
+
const VIEW_UP = [VIEW_UP1, VIEW_UP2, VIEW_UP3]
|
|
20
|
+
const POSITION1 = 10
|
|
21
|
+
const POSITION2 = 11
|
|
22
|
+
const POSITION3 = 12
|
|
23
|
+
const POSITION = [POSITION1, POSITION2, POSITION3]
|
|
24
|
+
const VIEW_ANGLE = 30
|
|
25
|
+
const CLIPPING_RANGE1 = 0.1
|
|
26
|
+
const CLIPPING_RANGE2 = 1000
|
|
27
|
+
const CLIPPING_RANGE = [CLIPPING_RANGE1, CLIPPING_RANGE2]
|
|
28
|
+
const POINT_SIZE = 2
|
|
29
|
+
const VIEWER_CALL_COUNT = 2
|
|
8
30
|
|
|
9
31
|
// Snapshot
|
|
10
32
|
const snapshotMock = {
|
|
@@ -23,10 +45,10 @@ const snapshotMock = {
|
|
|
23
45
|
},
|
|
24
46
|
treeview: {
|
|
25
47
|
isAdditionnalTreeDisplayed: false,
|
|
26
|
-
panelWidth:
|
|
48
|
+
panelWidth: PANEL_WIDTH,
|
|
27
49
|
model_id: "",
|
|
28
50
|
isTreeCollection: false,
|
|
29
|
-
selectedTree:
|
|
51
|
+
selectedTree: undefined,
|
|
30
52
|
selectionIds: [],
|
|
31
53
|
},
|
|
32
54
|
dataStyle: {
|
|
@@ -37,21 +59,21 @@ const snapshotMock = {
|
|
|
37
59
|
coloring: {
|
|
38
60
|
active: "color",
|
|
39
61
|
color: { r: 255, g: 255, b: 255 },
|
|
40
|
-
vertex:
|
|
62
|
+
vertex: undefined,
|
|
41
63
|
},
|
|
42
|
-
size:
|
|
64
|
+
size: POINT_SIZE,
|
|
43
65
|
},
|
|
44
66
|
},
|
|
45
67
|
},
|
|
46
68
|
},
|
|
47
69
|
hybridViewer: {
|
|
48
|
-
zScale:
|
|
70
|
+
zScale: Z_SCALE,
|
|
49
71
|
camera_options: {
|
|
50
|
-
focal_point:
|
|
51
|
-
view_up:
|
|
52
|
-
position:
|
|
53
|
-
view_angle:
|
|
54
|
-
clipping_range:
|
|
72
|
+
focal_point: FOCAL_POINT,
|
|
73
|
+
view_up: VIEW_UP,
|
|
74
|
+
position: POSITION,
|
|
75
|
+
view_angle: VIEW_ANGLE,
|
|
76
|
+
clipping_range: CLIPPING_RANGE,
|
|
55
77
|
},
|
|
56
78
|
},
|
|
57
79
|
}
|
|
@@ -67,56 +89,54 @@ const infraStoreMock = {
|
|
|
67
89
|
ID: "1234",
|
|
68
90
|
}
|
|
69
91
|
const viewerStoreMock = {
|
|
70
|
-
ws_connect: vi.fn(
|
|
92
|
+
ws_connect: vi.fn().mockResolvedValue(),
|
|
71
93
|
base_url: vi.fn(() => ""),
|
|
72
|
-
request: vi.fn(
|
|
94
|
+
request: vi.fn().mockResolvedValue(),
|
|
73
95
|
}
|
|
74
96
|
const treeviewStoreMock = {
|
|
75
97
|
clear: vi.fn(),
|
|
76
|
-
importStores: vi.fn(
|
|
98
|
+
importStores: vi.fn().mockResolvedValue(),
|
|
77
99
|
finalizeImportSelection: vi.fn(),
|
|
78
|
-
addItem: vi.fn(
|
|
100
|
+
addItem: vi.fn().mockResolvedValue(),
|
|
79
101
|
}
|
|
80
102
|
const dataStoreMock = {
|
|
81
103
|
clear: vi.fn(),
|
|
82
|
-
registerObject: vi.fn(
|
|
83
|
-
addItem: vi.fn(
|
|
104
|
+
registerObject: vi.fn().mockResolvedValue(),
|
|
105
|
+
addItem: vi.fn().mockResolvedValue(),
|
|
84
106
|
}
|
|
85
107
|
const dataStyleStoreMock = {
|
|
86
|
-
importStores: vi.fn(
|
|
87
|
-
applyAllStylesFromState: vi.fn(
|
|
88
|
-
addDataStyle: vi.fn(
|
|
89
|
-
applyDefaultStyle: vi.fn(
|
|
108
|
+
importStores: vi.fn().mockResolvedValue(),
|
|
109
|
+
applyAllStylesFromState: vi.fn().mockResolvedValue(),
|
|
110
|
+
addDataStyle: vi.fn().mockResolvedValue(),
|
|
111
|
+
applyDefaultStyle: vi.fn().mockResolvedValue(),
|
|
90
112
|
}
|
|
113
|
+
|
|
114
|
+
const viewer_call_mock_fn = vi.fn().mockResolvedValue()
|
|
115
|
+
|
|
91
116
|
const hybridViewerStoreMock = {
|
|
92
117
|
clear: vi.fn(),
|
|
93
|
-
initHybridViewer: vi.fn(
|
|
94
|
-
importStores: vi.fn(
|
|
95
|
-
if (snapshot?.zScale
|
|
118
|
+
initHybridViewer: vi.fn().mockResolvedValue(),
|
|
119
|
+
importStores: vi.fn((snapshot) => {
|
|
120
|
+
if (snapshot?.zScale !== undefined) {
|
|
96
121
|
hybridViewerStoreMock.setZScaling(snapshot.zScale)
|
|
97
122
|
}
|
|
98
123
|
if (snapshot?.camera_options) {
|
|
99
|
-
|
|
100
|
-
await import("../../../internal/utils/viewer_call")
|
|
101
|
-
viewer_call({
|
|
124
|
+
viewer_call_mock_fn({
|
|
102
125
|
schema: { $id: "opengeodeweb_viewer.viewer.update_camera" },
|
|
103
126
|
params: { camera_options: snapshot.camera_options },
|
|
104
127
|
})
|
|
105
128
|
hybridViewerStoreMock.remoteRender()
|
|
106
129
|
}
|
|
107
130
|
}),
|
|
108
|
-
addItem: vi.fn(
|
|
131
|
+
addItem: vi.fn().mockResolvedValue(),
|
|
109
132
|
remoteRender: vi.fn(),
|
|
110
133
|
setZScaling: vi.fn(),
|
|
111
134
|
}
|
|
112
135
|
|
|
113
|
-
//
|
|
114
|
-
vi.stubGlobal(
|
|
115
|
-
"$fetch",
|
|
116
|
-
vi.fn(async () => ({ snapshot: snapshotMock })),
|
|
117
|
-
)
|
|
136
|
+
// MOCKS
|
|
137
|
+
vi.stubGlobal("$fetch", vi.fn().mockResolvedValue({ snapshot: snapshotMock }))
|
|
118
138
|
vi.mock("../../../internal/utils/viewer_call", () => ({
|
|
119
|
-
viewer_call:
|
|
139
|
+
viewer_call: viewer_call_mock_fn,
|
|
120
140
|
}))
|
|
121
141
|
|
|
122
142
|
vi.mock("@ogw_front/composables/api_fetch", () => ({
|
|
@@ -124,10 +144,12 @@ vi.mock("@ogw_front/composables/api_fetch", () => ({
|
|
|
124
144
|
const response = {
|
|
125
145
|
_data: new Blob(["zipcontent"], { type: "application/zip" }),
|
|
126
146
|
headers: {
|
|
127
|
-
get: (k) => (k === "new-file-name" ? "project_123.vease" :
|
|
147
|
+
get: (k) => (k === "new-file-name" ? "project_123.vease" : undefined),
|
|
128
148
|
},
|
|
129
149
|
}
|
|
130
|
-
if (options.response_function)
|
|
150
|
+
if (options.response_function) {
|
|
151
|
+
await options.response_function(response)
|
|
152
|
+
}
|
|
131
153
|
return response
|
|
132
154
|
}),
|
|
133
155
|
}))
|
|
@@ -163,9 +185,9 @@ vi.stubGlobal("useAppStore", () => ({
|
|
|
163
185
|
exportStores: vi.fn(() => ({ projectName: "mockedProject" })),
|
|
164
186
|
}))
|
|
165
187
|
|
|
166
|
-
const mockLockRequest = vi
|
|
167
|
-
|
|
168
|
-
})
|
|
188
|
+
const mockLockRequest = vi
|
|
189
|
+
.fn()
|
|
190
|
+
.mockImplementation(async (name, task) => await task({ name }))
|
|
169
191
|
|
|
170
192
|
vi.stubGlobal("navigator", {
|
|
171
193
|
...navigator,
|
|
@@ -174,37 +196,85 @@ vi.stubGlobal("navigator", {
|
|
|
174
196
|
},
|
|
175
197
|
})
|
|
176
198
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
199
|
+
function verifyViewerCalls() {
|
|
200
|
+
expect(viewerStoreMock.ws_connect).toHaveBeenCalledWith()
|
|
201
|
+
expect(viewer_call_mock_fn).toHaveBeenCalledTimes(VIEWER_CALL_COUNT)
|
|
202
|
+
}
|
|
181
203
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
204
|
+
function verifyStoreImports() {
|
|
205
|
+
expect(treeviewStoreMock.importStores).toHaveBeenCalledWith(
|
|
206
|
+
snapshotMock.treeview,
|
|
207
|
+
)
|
|
208
|
+
expect(hybridViewerStoreMock.initHybridViewer).toHaveBeenCalledWith()
|
|
209
|
+
expect(hybridViewerStoreMock.importStores).toHaveBeenCalledWith(
|
|
210
|
+
snapshotMock.hybridViewer,
|
|
211
|
+
)
|
|
212
|
+
expect(hybridViewerStoreMock.setZScaling).toHaveBeenCalledWith(Z_SCALE)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function verifyDataManagement() {
|
|
216
|
+
expect(dataStyleStoreMock.importStores).toHaveBeenCalledWith(
|
|
217
|
+
snapshotMock.dataStyle,
|
|
218
|
+
)
|
|
219
|
+
expect(dataStyleStoreMock.applyAllStylesFromState).toHaveBeenCalledWith()
|
|
220
|
+
expect(dataStoreMock.registerObject).toHaveBeenCalledWith("abc123")
|
|
221
|
+
expect(dataStoreMock.addItem).toHaveBeenCalledWith(
|
|
222
|
+
"abc123",
|
|
223
|
+
expect.anything(),
|
|
224
|
+
)
|
|
225
|
+
expect(treeviewStoreMock.addItem).toHaveBeenCalledWith(
|
|
226
|
+
"PointSet2D",
|
|
227
|
+
"My Data",
|
|
228
|
+
"abc123",
|
|
229
|
+
"mesh",
|
|
230
|
+
)
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function verifyRemaining() {
|
|
234
|
+
expect(hybridViewerStoreMock.addItem).toHaveBeenCalledWith("abc123")
|
|
235
|
+
expect(dataStyleStoreMock.addDataStyle).toHaveBeenCalledWith(
|
|
236
|
+
"abc123",
|
|
237
|
+
"PointSet2D",
|
|
238
|
+
)
|
|
239
|
+
expect(dataStyleStoreMock.applyDefaultStyle).toHaveBeenCalledWith("abc123")
|
|
240
|
+
expect(hybridViewerStoreMock.remoteRender).toHaveBeenCalledWith()
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
beforeEach(() => {
|
|
244
|
+
setupActivePinia()
|
|
245
|
+
// reset spies
|
|
246
|
+
const storesList = [
|
|
247
|
+
viewerStoreMock,
|
|
248
|
+
treeviewStoreMock,
|
|
249
|
+
dataStoreMock,
|
|
250
|
+
dataStyleStoreMock,
|
|
251
|
+
hybridViewerStoreMock,
|
|
252
|
+
]
|
|
253
|
+
for (const store of storesList) {
|
|
254
|
+
const values = Object.values(store)
|
|
255
|
+
for (const value of values) {
|
|
256
|
+
if (typeof value === "function" && value.mockClear) {
|
|
257
|
+
value.mockClear()
|
|
258
|
+
}
|
|
193
259
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
260
|
+
}
|
|
261
|
+
viewer_call_mock_fn.mockClear()
|
|
262
|
+
})
|
|
197
263
|
|
|
264
|
+
describe("projectManager composable (compact)", () => {
|
|
198
265
|
test("exportProject", async () => {
|
|
199
266
|
const { exportProject } = useProjectManager()
|
|
200
267
|
const { default: fileDownload } = await import("js-file-download")
|
|
201
268
|
|
|
202
269
|
await exportProject()
|
|
203
270
|
|
|
204
|
-
expect(fileDownload).
|
|
271
|
+
expect(fileDownload).toHaveBeenCalledWith(
|
|
272
|
+
{ snapshot: snapshotMock },
|
|
273
|
+
"project.vease",
|
|
274
|
+
)
|
|
205
275
|
})
|
|
206
276
|
|
|
207
|
-
test("importProjectFile with snapshot", async () => {
|
|
277
|
+
test("importProjectFile with snapshot - Viewer and Stores", async () => {
|
|
208
278
|
const { importProjectFile } = useProjectManager()
|
|
209
279
|
const file = new Blob(['{"dataBase":{"db":{}}}'], {
|
|
210
280
|
type: "application/json",
|
|
@@ -212,47 +282,19 @@ describe("ProjectManager composable (compact)", () => {
|
|
|
212
282
|
|
|
213
283
|
await importProjectFile(file)
|
|
214
284
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
expect(viewer_call).toHaveBeenCalledTimes(2)
|
|
219
|
-
|
|
220
|
-
expect(treeviewStoreMock.importStores).toHaveBeenCalledWith(
|
|
221
|
-
snapshotMock.treeview,
|
|
222
|
-
)
|
|
223
|
-
expect(hybridViewerStoreMock.initHybridViewer).toHaveBeenCalled()
|
|
224
|
-
expect(hybridViewerStoreMock.importStores).toHaveBeenCalledWith(
|
|
225
|
-
snapshotMock.hybridViewer,
|
|
226
|
-
)
|
|
227
|
-
expect(hybridViewerStoreMock.setZScaling).toHaveBeenCalledWith(1.5)
|
|
285
|
+
verifyViewerCalls()
|
|
286
|
+
verifyStoreImports()
|
|
287
|
+
})
|
|
228
288
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
289
|
+
test("importProjectFile with snapshot - Data and Rendering", async () => {
|
|
290
|
+
const { importProjectFile } = useProjectManager()
|
|
291
|
+
const file = new Blob(['{"dataBase":{"db":{}}}'], {
|
|
292
|
+
type: "application/json",
|
|
293
|
+
})
|
|
233
294
|
|
|
234
|
-
|
|
235
|
-
expect(dataStoreMock.addItem).toHaveBeenCalledWith(
|
|
236
|
-
"abc123",
|
|
237
|
-
expect.objectContaining({
|
|
238
|
-
viewer_type: "mesh",
|
|
239
|
-
geode_object_type: "PointSet2D",
|
|
240
|
-
name: "My Data",
|
|
241
|
-
}),
|
|
242
|
-
)
|
|
243
|
-
expect(treeviewStoreMock.addItem).toHaveBeenCalledWith(
|
|
244
|
-
"PointSet2D",
|
|
245
|
-
"My Data",
|
|
246
|
-
"abc123",
|
|
247
|
-
"mesh",
|
|
248
|
-
)
|
|
249
|
-
expect(hybridViewerStoreMock.addItem).toHaveBeenCalledWith("abc123")
|
|
250
|
-
expect(dataStyleStoreMock.addDataStyle).toHaveBeenCalledWith(
|
|
251
|
-
"abc123",
|
|
252
|
-
"PointSet2D",
|
|
253
|
-
)
|
|
254
|
-
expect(dataStyleStoreMock.applyDefaultStyle).toHaveBeenCalledWith("abc123")
|
|
295
|
+
await importProjectFile(file)
|
|
255
296
|
|
|
256
|
-
|
|
297
|
+
verifyDataManagement()
|
|
298
|
+
verifyRemaining()
|
|
257
299
|
})
|
|
258
300
|
})
|