@itwin/grouping-mapping-widget 0.9.0 → 0.9.2

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.
Files changed (85) hide show
  1. package/lib/cjs/test/GroupPropertyUtils.test.js +61 -1
  2. package/lib/cjs/test/GroupPropertyUtils.test.js.map +1 -1
  3. package/lib/cjs/test/GroupingMappingCustomUI.test.js +44 -53
  4. package/lib/cjs/test/GroupingMappingCustomUI.test.js.map +1 -1
  5. package/lib/cjs/test/QueryBuilder.test.js +30 -2
  6. package/lib/cjs/test/QueryBuilder.test.js.map +1 -1
  7. package/lib/cjs/test/QueryBuilder.testdata.js +471 -7
  8. package/lib/cjs/test/QueryBuilder.testdata.js.map +1 -1
  9. package/lib/cjs/test/QueryBuilderTestData.d.ts +3 -1
  10. package/lib/cjs/test/QueryBuilderTestData.js.map +1 -1
  11. package/lib/cjs/widget/components/GroupAction.js +2 -21
  12. package/lib/cjs/widget/components/GroupAction.js.map +1 -1
  13. package/lib/cjs/widget/components/GroupPropertyUtils.js +2 -1
  14. package/lib/cjs/widget/components/GroupPropertyUtils.js.map +1 -1
  15. package/lib/cjs/widget/components/GroupQueryBuilderContainer.d.ts +3 -2
  16. package/lib/cjs/widget/components/GroupQueryBuilderContainer.js +38 -45
  17. package/lib/cjs/widget/components/GroupQueryBuilderContainer.js.map +1 -1
  18. package/lib/cjs/widget/components/Grouping.js +1 -1
  19. package/lib/cjs/widget/components/Grouping.js.map +1 -1
  20. package/lib/cjs/widget/components/Grouping.scss +1 -1
  21. package/lib/cjs/widget/components/QueryBuilder.d.ts +35 -21
  22. package/lib/cjs/widget/components/QueryBuilder.js +153 -181
  23. package/lib/cjs/widget/components/QueryBuilder.js.map +1 -1
  24. package/lib/cjs/widget/components/context/PropertyGridWrapperContext.d.ts +15 -0
  25. package/lib/cjs/widget/components/context/{GroupQueryBuilderContext.js → PropertyGridWrapperContext.js} +13 -9
  26. package/lib/cjs/widget/components/context/PropertyGridWrapperContext.js.map +1 -0
  27. package/lib/cjs/widget/components/property-grid/PropertyGrid.d.ts +1 -1
  28. package/lib/cjs/widget/components/property-grid/PropertyGrid.js +2 -2
  29. package/lib/cjs/widget/components/property-grid/PropertyGrid.js.map +1 -1
  30. package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.d.ts +10 -4
  31. package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js +18 -8
  32. package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js.map +1 -1
  33. package/lib/cjs/widget/components/property-grid/PropertyView.d.ts +1 -1
  34. package/lib/cjs/widget/components/property-grid/PropertyView.js +46 -60
  35. package/lib/cjs/widget/components/property-grid/PropertyView.js.map +1 -1
  36. package/lib/cjs/widget/components/viewerUtils.js +1 -3
  37. package/lib/cjs/widget/components/viewerUtils.js.map +1 -1
  38. package/lib/esm/test/GroupPropertyUtils.test.js +61 -1
  39. package/lib/esm/test/GroupPropertyUtils.test.js.map +1 -1
  40. package/lib/esm/test/GroupingMappingCustomUI.test.js +45 -54
  41. package/lib/esm/test/GroupingMappingCustomUI.test.js.map +1 -1
  42. package/lib/esm/test/QueryBuilder.test.js +31 -3
  43. package/lib/esm/test/QueryBuilder.test.js.map +1 -1
  44. package/lib/esm/test/QueryBuilder.testdata.js +471 -7
  45. package/lib/esm/test/QueryBuilder.testdata.js.map +1 -1
  46. package/lib/esm/test/QueryBuilderTestData.d.ts +3 -1
  47. package/lib/esm/test/QueryBuilderTestData.js.map +1 -1
  48. package/lib/esm/widget/components/GroupAction.js +2 -21
  49. package/lib/esm/widget/components/GroupAction.js.map +1 -1
  50. package/lib/esm/widget/components/GroupPropertyUtils.js +2 -1
  51. package/lib/esm/widget/components/GroupPropertyUtils.js.map +1 -1
  52. package/lib/esm/widget/components/GroupQueryBuilderContainer.d.ts +3 -2
  53. package/lib/esm/widget/components/GroupQueryBuilderContainer.js +34 -25
  54. package/lib/esm/widget/components/GroupQueryBuilderContainer.js.map +1 -1
  55. package/lib/esm/widget/components/Grouping.js +1 -1
  56. package/lib/esm/widget/components/Grouping.js.map +1 -1
  57. package/lib/esm/widget/components/Grouping.scss +1 -1
  58. package/lib/esm/widget/components/QueryBuilder.d.ts +35 -21
  59. package/lib/esm/widget/components/QueryBuilder.js +153 -181
  60. package/lib/esm/widget/components/QueryBuilder.js.map +1 -1
  61. package/lib/esm/widget/components/context/PropertyGridWrapperContext.d.ts +15 -0
  62. package/lib/esm/widget/components/context/{GroupQueryBuilderContext.js → PropertyGridWrapperContext.js} +11 -8
  63. package/lib/esm/widget/components/context/PropertyGridWrapperContext.js.map +1 -0
  64. package/lib/esm/widget/components/property-grid/PropertyGrid.d.ts +1 -1
  65. package/lib/esm/widget/components/property-grid/PropertyGrid.js +2 -2
  66. package/lib/esm/widget/components/property-grid/PropertyGrid.js.map +1 -1
  67. package/lib/esm/widget/components/property-grid/PropertyGridWrapper.d.ts +10 -4
  68. package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js +16 -6
  69. package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js.map +1 -1
  70. package/lib/esm/widget/components/property-grid/PropertyView.d.ts +1 -1
  71. package/lib/esm/widget/components/property-grid/PropertyView.js +32 -30
  72. package/lib/esm/widget/components/property-grid/PropertyView.js.map +1 -1
  73. package/lib/esm/widget/components/viewerUtils.js +1 -3
  74. package/lib/esm/widget/components/viewerUtils.js.map +1 -1
  75. package/package.json +2 -2
  76. package/lib/cjs/api/GroupQueryBuilderApi.d.ts +0 -15
  77. package/lib/cjs/api/GroupQueryBuilderApi.js +0 -27
  78. package/lib/cjs/api/GroupQueryBuilderApi.js.map +0 -1
  79. package/lib/cjs/widget/components/context/GroupQueryBuilderContext.d.ts +0 -16
  80. package/lib/cjs/widget/components/context/GroupQueryBuilderContext.js.map +0 -1
  81. package/lib/esm/api/GroupQueryBuilderApi.d.ts +0 -15
  82. package/lib/esm/api/GroupQueryBuilderApi.js +0 -23
  83. package/lib/esm/api/GroupQueryBuilderApi.js.map +0 -1
  84. package/lib/esm/widget/components/context/GroupQueryBuilderContext.d.ts +0 -16
  85. package/lib/esm/widget/components/context/GroupQueryBuilderContext.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"GroupingMappingCustomUI.test.js","sourceRoot":"","sources":["../../../src/test/GroupingMappingCustomUI.test.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,yBAAyB,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAChI,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,KAAK,GAAG,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAElF,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAEzE,MAAM,WAAW,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC1C,MAAM,YAAY,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC3C,MAAM,aAAa,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC5C,MAAM,WAAW,GAAY;IAC3B,EAAE,EAAE,aAAa;IACjB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,yBAAyB;IACtC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE;IAC/B,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,YAAY,EAAE;IAC3C,UAAU,EAA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CAAC,CAAC;QACzC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;QACtD,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;QAC5D,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QACxD,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;QAE1E,0BAA0B;QAC1B,MAAM,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport React from \"react\";\nimport \"@testing-library/jest-dom\";\nimport { mockAccessToken, mockMappingClient, render, screen, TestUtils, waitForElementToBeRemoved, within } from \"./test-utils\";\nimport { faker } from \"@faker-js/faker\";\nimport { Groupings } from \"../grouping-mapping-widget\";\nimport type { GroupCollection, Mapping } from \"@itwin/insights-client\";\nimport * as moq from \"typemoq\";\nimport type { IModelConnection, SelectionSet, SelectionSetEvent} from \"@itwin/core-frontend\";\nimport { NoRenderApp } from \"@itwin/core-frontend\";\nimport type { SelectionManager, SelectionScopesManager } from \"@itwin/presentation-frontend\";\nimport { Presentation, SelectionChangeEvent } from \"@itwin/presentation-frontend\";\nimport type { BeEvent } from \"@itwin/core-bentley\";\nimport { EmptyLocalization } from \"@itwin/core-common\";\nimport type { ContextCustomUIProps, GroupingCustomUIProps, GroupingMappingCustomUI} from \"../grouping-mapping-widget\";\nimport { GroupingMappingCustomUIType } from \"../grouping-mapping-widget\";\n\nconst mockITwinId = faker.datatype.uuid();\nconst mockIModelId = faker.datatype.uuid();\nconst mockMappingId = faker.datatype.uuid();\nconst mockMapping: Mapping = {\n id: mockMappingId,\n mappingName: \"mOcKmApPiNg1\",\n description: \"mOcKmApPiNgDeScRiPtIoN1\",\n createdBy: faker.random.alpha(),\n createdOn: faker.date.past().toDateString(),\n modifiedBy: faker.random.alpha(),\n modifiedOn: faker.date.past().toDateString(),\n extractionEnabled:false,\n _links: {\n imodel: {\n href: \"\",\n },\n },\n};\n\nconst groupsFactory = (): GroupCollection => ({\n groups: Array.from(\n { length: faker.datatype.number({ min: 3, max: 5 }) },\n (_, index) => ({\n id: `${faker.datatype.uuid()}`,\n groupName: `mOcKgRoUp${index}`,\n description: `mOcKgRoUpDeScRiPtIoN${index}`,\n query: `mOcKgRoUpQuErY${index}`,\n _links: {\n imodel: {\n href: \"\",\n },\n mapping: {\n href: \"\",\n },\n },\n })\n ),\n _links: {\n next: undefined,\n self: {\n href: \"\",\n },\n },\n});\n\nconst connectionMock = moq.Mock.ofType<IModelConnection>();\nconst selectionManagerMock = moq.Mock.ofType<SelectionManager>();\nconst selectionScopesManagerMock = moq.Mock.ofType<SelectionScopesManager>();\n\njest.mock(\"@itwin/appui-react\", () => ({\n ...jest.requireActual(\"@itwin/appui-react\"),\n useActiveIModelConnection: () => connectionMock.object,\n}));\n\nbeforeAll(async () => {\n await NoRenderApp.startup({localization: new EmptyLocalization()});\n await Presentation.initialize();\n const selectionSet = moq.Mock.ofType<SelectionSet>();\n const onChanged = moq.Mock.ofType<BeEvent<(ev: SelectionSetEvent) => void>>();\n selectionSet.setup((x) => x.elements).returns(() => new Set([]));\n selectionSet.setup((x) => x.onChanged).returns(() => onChanged.object);\n connectionMock\n .setup((x) => x.selectionSet)\n .returns(() => selectionSet.object);\n connectionMock.setup((x) => x.iModelId).returns(() => mockIModelId);\n connectionMock.setup((x) => x.iTwinId).returns(() => mockITwinId);\n\n selectionManagerMock\n .setup((x) => x.selectionChange)\n .returns(() => new SelectionChangeEvent());\n\n selectionScopesManagerMock\n .setup(async (x) => x.getSelectionScopes(connectionMock.object))\n .returns(async () => []);\n selectionManagerMock\n .setup((x) => x.scopes)\n .returns(() => selectionScopesManagerMock.object);\n\n Presentation.setSelectionManager(selectionManagerMock.object);\n await TestUtils.initializeUiFramework(connectionMock.object);\n});\n\ndescribe(\"Groupings View with default UIs\", () => {\n it(\"List all groups and click on add group and edit group buttons\", async () => {\n // Arange\n const mockGroups = groupsFactory();\n const mockedAccessToken = await mockAccessToken();\n mockMappingClient\n .setup(async (x) => x.getGroups(mockedAccessToken, mockIModelId, mockMappingId))\n .returns(async () => mockGroups.groups);\n\n // Act\n const { user } = render(<Groupings mapping={mockMapping} goBack={jest.fn()} />);\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n const addButton = screen.getAllByTestId(\"gmw-add-group-button\");\n expect(addButton).toHaveLength(1);\n\n // Click on 'Add Group' button\n await user.click(addButton[0]);\n\n // Should have three menu items\n const addSelection = screen.getAllByTestId(\"gmw-add-0\");\n expect(addSelection).toHaveLength(1);\n const addSearch = screen.getAllByTestId(\"gmw-add-1\");\n expect(addSearch).toHaveLength(1);\n const addManual = screen.getAllByTestId(\"gmw-add-2\");\n expect(addManual).toHaveLength(1);\n\n // Should have the right group number\n const horizontalTiles = screen.getAllByTestId(\"gmw-horizontal-tile\");\n expect(horizontalTiles).toHaveLength(mockGroups.groups.length);\n\n horizontalTiles.forEach((horizontalTile, index) => {\n const groupTile = within(horizontalTile);\n expect(\n groupTile.getByText(\n mockGroups.groups[index].groupName\n )\n ).toBeInTheDocument();\n expect(\n groupTile.getByText(\n mockGroups.groups[index].description ?? \"\"\n )\n ).toBeInTheDocument();\n });\n\n // Click on first group more icon\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n\n await user.click(moreButton[0]);\n\n // Should have 3 context menu items\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n expect(contextMenuItems).toHaveLength(3);\n expect(contextMenuItems[0]).toHaveTextContent(\"Edit\");\n expect(contextMenuItems[1]).toHaveTextContent(\"Properties\");\n expect(contextMenuItems[2]).toHaveTextContent(\"Remove\");\n\n // Hover on 'Edit'\n await user.hover(contextMenuItems[0]);\n\n // Should have 3 sub menu items\n const editSelection = screen.getAllByTestId(`gmw-edit-0`);\n expect(editSelection).toHaveLength(1);\n const editSearch = screen.getAllByTestId(`gmw-edit-1`);\n expect(editSearch).toHaveLength(1);\n const editManual = screen.getAllByTestId(`gmw-edit-2`);\n expect(editManual).toHaveLength(1);\n });\n\n it(\"Set up grouping custom UI - should replace default grouping methods\", async () => {\n // Arange\n const mockGroups = groupsFactory();\n const mockedAccessToken = await mockAccessToken();\n mockMappingClient\n .setup(async (x) => x.getGroups(mockedAccessToken, mockIModelId, mockMappingId))\n .returns(async () => mockGroups.groups);\n const mockedUIComponent = (_props: GroupingCustomUIProps) => React.createElement(\"div\");\n const mockGroupingUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Grouping,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedUIComponent,\n };\n\n // Act\n const { user } = render(<Groupings mapping={mockMapping} goBack={jest.fn()} />, [mockGroupingUI]);\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n const addButton = screen.getAllByTestId(\"gmw-add-group-button\");\n expect(addButton).toHaveLength(1);\n\n // Click on 'Add Group' button\n await user.click(addButton[0]);\n\n // Should have exactly 1 add method with given configuration\n const addCustom = screen.getAllByTestId(\"gmw-add-0\");\n expect(addCustom).toHaveLength(1);\n expect(addCustom[0]).toHaveTextContent(mockGroupingUI.displayLabel);\n\n // Each group should have a more icon button\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n expect(moreButton.length).toBeGreaterThan(0);\n\n // Click on first more icon\n await user.click(moreButton[0]);\n\n // Should have 3 context menu items without context configuration\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n expect(contextMenuItems).toHaveLength(3);\n expect(contextMenuItems[0]).toHaveTextContent(\"Edit\");\n\n // Hover on 'Edit'\n await user.hover(contextMenuItems[0]);\n\n // Should have exactly 1 sub menu item\n const editCustom = screen.getAllByTestId(`gmw-edit-0`);\n expect(editCustom).toHaveLength(1);\n expect(editCustom[0]).toHaveTextContent(mockGroupingUI.displayLabel);\n\n // Click on the edit custom UI\n await user.click(editCustom[0]);\n\n const groupName = screen.getAllByText(mockGroups.groups[0].groupName);\n expect(groupName).toHaveLength(1);\n });\n\n it(\"Set up context custom UI - should have default grouping methods and add context menu\", async () => {\n // Arange\n const mockGroups = groupsFactory();\n const mockedAccessToken = await mockAccessToken();\n mockMappingClient\n .setup(async (x) => x.getGroups(mockedAccessToken, mockIModelId, mockMappingId))\n .returns(async () => mockGroups.groups);\n const mockedUIComponent = (_props: ContextCustomUIProps) => React.createElement(\"div\");\n const mockContextUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Context,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedUIComponent,\n };\n\n // Act\n const { user } = render(<Groupings mapping={mockMapping} goBack={jest.fn()} />, [mockContextUI]);\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n const addButton = screen.getAllByTestId(\"gmw-add-group-button\");\n expect(addButton).toHaveLength(1);\n\n // Click on 'Add Group' button\n await user.click(addButton[0]);\n\n // Should have three menu items\n const addSelection = screen.getAllByTestId(\"gmw-add-0\");\n expect(addSelection).toHaveLength(1);\n const addSearch = screen.getAllByTestId(\"gmw-add-1\");\n expect(addSearch).toHaveLength(1);\n const addManual = screen.getAllByTestId(\"gmw-add-2\");\n expect(addManual).toHaveLength(1);\n\n // Should have the right group number\n const horizontalTiles = screen.getAllByTestId(\"gmw-horizontal-tile\");\n expect(horizontalTiles).toHaveLength(mockGroups.groups.length);\n\n // Click on first group more icon\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n\n await user.click(moreButton[0]);\n\n // Should have 4 context menu items\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n expect(contextMenuItems).toHaveLength(4);\n expect(contextMenuItems[0]).toHaveTextContent(\"Edit\");\n expect(contextMenuItems[1]).toHaveTextContent(\"Properties\");\n expect(contextMenuItems[2]).toHaveTextContent(\"Remove\");\n expect(contextMenuItems[3]).toHaveTextContent(mockContextUI.displayLabel);\n\n // Click on the context ui\n await user.click(contextMenuItems[3]);\n });\n\n it(\"Set up both grouping and context custom UI\", async () => {\n // Arange\n const mockGroups = groupsFactory();\n const mockedAccessToken = await mockAccessToken();\n mockMappingClient\n .setup(async (x) => x.getGroups(mockedAccessToken, mockIModelId, mockMappingId))\n .returns(async () => mockGroups.groups);\n const mockedGroupingUIComponent = (_props: GroupingCustomUIProps) => React.createElement(\"div\");\n const mockedContextUIComponent = (_props: ContextCustomUIProps) => React.createElement(\"div\");\n const mockGroupingUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Grouping,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedGroupingUIComponent,\n };\n const mockContextUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Context,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedContextUIComponent,\n };\n\n // Act\n const { user } = render(<Groupings mapping={mockMapping} goBack={jest.fn()} />, [mockContextUI, mockGroupingUI]);\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n const addButton = screen.getAllByTestId(\"gmw-add-group-button\");\n expect(addButton).toHaveLength(1);\n\n // Click on 'Add Group' button\n await user.click(addButton[0]);\n\n // Should have exactly 1 add method with given configuration\n const addCustom = screen.getAllByTestId(\"gmw-add-0\");\n expect(addCustom).toHaveLength(1);\n expect(addCustom[0]).toHaveTextContent(mockGroupingUI.displayLabel);\n\n // Check the group tile number\n const horizontalTiles = screen.getAllByTestId(\"gmw-horizontal-tile\");\n expect(horizontalTiles).toHaveLength(mockGroups.groups.length);\n\n // Click on first group more icon\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n\n await user.click(moreButton[0]);\n\n // Should have 4 context menu items\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n expect(contextMenuItems).toHaveLength(4);\n expect(contextMenuItems[0]).toHaveTextContent(\"Edit\");\n expect(contextMenuItems[1]).toHaveTextContent(\"Properties\");\n expect(contextMenuItems[2]).toHaveTextContent(\"Remove\");\n expect(contextMenuItems[3]).toHaveTextContent(mockContextUI.displayLabel);\n\n // Click on the context ui\n await user.click(contextMenuItems[3]);\n });\n});\n"]}
1
+ {"version":3,"file":"GroupingMappingCustomUI.test.js","sourceRoot":"","sources":["../../../src/test/GroupingMappingCustomUI.test.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,yBAAyB,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,KAAK,GAAG,MAAM,SAAS,CAAC;AAG/B,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,SAAS,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,MAAM,WAAW,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC1C,MAAM,YAAY,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CA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,CAAC;QAC5D,MAAM,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAE1D,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;QAEhC,mCAAmC;QACnC,MAAM,gBAAgB,GAAG,MAAM,CAAC,cAAc,CAAC,uBAAuB,CAAC,CAAC;QACxE,MAAM,CAAC,gBAAgB,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACzC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;QACtD,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;QAC5D,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QACxD,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;QAE1E,0BAA0B;QAC1B,MAAM,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport React from \"react\";\nimport \"@testing-library/jest-dom\";\nimport { screen, waitForElementToBeRemoved, within } from \"./test-utils\";\nimport { faker } from \"@faker-js/faker\";\nimport { Groupings } from \"../grouping-mapping-widget\";\nimport type { GroupCollection, IMappingsClient, Mapping } from \"@itwin/insights-client\";\nimport * as moq from \"typemoq\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport type { ContextCustomUIProps, GroupingCustomUIProps, GroupingMappingCustomUI } from \"../grouping-mapping-widget\";\nimport { GroupingMappingCustomUIType } from \"../grouping-mapping-widget\";\nimport userEvent from \"@testing-library/user-event\";\nimport { render } from \"@testing-library/react\";\n\nconst mockITwinId = faker.datatype.uuid();\nconst mockIModelId = faker.datatype.uuid();\nconst mockMappingId = faker.datatype.uuid();\nconst mockMapping: Mapping = {\n id: mockMappingId,\n mappingName: \"mOcKmApPiNg1\",\n description: \"mOcKmApPiNgDeScRiPtIoN1\",\n createdBy: faker.random.alpha(),\n createdOn: faker.date.past().toDateString(),\n modifiedBy: faker.random.alpha(),\n modifiedOn: faker.date.past().toDateString(),\n extractionEnabled: false,\n _links: {\n imodel: {\n href: \"\",\n },\n },\n};\n\nconst groupsFactory = (): GroupCollection => ({\n groups: Array.from(\n { length: faker.datatype.number({ min: 3, max: 5 }) },\n (_, index) => ({\n id: `${faker.datatype.uuid()}`,\n groupName: `mOcKgRoUp${index}`,\n description: `mOcKgRoUpDeScRiPtIoN${index}`,\n query: `mOcKgRoUpQuErY${index}`,\n _links: {\n imodel: {\n href: \"\",\n },\n mapping: {\n href: \"\",\n },\n },\n })\n ),\n _links: {\n next: undefined,\n self: {\n href: \"\",\n },\n },\n});\n\nconst connectionMock = moq.Mock.ofType<IModelConnection>();\nlet groupingMappingCustomUIMock: GroupingMappingCustomUI[] = [];\nconst mappingClientMock = moq.Mock.ofType<IMappingsClient>();\n\njest.mock(\"@itwin/appui-react\", () => ({\n ...jest.requireActual(\"@itwin/appui-react\"),\n useActiveIModelConnection: () => connectionMock.object,\n}));\n\nconst mockAccessToken = jest.fn().mockResolvedValue(\"Bearer eyJhbGci\");\n\njest.mock(\"../widget/components/context/GroupingApiConfigContext\", () => ({\n ...jest.requireActual(\"../widget/components/context/GroupingApiConfigContext\"),\n useGroupingMappingApiConfig: () => ({\n getAccessToken: mockAccessToken,\n }),\n}));\n\njest.mock(\"../widget/components/context/GroupingMappingCustomUIContext\", () => ({\n ...jest.requireActual(\"../widget/components/context/GroupingMappingCustomUIContext\"),\n useGroupingMappingCustomUI: () => groupingMappingCustomUIMock,\n}));\n\njest.mock(\"../widget/components/context/MappingClientContext\", () => ({\n ...jest.requireActual(\"../widget/components/context/MappingClientContext\"),\n useMappingClient: () => mappingClientMock.object,\n}));\n\nconst mockGroups = groupsFactory();\n\ndescribe(\"Groupings View with default UIs\", () => {\n beforeEach(async () => {\n connectionMock.setup((x) => x.iModelId).returns(() => mockIModelId);\n connectionMock.setup((x) => x.iTwinId).returns(() => mockITwinId);\n\n const mockedAccessToken = await mockAccessToken();\n mappingClientMock\n .setup(async (x) => x.getGroups(mockedAccessToken, mockIModelId, mockMappingId))\n .returns(async () => Promise.resolve(mockGroups.groups));\n });\n\n afterEach(() => {\n connectionMock.reset();\n mappingClientMock.reset();\n groupingMappingCustomUIMock = [];\n });\n\n it(\"List all groups and click on add group and edit group buttons\", async () => {\n // Arange\n\n // Act\n const user = userEvent.setup();\n render(<Groupings mapping={mockMapping} goBack={jest.fn()} />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n const addButton = screen.getAllByTestId(\"gmw-add-group-button\");\n expect(addButton).toHaveLength(1);\n\n // Click on 'Add Group' button\n await user.click(addButton[0]);\n\n // Should have three menu items\n const addSelection = screen.getAllByTestId(\"gmw-add-0\");\n expect(addSelection).toHaveLength(1);\n const addSearch = screen.getAllByTestId(\"gmw-add-1\");\n expect(addSearch).toHaveLength(1);\n const addManual = screen.getAllByTestId(\"gmw-add-2\");\n expect(addManual).toHaveLength(1);\n\n // Should have the right group number\n const horizontalTiles = screen.getAllByTestId(\"gmw-horizontal-tile\");\n expect(horizontalTiles).toHaveLength(mockGroups.groups.length);\n\n horizontalTiles.forEach((horizontalTile, index) => {\n const groupTile = within(horizontalTile);\n expect(\n groupTile.getByText(\n mockGroups.groups[index].groupName\n )\n ).toBeInTheDocument();\n expect(\n groupTile.getByText(\n mockGroups.groups[index].description ?? \"\"\n )\n ).toBeInTheDocument();\n });\n\n // Click on first group more icon\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n\n await user.click(moreButton[0]);\n\n // Should have 3 context menu items\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n expect(contextMenuItems).toHaveLength(3);\n expect(contextMenuItems[0]).toHaveTextContent(\"Edit\");\n expect(contextMenuItems[1]).toHaveTextContent(\"Properties\");\n expect(contextMenuItems[2]).toHaveTextContent(\"Remove\");\n\n // Hover on 'Edit'\n await user.hover(contextMenuItems[0]);\n\n // Should have 3 sub menu items\n const editSelection = screen.getAllByTestId(`gmw-edit-0`);\n expect(editSelection).toHaveLength(1);\n const editSearch = screen.getAllByTestId(`gmw-edit-1`);\n expect(editSearch).toHaveLength(1);\n const editManual = screen.getAllByTestId(`gmw-edit-2`);\n expect(editManual).toHaveLength(1);\n });\n\n it(\"Set up grouping custom UI - should replace default grouping methods\", async () => {\n // Arange\n const mockedUIComponent = (_props: GroupingCustomUIProps) => React.createElement(\"div\");\n const mockGroupingUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Grouping,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedUIComponent,\n };\n\n groupingMappingCustomUIMock = [mockGroupingUI];\n\n // Act\n const user = userEvent.setup();\n render(<Groupings mapping={mockMapping} goBack={jest.fn()} />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n const addButton = screen.getAllByTestId(\"gmw-add-group-button\");\n expect(addButton).toHaveLength(1);\n\n // Click on 'Add Group' button\n await user.click(addButton[0]);\n\n // Should have exactly 1 add method with given configuration\n const addCustom = screen.getAllByTestId(\"gmw-add-0\");\n expect(addCustom).toHaveLength(1);\n expect(addCustom[0]).toHaveTextContent(mockGroupingUI.displayLabel);\n\n // Each group should have a more icon button\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n expect(moreButton.length).toBeGreaterThan(0);\n\n // Click on first more icon\n await user.click(moreButton[0]);\n\n // Should have 3 context menu items without context configuration\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n expect(contextMenuItems).toHaveLength(3);\n expect(contextMenuItems[0]).toHaveTextContent(\"Edit\");\n\n // Hover on 'Edit'\n await user.hover(contextMenuItems[0]);\n\n // Should have exactly 1 sub menu item\n const editCustom = screen.getAllByTestId(`gmw-edit-0`);\n expect(editCustom).toHaveLength(1);\n expect(editCustom[0]).toHaveTextContent(mockGroupingUI.displayLabel);\n\n // Click on the edit custom UI\n await user.click(editCustom[0]);\n\n const groupName = screen.getAllByText(mockGroups.groups[0].groupName);\n expect(groupName).toHaveLength(1);\n });\n\n it(\"Set up context custom UI - should have default grouping methods and add context menu\", async () => {\n // Arange\n const mockedUIComponent = (_props: ContextCustomUIProps) => React.createElement(\"div\");\n const mockContextUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Context,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedUIComponent,\n };\n\n groupingMappingCustomUIMock = [mockContextUI];\n\n // Act\n const user = userEvent.setup();\n render(<Groupings mapping={mockMapping} goBack={jest.fn()} />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n const addButton = screen.getAllByTestId(\"gmw-add-group-button\");\n expect(addButton).toHaveLength(1);\n\n // Click on 'Add Group' button\n await user.click(addButton[0]);\n\n // Should have three menu items\n const addSelection = screen.getAllByTestId(\"gmw-add-0\");\n expect(addSelection).toHaveLength(1);\n const addSearch = screen.getAllByTestId(\"gmw-add-1\");\n expect(addSearch).toHaveLength(1);\n const addManual = screen.getAllByTestId(\"gmw-add-2\");\n expect(addManual).toHaveLength(1);\n\n // Should have the right group number\n const horizontalTiles = screen.getAllByTestId(\"gmw-horizontal-tile\");\n expect(horizontalTiles).toHaveLength(mockGroups.groups.length);\n\n // Click on first group more icon\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n\n await user.click(moreButton[0]);\n\n // Should have 4 context menu items\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n expect(contextMenuItems).toHaveLength(4);\n expect(contextMenuItems[0]).toHaveTextContent(\"Edit\");\n expect(contextMenuItems[1]).toHaveTextContent(\"Properties\");\n expect(contextMenuItems[2]).toHaveTextContent(\"Remove\");\n expect(contextMenuItems[3]).toHaveTextContent(mockContextUI.displayLabel);\n\n // Click on the context ui\n await user.click(contextMenuItems[3]);\n });\n\n it(\"Set up both grouping and context custom UI\", async () => {\n // Arange\n const mockedGroupingUIComponent = (_props: GroupingCustomUIProps) => React.createElement(\"div\");\n const mockedContextUIComponent = (_props: ContextCustomUIProps) => React.createElement(\"div\");\n const mockGroupingUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Grouping,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedGroupingUIComponent,\n };\n const mockContextUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Context,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedContextUIComponent,\n };\n\n groupingMappingCustomUIMock = [mockContextUI, mockGroupingUI];\n\n // Act\n const user = userEvent.setup();\n render(<Groupings mapping={mockMapping} goBack={jest.fn()} />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n const addButton = screen.getAllByTestId(\"gmw-add-group-button\");\n expect(addButton).toHaveLength(1);\n\n // Click on 'Add Group' button\n await user.click(addButton[0]);\n\n // Should have exactly 1 add method with given configuration\n const addCustom = screen.getAllByTestId(\"gmw-add-0\");\n expect(addCustom).toHaveLength(1);\n expect(addCustom[0]).toHaveTextContent(mockGroupingUI.displayLabel);\n\n // Check the group tile number\n const horizontalTiles = screen.getAllByTestId(\"gmw-horizontal-tile\");\n expect(horizontalTiles).toHaveLength(mockGroups.groups.length);\n\n // Click on first group more icon\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n\n await user.click(moreButton[0]);\n\n // Should have 4 context menu items\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n expect(contextMenuItems).toHaveLength(4);\n expect(contextMenuItems[0]).toHaveTextContent(\"Edit\");\n expect(contextMenuItems[1]).toHaveTextContent(\"Properties\");\n expect(contextMenuItems[2]).toHaveTextContent(\"Remove\");\n expect(contextMenuItems[3]).toHaveTextContent(mockContextUI.displayLabel);\n\n // Click on the context ui\n await user.click(contextMenuItems[3]);\n });\n});\n"]}
@@ -3,7 +3,7 @@
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import { PropertyRecord } from "@itwin/appui-abstract";
6
- import { PropertiesField } from "@itwin/presentation-common";
6
+ import { FieldDescriptorType, PropertiesField } from "@itwin/presentation-common";
7
7
  import { PresentationPropertyDataProvider } from "@itwin/presentation-components";
8
8
  import { assert } from "chai";
9
9
  import { QueryBuilder } from "../widget/components/QueryBuilder";
@@ -24,18 +24,46 @@ describe("QueryBuilder", () => {
24
24
  testData.testCases.forEach((testCase) => {
25
25
  it(testCase.name, async () => executeTest(sut, testCase.expectedResult, testCase.operations));
26
26
  });
27
- const createPropertyRecord = (propertyRecord, propertiesField) => {
27
+ const createFieldDescriptor = (pathToClass, fieldProperties, type, fieldName) => {
28
+ switch (type) {
29
+ case FieldDescriptorType.Properties:
30
+ const pathFromSelectToPropertyClass = (pathToClass !== null && pathToClass !== void 0 ? pathToClass : []).map((x) => ({
31
+ sourceClassName: x.sourceClassInfo.name,
32
+ targetClassName: x.targetClassInfo.name,
33
+ relationshipName: x.relationshipInfo.name,
34
+ isForwardRelationship: x.isForwardRelationship,
35
+ }));
36
+ const properties = fieldProperties.map((x) => ({
37
+ class: x.property.classInfo.name,
38
+ name: x.property.name,
39
+ }));
40
+ return {
41
+ pathFromSelectToPropertyClass,
42
+ properties,
43
+ type,
44
+ };
45
+ case FieldDescriptorType.Name:
46
+ return {
47
+ type,
48
+ fieldName: fieldName !== null && fieldName !== void 0 ? fieldName : "",
49
+ };
50
+ }
51
+ };
52
+ const createPropertyRecord = (propertyRecord, propertiesField, fieldDescriptor) => {
28
53
  const propertiesFieldMock = MockFactory.create(PropertiesField);
29
54
  MockFactory.stubProperty(propertiesFieldMock, "parent", () => propertiesField.parent);
30
55
  MockFactory.stubProperty(propertiesFieldMock, "properties", () => propertiesField.properties);
31
56
  MockFactory.stubProperty(propertiesFieldMock, "type", () => propertiesField.type);
57
+ MockFactory.stubProperty(propertiesFieldMock, "getFieldDescriptor", () => () => fieldDescriptor);
32
58
  const prop = new PropertyRecord(propertyRecord.value, propertyRecord.property);
33
59
  dataProvider.getFieldByPropertyRecord.withArgs(prop).resolves(propertiesFieldMock);
34
60
  return prop;
35
61
  };
36
62
  const executeTest = async (queryBuilder, expectedResult, operations) => {
63
+ var _a;
37
64
  for (const op of operations) {
38
- const prop = createPropertyRecord(op.propertyRecord, op.propertiesField);
65
+ const fieldDescriptor = createFieldDescriptor((_a = op.propertiesField.parent) === null || _a === void 0 ? void 0 : _a.pathToPrimaryClass, op.propertiesField.properties, op.fieldDescriptorType, op.fieldDescriptorName);
66
+ const prop = createPropertyRecord(op.propertyRecord, op.propertiesField, fieldDescriptor);
39
67
  if (op.operationType === "addProperty") {
40
68
  const result = await queryBuilder.addProperty(prop);
41
69
  assert.strictEqual(result, op.expectedResult);
@@ -1 +1 @@
1
- {"version":3,"file":"QueryBuilder.test.js","sourceRoot":"","sources":["../../../src/test/QueryBuilder.test.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,gCAAgC,EAAE,MAAM,gCAAgC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YAAY,CAAC,mBAAmB,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;QAC9F,WAAW,CAAC,YAAY,CAAC,mBAAmB,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAElF,MAAM,IAAI,GAAmB,IAAI,cAAc,CAAC,cAAc,CAAC,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;QAC/F,YAAY,CAAC,wBAAwB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;QACnF,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,KAAK,EAAE,YAA0B,EAAE,cAAsB,EAAE,UAA+B,EAAE,EAAE;QAChH,KAAK,MAAM,EAAE,IAAI,UAAU,EAAE;YAC3B,MAAM,IAAI,GAAG,oBAAoB,CAAC,EAAE,CAAC,cAAc,EAAE,EAAE,CAAC,eAAkC,CAAC,CAAC;YAE5F,IAAI,EAAE,CAAC,aAAa,KAAK,aAAa,EAAE;gBACtC,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;gBACpD,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC;aAC/C;YACD,IAAI,EAAE,CAAC,aAAa,KAAK,gBAAgB,EAAE;gBACzC,MAAM,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;aACzC;SACF;QAED,MAAM,MAAM,GAAG,YAAY,CAAC,gBAAgB,EAAE,CAAC;QAC/C,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC7C,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertiesField } from \"@itwin/presentation-common\";\nimport { PresentationPropertyDataProvider } from \"@itwin/presentation-components\";\nimport { assert } from \"chai\";\nimport { QueryBuilder } from \"../widget/components/QueryBuilder\";\nimport { MockFactory } from \"./MockFactory\";\nimport type { StubbedType } from \"./MockFactory\";\nimport type { OperationTestData, PropertyRecordTestData, QueryBuilderTestData } from \"./QueryBuilderTestData\";\nimport { testCases } from \"./QueryBuilder.testdata\";\n\ndescribe(\"QueryBuilder\", () => {\n let sut: QueryBuilder;\n let dataProvider: StubbedType<PresentationPropertyDataProvider>;\n\n beforeEach(() => {\n dataProvider = MockFactory.create(PresentationPropertyDataProvider);\n MockFactory.stubProperty(dataProvider, \"getContentDescriptor\", () => () => true);\n\n sut = new QueryBuilder(dataProvider);\n });\n\n afterEach(() => {\n dataProvider.getFieldByPropertyRecord.restore();\n });\n\n const testData: QueryBuilderTestData = testCases;\n testData.testCases.forEach((testCase) => {\n it(testCase.name, async () => executeTest(\n sut,\n testCase.expectedResult,\n testCase.operations,\n ));\n });\n\n const createPropertyRecord = (propertyRecord: PropertyRecordTestData, propertiesField: PropertiesField) => {\n const propertiesFieldMock: StubbedType<PropertiesField> = MockFactory.create(PropertiesField);\n\n MockFactory.stubProperty(propertiesFieldMock, \"parent\", () => propertiesField.parent);\n MockFactory.stubProperty(propertiesFieldMock, \"properties\", () => propertiesField.properties);\n MockFactory.stubProperty(propertiesFieldMock, \"type\", () => propertiesField.type);\n\n const prop: PropertyRecord = new PropertyRecord(propertyRecord.value, propertyRecord.property);\n dataProvider.getFieldByPropertyRecord.withArgs(prop).resolves(propertiesFieldMock);\n return prop;\n };\n\n const executeTest = async (queryBuilder: QueryBuilder, expectedResult: string, operations: OperationTestData[]) => {\n for (const op of operations) {\n const prop = createPropertyRecord(op.propertyRecord, op.propertiesField as PropertiesField);\n\n if (op.operationType === \"addProperty\") {\n const result = await queryBuilder.addProperty(prop);\n assert.strictEqual(result, op.expectedResult);\n }\n if (op.operationType === \"removeProperty\") {\n await queryBuilder.removeProperty(prop);\n }\n }\n\n const result = queryBuilder.buildQueryString();\n assert.strictEqual(result, expectedResult);\n };\n});\n"]}
1
+ {"version":3,"file":"QueryBuilder.test.js","sourceRoot":"","sources":["../../../src/test/QueryBuilder.test.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElF,OAAO,EAAE,gCAAgC,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,IAAI,GAAiB,CAAC;IACtB,IAAI,YAA2D,CAAC;IAEhE,UAAU,CAAC,GAAG,EAAE;QACd,YAAY,GAAG,WAAW,CAAC,MAAM,CAAC,gCAAgC,CAAC,CAAC;QACpE,WAAW,CAAC,YAAY,CAAC,YAAY,EAAE,sBAAsB,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;QAEjF,GAAG,GAAG,IAAI,YAAY,CAAC,YAAY,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,YAAY,CAAC,wBAAwB,CAAC,OAAO,EAAE,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAyB,SAAS,CAAC;IACjD,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QACtC,EAAE,CAAC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AAC,IAAI,CAAC,CAAC;gBACpD,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC;aAC/C;YACD,IAAI,EAAE,CAAC,aAAa,KAAK,gBAAgB,EAAE;gBACzC,MAAM,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;aACzC;SACF;QAED,MAAM,MAAM,GAAG,YAAY,CAAC,gBAAgB,EAAE,CAAC;QAC/C,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC7C,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { FieldDescriptorType, PropertiesField } from \"@itwin/presentation-common\";\nimport type { FieldDescriptor, RelationshipPath, StrippedRelatedClassInfo } from \"@itwin/presentation-common\";\nimport { PresentationPropertyDataProvider } from \"@itwin/presentation-components\";\nimport { assert } from \"chai\";\nimport { QueryBuilder } from \"../widget/components/QueryBuilder\";\nimport { MockFactory } from \"./MockFactory\";\nimport type { StubbedType } from \"./MockFactory\";\nimport type { OperationTestData, PropertiesTestData, PropertyRecordTestData, QueryBuilderTestData } from \"./QueryBuilderTestData\";\nimport { testCases } from \"./QueryBuilder.testdata\";\n\ndescribe(\"QueryBuilder\", () => {\n let sut: QueryBuilder;\n let dataProvider: StubbedType<PresentationPropertyDataProvider>;\n\n beforeEach(() => {\n dataProvider = MockFactory.create(PresentationPropertyDataProvider);\n MockFactory.stubProperty(dataProvider, \"getContentDescriptor\", () => () => true);\n\n sut = new QueryBuilder(dataProvider);\n });\n\n afterEach(() => {\n dataProvider.getFieldByPropertyRecord.restore();\n });\n\n const testData: QueryBuilderTestData = testCases;\n testData.testCases.forEach((testCase) => {\n it(testCase.name, async () => executeTest(\n sut,\n testCase.expectedResult,\n testCase.operations,\n ));\n });\n\n const createFieldDescriptor = (\n pathToClass: RelationshipPath | undefined,\n fieldProperties: PropertiesTestData[],\n type: FieldDescriptorType,\n fieldName: string | undefined\n ): FieldDescriptor => {\n switch (type) {\n case FieldDescriptorType.Properties:\n const pathFromSelectToPropertyClass: StrippedRelatedClassInfo[] = (pathToClass ?? []).map((x) => ({\n sourceClassName: x.sourceClassInfo.name,\n targetClassName: x.targetClassInfo.name,\n relationshipName: x.relationshipInfo.name,\n isForwardRelationship: x.isForwardRelationship,\n }));\n\n const properties = fieldProperties.map((x) => ({\n class: x.property.classInfo.name,\n name: x.property.name,\n }));\n\n return {\n pathFromSelectToPropertyClass,\n properties,\n type,\n };\n case FieldDescriptorType.Name:\n return {\n type,\n fieldName: fieldName ?? \"\",\n };\n }\n };\n\n const createPropertyRecord = (propertyRecord: PropertyRecordTestData, propertiesField: PropertiesField, fieldDescriptor: FieldDescriptor) => {\n const propertiesFieldMock: StubbedType<PropertiesField> = MockFactory.create(PropertiesField);\n\n MockFactory.stubProperty(propertiesFieldMock, \"parent\", () => propertiesField.parent);\n MockFactory.stubProperty(propertiesFieldMock, \"properties\", () => propertiesField.properties);\n MockFactory.stubProperty(propertiesFieldMock, \"type\", () => propertiesField.type);\n MockFactory.stubProperty(propertiesFieldMock, \"getFieldDescriptor\", () => () => fieldDescriptor);\n\n const prop: PropertyRecord = new PropertyRecord(propertyRecord.value, propertyRecord.property);\n dataProvider.getFieldByPropertyRecord.withArgs(prop).resolves(propertiesFieldMock);\n return prop;\n };\n\n const executeTest = async (queryBuilder: QueryBuilder, expectedResult: string, operations: OperationTestData[]) => {\n for (const op of operations) {\n const fieldDescriptor = createFieldDescriptor(\n op.propertiesField.parent?.pathToPrimaryClass,\n op.propertiesField.properties,\n op.fieldDescriptorType,\n op.fieldDescriptorName\n );\n\n const prop = createPropertyRecord(op.propertyRecord, op.propertiesField as PropertiesField, fieldDescriptor);\n\n if (op.operationType === \"addProperty\") {\n const result = await queryBuilder.addProperty(prop);\n assert.strictEqual(result, op.expectedResult);\n }\n if (op.operationType === \"removeProperty\") {\n await queryBuilder.removeProperty(prop);\n }\n }\n\n const result = queryBuilder.buildQueryString();\n assert.strictEqual(result, expectedResult);\n };\n});\n"]}