@itwin/reports-config-widget-react 0.2.1 → 0.4.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/.rush/temp/operation/rebuild/all.log +9 -0
- package/.rush/temp/operation/rebuild/state.json +3 -0
- package/.rush/temp/package-deps_rebuild.json +48 -44
- package/.rush/temp/shrinkwrap-deps.json +228 -207
- package/CHANGELOG.json +44 -0
- package/CHANGELOG.md +24 -1
- package/coverage/clover.xml +562 -542
- package/coverage/coverage-final.json +24 -20
- package/coverage/lcov-report/index.html +51 -51
- package/coverage/lcov-report/src/ReportsConfigWidget.ts.html +22 -22
- package/coverage/lcov-report/src/index.html +21 -21
- package/coverage/lcov-report/src/test/index.html +11 -11
- package/coverage/lcov-report/src/test/test-utils.tsx.html +20 -140
- package/coverage/lcov-report/src/widget/ReportsConfigUiProvider.tsx.html +14 -35
- package/coverage/lcov-report/src/widget/components/ActionPanel.tsx.html +26 -20
- package/coverage/lcov-report/src/widget/components/AddMappingsModal.tsx.html +94 -109
- package/coverage/lcov-report/src/widget/components/BulkExtractor.ts.html +55 -52
- package/coverage/lcov-report/src/widget/components/Constants.ts.html +1 -1
- package/coverage/lcov-report/src/widget/components/DeleteModal.tsx.html +28 -46
- package/coverage/lcov-report/src/widget/components/ExtractionStates/FailedExtractionState.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/ExtractionStates/QueuedExtractionState.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/ExtractionStates/RunningExtractionState.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/ExtractionStates/StartingExtractionState.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/ExtractionStates/SucceededExtractionState.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/ExtractionStates/index.html +1 -1
- package/coverage/lcov-report/src/widget/components/ExtractionStatus.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/ExtractionToast.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/HorizontalTile.tsx.html +3 -3
- package/coverage/lcov-report/src/widget/components/LocalizedTablePaginator.tsx.html +8 -8
- package/coverage/lcov-report/src/widget/components/ReportAction.tsx.html +36 -81
- package/coverage/lcov-report/src/widget/components/ReportHorizontalTile.tsx.html +38 -41
- package/coverage/lcov-report/src/widget/components/ReportMappingHorizontalTile.tsx.html +46 -46
- package/coverage/lcov-report/src/widget/components/ReportMappings.tsx.html +127 -142
- package/coverage/lcov-report/src/widget/components/Reports.tsx.html +189 -312
- package/coverage/lcov-report/src/widget/components/ReportsConfigContext.tsx.html +370 -0
- package/coverage/lcov-report/src/widget/components/ReportsContainer.tsx.html +111 -33
- package/coverage/lcov-report/src/widget/components/ReportsHeader.tsx.html +166 -0
- package/coverage/lcov-report/src/widget/components/ReportsRouter.tsx.html +274 -0
- package/coverage/lcov-report/src/widget/components/SearchBar.tsx.html +22 -7
- package/coverage/lcov-report/src/widget/components/SelectIModel.tsx.html +40 -94
- package/coverage/lcov-report/src/widget/components/index.html +142 -97
- package/coverage/lcov-report/src/widget/components/utils.tsx.html +22 -19
- package/coverage/lcov-report/src/widget/context/{ReportsApiConfigContext.tsx.html → BulkExtractorContext.tsx.html} +23 -26
- package/coverage/lcov-report/src/widget/context/ReportsConfigApiContext.tsx.html +202 -0
- package/coverage/lcov-report/src/widget/context/index.html +30 -15
- package/coverage/lcov-report/src/widget/hooks/index.html +1 -1
- package/coverage/lcov-report/src/widget/hooks/useValidator.ts.html +11 -11
- package/coverage/lcov-report/src/widget/index.html +13 -13
- package/coverage/lcov.info +1036 -1034
- package/jest.config.js +1 -0
- package/lib/cjs/ReportsConfigWidget.js +1 -1
- package/lib/cjs/ReportsConfigWidget.js.map +1 -1
- package/lib/cjs/reports-config-widget-react.d.ts +5 -0
- package/lib/cjs/reports-config-widget-react.d.ts.map +1 -1
- package/lib/cjs/reports-config-widget-react.js +11 -0
- package/lib/cjs/reports-config-widget-react.js.map +1 -1
- package/lib/cjs/test/AddMappingModal.test.js +20 -34
- package/lib/cjs/test/AddMappingModal.test.js.map +1 -1
- package/lib/cjs/test/BulkExtractor.test.js +13 -19
- package/lib/cjs/test/BulkExtractor.test.js.map +1 -1
- package/lib/cjs/test/DeleteModal.test.d.ts.map +1 -1
- package/lib/cjs/test/DeleteModal.test.js +4 -62
- package/lib/cjs/test/DeleteModal.test.js.map +1 -1
- package/lib/cjs/test/ReportAction.test.js +14 -79
- package/lib/cjs/test/ReportAction.test.js.map +1 -1
- package/lib/cjs/test/ReportMappingHorizontalTile.test.js +20 -54
- package/lib/cjs/test/ReportMappingHorizontalTile.test.js.map +1 -1
- package/lib/cjs/test/ReportMappings.test.d.ts.map +1 -1
- package/lib/cjs/test/ReportMappings.test.js +51 -106
- package/lib/cjs/test/ReportMappings.test.js.map +1 -1
- package/lib/cjs/test/Reports.test.js +41 -96
- package/lib/cjs/test/Reports.test.js.map +1 -1
- package/lib/cjs/test/WidgetHeader.test.js +9 -3
- package/lib/cjs/test/WidgetHeader.test.js.map +1 -1
- package/lib/cjs/test/test-utils.d.ts +3 -8
- package/lib/cjs/test/test-utils.d.ts.map +1 -1
- package/lib/cjs/test/test-utils.js +6 -34
- package/lib/cjs/test/test-utils.js.map +1 -1
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/widget/ReportsConfigUiProvider.d.ts +3 -3
- package/lib/cjs/widget/ReportsConfigUiProvider.d.ts.map +1 -1
- package/lib/cjs/widget/ReportsConfigUiProvider.js +5 -7
- package/lib/cjs/widget/ReportsConfigUiProvider.js.map +1 -1
- package/lib/cjs/widget/components/ActionPanel.d.ts +3 -3
- package/lib/cjs/widget/components/ActionPanel.d.ts.map +1 -1
- package/lib/cjs/widget/components/ActionPanel.js +4 -4
- package/lib/cjs/widget/components/ActionPanel.js.map +1 -1
- package/lib/cjs/widget/components/ActionPanel.scss +2 -3
- package/lib/cjs/widget/components/AddMappingsModal.d.ts +4 -4
- package/lib/cjs/widget/components/AddMappingsModal.d.ts.map +1 -1
- package/lib/cjs/widget/components/AddMappingsModal.js +39 -43
- package/lib/cjs/widget/components/AddMappingsModal.js.map +1 -1
- package/lib/cjs/widget/components/AddMappingsModal.scss +1 -2
- package/lib/cjs/widget/components/BulkExtractor.d.ts +4 -4
- package/lib/cjs/widget/components/BulkExtractor.d.ts.map +1 -1
- package/lib/cjs/widget/components/BulkExtractor.js +8 -8
- package/lib/cjs/widget/components/BulkExtractor.js.map +1 -1
- package/lib/cjs/widget/components/DeleteModal.d.ts +4 -5
- package/lib/cjs/widget/components/DeleteModal.d.ts.map +1 -1
- package/lib/cjs/widget/components/DeleteModal.js +11 -15
- package/lib/cjs/widget/components/DeleteModal.js.map +1 -1
- package/lib/cjs/widget/components/DeleteModal.scss +2 -3
- package/lib/cjs/widget/components/ExtractionStatus.js +2 -2
- package/lib/cjs/widget/components/ExtractionStatus.js.map +1 -1
- package/lib/cjs/widget/components/ExtractionStatus.scss +6 -7
- package/lib/cjs/widget/components/HorizontalTile.js +2 -2
- package/lib/cjs/widget/components/HorizontalTile.js.map +1 -1
- package/lib/cjs/widget/components/HorizontalTile.scss +11 -14
- package/lib/cjs/widget/components/LocalizedTablePaginator.js +2 -2
- package/lib/cjs/widget/components/LocalizedTablePaginator.js.map +1 -1
- package/lib/cjs/widget/components/ReportAction.d.ts +4 -5
- package/lib/cjs/widget/components/ReportAction.d.ts.map +1 -1
- package/lib/cjs/widget/components/ReportAction.js +24 -26
- package/lib/cjs/widget/components/ReportAction.js.map +1 -1
- package/lib/cjs/widget/components/ReportAction.scss +1 -2
- package/lib/cjs/widget/components/ReportHorizontalTile.d.ts +4 -4
- package/lib/cjs/widget/components/ReportHorizontalTile.d.ts.map +1 -1
- package/lib/cjs/widget/components/ReportHorizontalTile.js +33 -20
- package/lib/cjs/widget/components/ReportHorizontalTile.js.map +1 -1
- package/lib/cjs/widget/components/ReportMappingHorizontalTile.d.ts +1 -1
- package/lib/cjs/widget/components/ReportMappingHorizontalTile.d.ts.map +1 -1
- package/lib/cjs/widget/components/ReportMappingHorizontalTile.js +36 -21
- package/lib/cjs/widget/components/ReportMappingHorizontalTile.js.map +1 -1
- package/lib/cjs/widget/components/ReportMappings.d.ts +4 -6
- package/lib/cjs/widget/components/ReportMappings.d.ts.map +1 -1
- package/lib/cjs/widget/components/ReportMappings.js +50 -63
- package/lib/cjs/widget/components/ReportMappings.js.map +1 -1
- package/lib/cjs/widget/components/ReportMappings.scss +10 -11
- package/lib/cjs/widget/components/Reports.d.ts +6 -1
- package/lib/cjs/widget/components/Reports.d.ts.map +1 -1
- package/lib/cjs/widget/components/Reports.js +53 -94
- package/lib/cjs/widget/components/Reports.js.map +1 -1
- package/lib/cjs/widget/components/Reports.scss +15 -15
- package/lib/cjs/widget/components/ReportsConfigContext.d.ts +18 -0
- package/lib/cjs/widget/components/ReportsConfigContext.d.ts.map +1 -0
- package/lib/cjs/widget/components/ReportsConfigContext.js +79 -0
- package/lib/cjs/widget/components/ReportsConfigContext.js.map +1 -0
- package/lib/cjs/widget/components/ReportsContainer.d.ts +14 -0
- package/lib/cjs/widget/components/ReportsContainer.d.ts.map +1 -1
- package/lib/cjs/widget/components/ReportsContainer.js +27 -16
- package/lib/cjs/widget/components/ReportsContainer.js.map +1 -1
- package/lib/cjs/widget/components/ReportsContainer.scss +1 -3
- package/lib/cjs/widget/components/ReportsHeader.d.ts +7 -0
- package/lib/cjs/widget/components/ReportsHeader.d.ts.map +1 -0
- package/lib/cjs/widget/components/ReportsHeader.js +20 -0
- package/lib/cjs/widget/components/ReportsHeader.js.map +1 -0
- package/lib/cjs/widget/components/ReportsRouter.d.ts +8 -0
- package/lib/cjs/widget/components/ReportsRouter.d.ts.map +1 -0
- package/lib/cjs/widget/components/ReportsRouter.js +51 -0
- package/lib/cjs/widget/components/ReportsRouter.js.map +1 -0
- package/lib/cjs/widget/components/SearchBar.d.ts.map +1 -1
- package/lib/cjs/widget/components/SearchBar.js +4 -5
- package/lib/cjs/widget/components/SearchBar.js.map +1 -1
- package/lib/cjs/widget/components/SearchBar.scss +1 -2
- package/lib/cjs/widget/components/SelectIModel.d.ts +3 -3
- package/lib/cjs/widget/components/SelectIModel.d.ts.map +1 -1
- package/lib/cjs/widget/components/SelectIModel.js +10 -30
- package/lib/cjs/widget/components/SelectIModel.js.map +1 -1
- package/lib/cjs/widget/components/SelectIModel.scss +2 -3
- package/lib/cjs/widget/components/utils.d.ts +1 -1
- package/lib/cjs/widget/components/utils.d.ts.map +1 -1
- package/lib/cjs/widget/components/utils.js +1 -1
- package/lib/cjs/widget/components/utils.js.map +1 -1
- package/lib/cjs/widget/components/utils.scss +16 -8
- package/lib/cjs/widget/context/BulkExtractorContext.d.ts +10 -0
- package/lib/cjs/widget/context/BulkExtractorContext.d.ts.map +1 -0
- package/lib/cjs/widget/context/{ReportsApiConfigContext.js → BulkExtractorContext.js} +7 -10
- package/lib/cjs/widget/context/BulkExtractorContext.js.map +1 -0
- package/lib/cjs/widget/context/ReportsConfigApiContext.d.ts +16 -0
- package/lib/cjs/widget/context/ReportsConfigApiContext.d.ts.map +1 -0
- package/lib/cjs/widget/context/ReportsConfigApiContext.js +43 -0
- package/lib/cjs/widget/context/ReportsConfigApiContext.js.map +1 -0
- package/lib/cjs/widget/hooks/useValidator.js +1 -1
- package/lib/cjs/widget/hooks/useValidator.js.map +1 -1
- package/lib/esm/ReportsConfigWidget.js +1 -1
- package/lib/esm/ReportsConfigWidget.js.map +1 -1
- package/lib/esm/reports-config-widget-react.d.ts +5 -0
- package/lib/esm/reports-config-widget-react.d.ts.map +1 -1
- package/lib/esm/reports-config-widget-react.js +5 -0
- package/lib/esm/reports-config-widget-react.js.map +1 -1
- package/lib/esm/test/AddMappingModal.test.js +17 -31
- package/lib/esm/test/AddMappingModal.test.js.map +1 -1
- package/lib/esm/test/BulkExtractor.test.js +14 -17
- package/lib/esm/test/BulkExtractor.test.js.map +1 -1
- package/lib/esm/test/DeleteModal.test.d.ts.map +1 -1
- package/lib/esm/test/DeleteModal.test.js +5 -44
- package/lib/esm/test/DeleteModal.test.js.map +1 -1
- package/lib/esm/test/ReportAction.test.js +14 -60
- package/lib/esm/test/ReportAction.test.js.map +1 -1
- package/lib/esm/test/ReportMappingHorizontalTile.test.js +4 -38
- package/lib/esm/test/ReportMappingHorizontalTile.test.js.map +1 -1
- package/lib/esm/test/ReportMappings.test.d.ts.map +1 -1
- package/lib/esm/test/ReportMappings.test.js +43 -98
- package/lib/esm/test/ReportMappings.test.js.map +1 -1
- package/lib/esm/test/Reports.test.js +24 -60
- package/lib/esm/test/Reports.test.js.map +1 -1
- package/lib/esm/test/WidgetHeader.test.js +8 -2
- package/lib/esm/test/WidgetHeader.test.js.map +1 -1
- package/lib/esm/test/test-utils.d.ts +3 -8
- package/lib/esm/test/test-utils.d.ts.map +1 -1
- package/lib/esm/test/test-utils.js +4 -31
- package/lib/esm/test/test-utils.js.map +1 -1
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/widget/ReportsConfigUiProvider.d.ts +3 -3
- package/lib/esm/widget/ReportsConfigUiProvider.d.ts.map +1 -1
- package/lib/esm/widget/ReportsConfigUiProvider.js +2 -4
- package/lib/esm/widget/ReportsConfigUiProvider.js.map +1 -1
- package/lib/esm/widget/components/ActionPanel.d.ts +3 -3
- package/lib/esm/widget/components/ActionPanel.d.ts.map +1 -1
- package/lib/esm/widget/components/ActionPanel.js +4 -4
- package/lib/esm/widget/components/ActionPanel.js.map +1 -1
- package/lib/esm/widget/components/ActionPanel.scss +2 -3
- package/lib/esm/widget/components/AddMappingsModal.d.ts +4 -4
- package/lib/esm/widget/components/AddMappingsModal.d.ts.map +1 -1
- package/lib/esm/widget/components/AddMappingsModal.js +35 -39
- package/lib/esm/widget/components/AddMappingsModal.js.map +1 -1
- package/lib/esm/widget/components/AddMappingsModal.scss +1 -2
- package/lib/esm/widget/components/BulkExtractor.d.ts +4 -4
- package/lib/esm/widget/components/BulkExtractor.d.ts.map +1 -1
- package/lib/esm/widget/components/BulkExtractor.js +7 -8
- package/lib/esm/widget/components/BulkExtractor.js.map +1 -1
- package/lib/esm/widget/components/DeleteModal.d.ts +4 -5
- package/lib/esm/widget/components/DeleteModal.d.ts.map +1 -1
- package/lib/esm/widget/components/DeleteModal.js +11 -15
- package/lib/esm/widget/components/DeleteModal.js.map +1 -1
- package/lib/esm/widget/components/DeleteModal.scss +2 -3
- package/lib/esm/widget/components/ExtractionStatus.scss +6 -7
- package/lib/esm/widget/components/HorizontalTile.scss +11 -14
- package/lib/esm/widget/components/ReportAction.d.ts +4 -5
- package/lib/esm/widget/components/ReportAction.d.ts.map +1 -1
- package/lib/esm/widget/components/ReportAction.js +17 -21
- package/lib/esm/widget/components/ReportAction.js.map +1 -1
- package/lib/esm/widget/components/ReportAction.scss +1 -2
- package/lib/esm/widget/components/ReportHorizontalTile.d.ts +4 -4
- package/lib/esm/widget/components/ReportHorizontalTile.d.ts.map +1 -1
- package/lib/esm/widget/components/ReportHorizontalTile.js +6 -9
- package/lib/esm/widget/components/ReportHorizontalTile.js.map +1 -1
- package/lib/esm/widget/components/ReportMappingHorizontalTile.d.ts +1 -1
- package/lib/esm/widget/components/ReportMappingHorizontalTile.d.ts.map +1 -1
- package/lib/esm/widget/components/ReportMappingHorizontalTile.js +12 -13
- package/lib/esm/widget/components/ReportMappingHorizontalTile.js.map +1 -1
- package/lib/esm/widget/components/ReportMappings.d.ts +4 -6
- package/lib/esm/widget/components/ReportMappings.d.ts.map +1 -1
- package/lib/esm/widget/components/ReportMappings.js +43 -56
- package/lib/esm/widget/components/ReportMappings.js.map +1 -1
- package/lib/esm/widget/components/ReportMappings.scss +10 -11
- package/lib/esm/widget/components/Reports.d.ts +6 -1
- package/lib/esm/widget/components/Reports.d.ts.map +1 -1
- package/lib/esm/widget/components/Reports.js +46 -87
- package/lib/esm/widget/components/Reports.js.map +1 -1
- package/lib/esm/widget/components/Reports.scss +15 -15
- package/lib/esm/widget/components/ReportsConfigContext.d.ts +18 -0
- package/lib/esm/widget/components/ReportsConfigContext.d.ts.map +1 -0
- package/lib/esm/widget/components/ReportsConfigContext.js +56 -0
- package/lib/esm/widget/components/ReportsConfigContext.js.map +1 -0
- package/lib/esm/widget/components/ReportsContainer.d.ts +14 -0
- package/lib/esm/widget/components/ReportsContainer.d.ts.map +1 -1
- package/lib/esm/widget/components/ReportsContainer.js +27 -17
- package/lib/esm/widget/components/ReportsContainer.js.map +1 -1
- package/lib/esm/widget/components/ReportsContainer.scss +1 -3
- package/lib/esm/widget/components/ReportsHeader.d.ts +7 -0
- package/lib/esm/widget/components/ReportsHeader.d.ts.map +1 -0
- package/lib/esm/widget/components/ReportsHeader.js +13 -0
- package/lib/esm/widget/components/ReportsHeader.js.map +1 -0
- package/lib/esm/widget/components/ReportsRouter.d.ts +8 -0
- package/lib/esm/widget/components/ReportsRouter.d.ts.map +1 -0
- package/lib/esm/widget/components/ReportsRouter.js +44 -0
- package/lib/esm/widget/components/ReportsRouter.js.map +1 -0
- package/lib/esm/widget/components/SearchBar.d.ts.map +1 -1
- package/lib/esm/widget/components/SearchBar.js +2 -3
- package/lib/esm/widget/components/SearchBar.js.map +1 -1
- package/lib/esm/widget/components/SearchBar.scss +1 -2
- package/lib/esm/widget/components/SelectIModel.d.ts +3 -3
- package/lib/esm/widget/components/SelectIModel.d.ts.map +1 -1
- package/lib/esm/widget/components/SelectIModel.js +7 -27
- package/lib/esm/widget/components/SelectIModel.js.map +1 -1
- package/lib/esm/widget/components/SelectIModel.scss +2 -3
- package/lib/esm/widget/components/utils.d.ts +1 -1
- package/lib/esm/widget/components/utils.d.ts.map +1 -1
- package/lib/esm/widget/components/utils.js +2 -2
- package/lib/esm/widget/components/utils.js.map +1 -1
- package/lib/esm/widget/components/utils.scss +16 -8
- package/lib/esm/widget/context/BulkExtractorContext.d.ts +10 -0
- package/lib/esm/widget/context/BulkExtractorContext.d.ts.map +1 -0
- package/lib/esm/widget/context/BulkExtractorContext.js +11 -0
- package/lib/esm/widget/context/BulkExtractorContext.js.map +1 -0
- package/lib/esm/widget/context/ReportsConfigApiContext.d.ts +16 -0
- package/lib/esm/widget/context/ReportsConfigApiContext.d.ts.map +1 -0
- package/lib/esm/widget/context/ReportsConfigApiContext.js +20 -0
- package/lib/esm/widget/context/ReportsConfigApiContext.js.map +1 -0
- package/lib/public/locales/en/ReportsConfigWidget.json +6 -1
- package/package.json +29 -29
- package/public/locales/en/ReportsConfigWidget.json +6 -1
- package/reports-config-widget-react.build.error.log +6 -6
- package/reports-config-widget-react.build.log +52 -49
- package/src/reports-config-widget-react.ts +6 -0
- package/src/test/AddMappingModal.test.tsx +20 -37
- package/src/test/BulkExtractor.test.ts +15 -17
- package/src/test/DeleteModal.test.tsx +4 -73
- package/src/test/ReportAction.test.tsx +17 -90
- package/src/test/ReportMappingHorizontalTile.test.tsx +3 -54
- package/src/test/ReportMappings.test.tsx +50 -135
- package/src/test/Reports.test.tsx +21 -80
- package/src/test/WidgetHeader.test.tsx +9 -2
- package/src/test/test-utils.tsx +9 -49
- package/src/widget/ReportsConfigUiProvider.tsx +7 -14
- package/src/widget/components/ActionPanel.scss +2 -3
- package/src/widget/components/ActionPanel.tsx +17 -15
- package/src/widget/components/AddMappingsModal.scss +1 -2
- package/src/widget/components/AddMappingsModal.tsx +55 -60
- package/src/widget/components/BulkExtractor.ts +11 -10
- package/src/widget/components/DeleteModal.scss +2 -3
- package/src/widget/components/DeleteModal.tsx +17 -23
- package/src/widget/components/ExtractionStatus.scss +6 -7
- package/src/widget/components/HorizontalTile.scss +11 -14
- package/src/widget/components/ReportAction.scss +1 -2
- package/src/widget/components/ReportAction.tsx +18 -33
- package/src/widget/components/ReportHorizontalTile.tsx +11 -12
- package/src/widget/components/ReportMappingHorizontalTile.tsx +30 -30
- package/src/widget/components/ReportMappings.scss +10 -11
- package/src/widget/components/ReportMappings.tsx +67 -72
- package/src/widget/components/Reports.scss +15 -15
- package/src/widget/components/Reports.tsx +140 -181
- package/src/widget/components/ReportsConfigContext.tsx +95 -0
- package/src/widget/components/ReportsContainer.scss +1 -3
- package/src/widget/components/ReportsContainer.tsx +47 -21
- package/src/widget/components/ReportsHeader.tsx +27 -0
- package/src/widget/components/ReportsRouter.tsx +63 -0
- package/src/widget/components/SearchBar.scss +1 -2
- package/src/widget/components/SearchBar.tsx +7 -2
- package/src/widget/components/SelectIModel.scss +2 -3
- package/src/widget/components/SelectIModel.tsx +11 -29
- package/src/widget/components/utils.scss +16 -8
- package/src/widget/components/utils.tsx +8 -7
- package/src/widget/context/{ReportsApiConfigContext.tsx → BulkExtractorContext.tsx} +9 -10
- package/src/widget/context/ReportsConfigApiContext.tsx +39 -0
- package/lib/cjs/widget/context/ReportsApiConfigContext.d.ts +0 -9
- package/lib/cjs/widget/context/ReportsApiConfigContext.d.ts.map +0 -1
- package/lib/cjs/widget/context/ReportsApiConfigContext.js.map +0 -1
- package/lib/esm/widget/context/ReportsApiConfigContext.d.ts +0 -9
- package/lib/esm/widget/context/ReportsApiConfigContext.d.ts.map +0 -1
- package/lib/esm/widget/context/ReportsApiConfigContext.js +0 -14
- package/lib/esm/widget/context/ReportsApiConfigContext.js.map +0 -1
|
@@ -3,53 +3,42 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import React from "react";
|
|
6
|
-
import faker from "@faker-js/faker";
|
|
7
6
|
import "@testing-library/jest-dom";
|
|
8
|
-
import type {
|
|
9
|
-
IModelConnection,
|
|
10
|
-
SelectionSet,
|
|
11
|
-
SelectionSetEvent,
|
|
12
|
-
} from "@itwin/core-frontend";
|
|
13
|
-
import { NoRenderApp } from "@itwin/core-frontend";
|
|
14
7
|
import { ReportsConfigWidget } from "../ReportsConfigWidget";
|
|
15
8
|
import {
|
|
16
9
|
act,
|
|
10
|
+
mockITwinId,
|
|
17
11
|
render,
|
|
18
12
|
screen,
|
|
19
|
-
|
|
13
|
+
waitFor,
|
|
20
14
|
waitForElementToBeRemoved,
|
|
21
15
|
within,
|
|
22
16
|
} from "./test-utils";
|
|
23
17
|
import * as moq from "typemoq";
|
|
24
18
|
import type {
|
|
19
|
+
MappingsClient,
|
|
25
20
|
MappingSingle,
|
|
26
21
|
Report,
|
|
27
22
|
ReportMappingCollection,
|
|
28
23
|
} from "@itwin/insights-client";
|
|
29
|
-
import
|
|
24
|
+
import {
|
|
25
|
+
ExtractionClient,
|
|
26
|
+
ReportsClient,
|
|
27
|
+
} from "@itwin/insights-client";
|
|
30
28
|
import { ReportMappings } from "../widget/components/ReportMappings";
|
|
31
|
-
import type { GetSingleIModelParams, IModelOperations, OperationOptions } from "@itwin/imodels-client-management";
|
|
29
|
+
import type { GetSingleIModelParams, IModelOperations, IModelsClient, OperationOptions } from "@itwin/imodels-client-management";
|
|
32
30
|
import { IModelState } from "@itwin/imodels-client-management";
|
|
33
|
-
import
|
|
34
|
-
SelectionManager,
|
|
35
|
-
SelectionScopesManager,
|
|
36
|
-
} from "@itwin/presentation-frontend";
|
|
37
|
-
import {
|
|
38
|
-
Presentation,
|
|
39
|
-
SelectionChangeEvent,
|
|
40
|
-
} from "@itwin/presentation-frontend";
|
|
41
|
-
import type { BeEvent } from "@itwin/core-bentley";
|
|
42
|
-
import type BulkExtractor from "../widget/components/BulkExtractor";
|
|
31
|
+
import { BulkExtractor } from "../widget/components/BulkExtractor";
|
|
43
32
|
import type { ReportMappingHorizontalTileProps } from "../widget/components/ReportMappingHorizontalTile";
|
|
44
33
|
import { Text } from "@itwin/itwinui-react";
|
|
45
34
|
import { EmptyLocalization } from "@itwin/core-common";
|
|
35
|
+
import type { AddMappingsModalProps } from "../widget/components/AddMappingsModal";
|
|
46
36
|
|
|
47
|
-
const mockITwinId = faker.datatype.uuid();
|
|
48
37
|
// Lets work with two iModels for now.
|
|
49
|
-
const mockIModelId1 =
|
|
50
|
-
const mockIModelId2 =
|
|
38
|
+
const mockIModelId1 = "mockIModelId1";
|
|
39
|
+
const mockIModelId2 = "mockIModelId2";
|
|
51
40
|
|
|
52
|
-
const mockReportId =
|
|
41
|
+
const mockReportId = "mockReportId";
|
|
53
42
|
|
|
54
43
|
const mockIModelsResponse = [
|
|
55
44
|
{
|
|
@@ -131,7 +120,7 @@ const mockReportMappingsFactory = (): ReportMappingCollection => {
|
|
|
131
120
|
mappings: [
|
|
132
121
|
{
|
|
133
122
|
reportId: mockReportId,
|
|
134
|
-
mappingId:
|
|
123
|
+
mappingId: "mockMappingId1",
|
|
135
124
|
imodelId: mockIModelId1,
|
|
136
125
|
_links: {
|
|
137
126
|
report: {
|
|
@@ -147,7 +136,7 @@ const mockReportMappingsFactory = (): ReportMappingCollection => {
|
|
|
147
136
|
},
|
|
148
137
|
{
|
|
149
138
|
reportId: mockReportId,
|
|
150
|
-
mappingId:
|
|
139
|
+
mappingId: "mockMappingId2",
|
|
151
140
|
imodelId: mockIModelId2,
|
|
152
141
|
_links: {
|
|
153
142
|
report: {
|
|
@@ -198,19 +187,6 @@ const mockMappingsFactory = (
|
|
|
198
187
|
return mockMappings;
|
|
199
188
|
};
|
|
200
189
|
|
|
201
|
-
const connectionMock = moq.Mock.ofType<IModelConnection>();
|
|
202
|
-
const mockBulkExtractor = moq.Mock.ofType<BulkExtractor>();
|
|
203
|
-
const selectionManagerMock = moq.Mock.ofType<SelectionManager>();
|
|
204
|
-
const selectionScopesManagerMock = moq.Mock.ofType<SelectionScopesManager>();
|
|
205
|
-
const mockIModelsClient = moq.Mock.ofType<IModelOperations<OperationOptions>>();
|
|
206
|
-
|
|
207
|
-
interface AddMappingsModalProps {
|
|
208
|
-
reportId: string;
|
|
209
|
-
existingMappings: ReportMappingAndMapping[];
|
|
210
|
-
show: boolean;
|
|
211
|
-
returnFn: () => Promise<void>;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
190
|
jest.mock("../widget/components/Constants.ts", () => ({
|
|
215
191
|
STATUS_CHECK_INTERVAL: 10,
|
|
216
192
|
}));
|
|
@@ -224,25 +200,18 @@ jest.mock("../widget/components/ReportMappingHorizontalTile", () => ({
|
|
|
224
200
|
},
|
|
225
201
|
}));
|
|
226
202
|
|
|
227
|
-
|
|
228
|
-
...jest.requireActual("@itwin/appui-react"),
|
|
229
|
-
useActiveIModelConnection: () => connectionMock.object,
|
|
230
|
-
}));
|
|
231
|
-
|
|
232
|
-
let returnFn: () => Promise<void>;
|
|
203
|
+
let onClose: () => Promise<void>;
|
|
233
204
|
jest.mock("../widget/components/AddMappingsModal", () => ({
|
|
234
205
|
...jest.requireActual("../widget/components/AddMappingsModal"),
|
|
235
206
|
AddMappingsModal: (props: AddMappingsModalProps) => {
|
|
236
|
-
|
|
237
|
-
return <div data-testid="add-mappings-modal"/>;
|
|
207
|
+
onClose = props.onClose;
|
|
208
|
+
return <div data-testid="add-mappings-modal" />;
|
|
238
209
|
},
|
|
239
210
|
}));
|
|
240
211
|
|
|
241
212
|
jest.mock("@itwin/imodels-client-management", () => ({
|
|
242
213
|
...jest.requireActual("@itwin/imodels-client-management"),
|
|
243
|
-
|
|
244
|
-
iModels: mockIModelsClient.object,
|
|
245
|
-
})),
|
|
214
|
+
|
|
246
215
|
toArray: jest.fn().mockImplementation(async () => {
|
|
247
216
|
return mockProjectIModels.iModels;
|
|
248
217
|
}),
|
|
@@ -251,60 +220,30 @@ jest.mock("@itwin/imodels-client-management", () => ({
|
|
|
251
220
|
const mockGetMapping = jest.fn();
|
|
252
221
|
const mockGetMappings = jest.fn();
|
|
253
222
|
const mockGetReportMappings = jest.fn();
|
|
254
|
-
const mockDeleteReportMapping = jest.fn();
|
|
255
223
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
getMappings: mockGetMappings,
|
|
261
|
-
})),
|
|
262
|
-
ReportsClient: jest.fn().mockImplementation(() => ({
|
|
263
|
-
getReportMappings: mockGetReportMappings,
|
|
264
|
-
deleteReportMapping: mockDeleteReportMapping,
|
|
265
|
-
})),
|
|
266
|
-
}));
|
|
224
|
+
const mockIModelsClient = moq.Mock.ofType<IModelsClient>();
|
|
225
|
+
const mockIModelsClientOperations = moq.Mock.ofType<IModelOperations<OperationOptions>>();
|
|
226
|
+
const mockReportsClient = moq.Mock.ofType<ReportsClient>();
|
|
227
|
+
const mockMappingsClient = moq.Mock.ofType<MappingsClient>();
|
|
267
228
|
|
|
268
229
|
beforeAll(async () => {
|
|
269
|
-
|
|
270
|
-
await
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
.
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
selectionManagerMock
|
|
282
|
-
.setup((x) => x.selectionChange)
|
|
283
|
-
.returns(() => new SelectionChangeEvent());
|
|
284
|
-
|
|
285
|
-
selectionScopesManagerMock
|
|
286
|
-
.setup(async (x) => x.getSelectionScopes(connectionMock.object))
|
|
287
|
-
.returns(async () => []);
|
|
288
|
-
selectionManagerMock
|
|
289
|
-
.setup((x) => x.scopes)
|
|
290
|
-
.returns(() => selectionScopesManagerMock.object);
|
|
291
|
-
|
|
292
|
-
Presentation.setSelectionManager(selectionManagerMock.object);
|
|
293
|
-
await TestUtils.initializeUiFramework(connectionMock.object);
|
|
294
|
-
await ReportsConfigWidget.initialize();
|
|
295
|
-
});
|
|
296
|
-
|
|
297
|
-
afterAll(() => {
|
|
298
|
-
TestUtils.terminateUiFramework();
|
|
230
|
+
const localization = new EmptyLocalization();
|
|
231
|
+
await ReportsConfigWidget.initialize(localization);
|
|
232
|
+
mockIModelsClientOperations.setup(async (x) => x.getSingle(moq.It.isObjectWith<GetSingleIModelParams>({ iModelId: mockIModelId1 })))
|
|
233
|
+
.returns(async () => mockIModelsResponse[0].iModel);
|
|
234
|
+
mockIModelsClientOperations.setup(async (x) => x.getSingle(moq.It.isObjectWith<GetSingleIModelParams>({ iModelId: mockIModelId2 })))
|
|
235
|
+
.returns(async () => mockIModelsResponse[1].iModel);
|
|
236
|
+
mockIModelsClient.setup((x) => x.iModels)
|
|
237
|
+
.returns(() => mockIModelsClientOperations.object);
|
|
238
|
+
mockReportsClient.setup(async (x) => x.getReportMappings(moq.It.isAny(), moq.It.isAny())).returns(mockGetReportMappings);
|
|
239
|
+
mockMappingsClient.setup(async (x) => x.getMappings(moq.It.isAny(), moq.It.isAny())).returns(mockGetMappings);
|
|
240
|
+
mockMappingsClient.setup(async (x) => x.getMapping(moq.It.isAny(), moq.It.isAny(), moq.It.isAny())).returns(mockGetMapping);
|
|
299
241
|
});
|
|
300
242
|
|
|
301
243
|
afterEach(() => {
|
|
302
244
|
mockGetMapping.mockReset();
|
|
303
245
|
mockGetMappings.mockReset();
|
|
304
246
|
mockGetReportMappings.mockReset();
|
|
305
|
-
mockDeleteReportMapping.mockReset();
|
|
306
|
-
mockIModelsClient.reset();
|
|
307
|
-
mockBulkExtractor.reset();
|
|
308
247
|
});
|
|
309
248
|
|
|
310
249
|
describe("Report Mappings View", () => {
|
|
@@ -312,16 +251,10 @@ describe("Report Mappings View", () => {
|
|
|
312
251
|
const mockReportMappings = mockReportMappingsFactory();
|
|
313
252
|
const mockMappings = mockMappingsFactory(mockReportMappings);
|
|
314
253
|
|
|
315
|
-
mockIModelsClient.setup(async (x) => x.getSingle(moq.It.isObjectWith<GetSingleIModelParams>({ iModelId: mockIModelId1 })))
|
|
316
|
-
.returns(async () => mockIModelsResponse[0].iModel);
|
|
317
|
-
|
|
318
|
-
mockIModelsClient.setup(async (x) => x.getSingle(moq.It.isObjectWith<GetSingleIModelParams>({ iModelId: mockIModelId2 })))
|
|
319
|
-
.returns(async () => mockIModelsResponse[1].iModel);
|
|
320
|
-
|
|
321
254
|
mockGetMapping.mockReturnValueOnce(mockMappings[0].mapping).mockReturnValueOnce(mockMappings[1].mapping);
|
|
322
255
|
mockGetReportMappings.mockReturnValueOnce(mockReportMappings.mappings);
|
|
323
256
|
|
|
324
|
-
render(<ReportMappings report={mockReport}
|
|
257
|
+
render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object });
|
|
325
258
|
|
|
326
259
|
await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
|
|
327
260
|
|
|
@@ -333,23 +266,15 @@ describe("Report Mappings View", () => {
|
|
|
333
266
|
const mockReportMappings = mockReportMappingsFactory();
|
|
334
267
|
const mockMappings = mockMappingsFactory(mockReportMappings);
|
|
335
268
|
|
|
336
|
-
mockIModelsClient.setup(async (x) => x.getSingle(moq.It.isObjectWith<GetSingleIModelParams>({ iModelId: mockIModelId1 })))
|
|
337
|
-
.returns(async () => mockIModelsResponse[0].iModel);
|
|
338
|
-
|
|
339
|
-
mockIModelsClient.setup(async (x) => x.getSingle(moq.It.isObjectWith<GetSingleIModelParams>({ iModelId: mockIModelId2 })))
|
|
340
|
-
.returns(async () => mockIModelsResponse[1].iModel);
|
|
341
269
|
mockGetMapping.mockReturnValueOnce(mockMappings[0].mapping).mockReturnValueOnce(mockMappings[1].mapping);
|
|
342
270
|
mockGetReportMappings.mockReturnValueOnce(mockReportMappings.mappings);
|
|
343
271
|
|
|
344
|
-
const { user } = render(
|
|
345
|
-
<ReportMappings report={mockReport} bulkExtractor={mockBulkExtractor.object} goBack={jest.fn()} />
|
|
346
|
-
);
|
|
272
|
+
const { user } = render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object });
|
|
347
273
|
|
|
348
274
|
await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
|
|
349
275
|
|
|
350
|
-
const searchButton =
|
|
351
|
-
|
|
352
|
-
);
|
|
276
|
+
const searchButton = screen.getByTestId(/rcw-search-button/i);
|
|
277
|
+
|
|
353
278
|
await user.click(searchButton);
|
|
354
279
|
const searchInput = screen.getByRole("textbox", {
|
|
355
280
|
name: /search\-textbox/i,
|
|
@@ -387,18 +312,10 @@ describe("Report Mappings View", () => {
|
|
|
387
312
|
const mockReportMappings = mockReportMappingsFactory();
|
|
388
313
|
const mockMappings = mockMappingsFactory(mockReportMappings);
|
|
389
314
|
|
|
390
|
-
mockIModelsClient.setup(async (x) => x.getSingle(moq.It.isObjectWith<GetSingleIModelParams>({ iModelId: mockIModelId1 })))
|
|
391
|
-
.returns(async () => mockIModelsResponse[0].iModel);
|
|
392
|
-
|
|
393
|
-
mockIModelsClient.setup(async (x) => x.getSingle(moq.It.isObjectWith<GetSingleIModelParams>({ iModelId: mockIModelId2 })))
|
|
394
|
-
.returns(async () => mockIModelsResponse[1].iModel);
|
|
395
|
-
|
|
396
315
|
mockGetMapping.mockReturnValueOnce(mockMappings[0].mapping).mockReturnValueOnce(mockMappings[1].mapping);
|
|
397
316
|
mockGetReportMappings.mockReturnValueOnce(mockReportMappings.mappings);
|
|
398
317
|
|
|
399
|
-
const { user } = render(
|
|
400
|
-
<ReportMappings report={mockReport} bulkExtractor={mockBulkExtractor.object} goBack={jest.fn()} />
|
|
401
|
-
);
|
|
318
|
+
const { user } = render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object });
|
|
402
319
|
|
|
403
320
|
await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
|
|
404
321
|
|
|
@@ -414,7 +331,7 @@ describe("Report Mappings View", () => {
|
|
|
414
331
|
expect(addMappingsModal).toBeInTheDocument();
|
|
415
332
|
|
|
416
333
|
await act(async () => {
|
|
417
|
-
await
|
|
334
|
+
await onClose();
|
|
418
335
|
});
|
|
419
336
|
|
|
420
337
|
const horizontalTiles = screen.getAllByTestId("horizontal-tile");
|
|
@@ -424,9 +341,7 @@ describe("Report Mappings View", () => {
|
|
|
424
341
|
});
|
|
425
342
|
|
|
426
343
|
it("odata feed url", async () => {
|
|
427
|
-
const { user } = render(
|
|
428
|
-
<ReportMappings report={mockReport} bulkExtractor={mockBulkExtractor.object} goBack={jest.fn()} />
|
|
429
|
-
);
|
|
344
|
+
const { user } = render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object });
|
|
430
345
|
|
|
431
346
|
await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
|
|
432
347
|
|
|
@@ -452,19 +367,16 @@ describe("Report Mappings View", () => {
|
|
|
452
367
|
const mockReportMappings = mockReportMappingsFactory();
|
|
453
368
|
const mockMappings = mockMappingsFactory(mockReportMappings);
|
|
454
369
|
|
|
455
|
-
mockIModelsClient.setup(async (x) => x.getSingle(moq.It.isObjectWith<GetSingleIModelParams>({ iModelId: mockIModelId1 })))
|
|
456
|
-
.returns(async () => mockIModelsResponse[0].iModel);
|
|
457
|
-
|
|
458
|
-
mockIModelsClient.setup(async (x) => x.getSingle(moq.It.isObjectWith<GetSingleIModelParams>({ iModelId: mockIModelId2 })))
|
|
459
|
-
.returns(async () => mockIModelsResponse[1].iModel);
|
|
460
|
-
|
|
461
370
|
mockGetMapping.mockReturnValueOnce(mockMappings[0].mapping).mockReturnValueOnce(mockMappings[1].mapping);
|
|
462
371
|
mockGetReportMappings.mockReturnValueOnce(mockReportMappings.mappings);
|
|
463
372
|
|
|
464
373
|
const iModels = mockIModelsResponse.map((iModel) => iModel.iModel.id);
|
|
465
|
-
mockBulkExtractor.setup(async (x) => x.runIModelExtractions(iModels)).returns(async () => Promise.resolve());
|
|
466
374
|
|
|
467
|
-
const
|
|
375
|
+
const bulkExtractor = new BulkExtractor(new ReportsClient(), new ExtractionClient(), jest.fn().mockResolvedValue("mockAccessToken"), jest.fn, jest.fn);
|
|
376
|
+
|
|
377
|
+
const runIModelExtractionsMock = jest.spyOn(bulkExtractor, "runIModelExtractions").mockImplementation(async () => Promise.resolve());
|
|
378
|
+
|
|
379
|
+
const { user } = render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object, bulkExtractor });
|
|
468
380
|
|
|
469
381
|
await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
|
|
470
382
|
|
|
@@ -472,7 +384,10 @@ describe("Report Mappings View", () => {
|
|
|
472
384
|
expect(extractAllButton).toBeInTheDocument();
|
|
473
385
|
|
|
474
386
|
await user.click(extractAllButton);
|
|
475
|
-
|
|
387
|
+
await waitFor(() => expect(extractAllButton).toBeEnabled());
|
|
388
|
+
|
|
389
|
+
// Check that the mocked method was called with the expected arguments
|
|
390
|
+
expect(runIModelExtractionsMock).toHaveBeenCalledWith(iModels);
|
|
476
391
|
});
|
|
477
392
|
|
|
478
393
|
const assertHorizontalTiles = (horizontalTiles: HTMLElement[], mockMappings: MappingSingle[]) => {
|
|
@@ -7,37 +7,18 @@ import "@testing-library/jest-dom";
|
|
|
7
7
|
import {
|
|
8
8
|
render,
|
|
9
9
|
screen,
|
|
10
|
-
TestUtils,
|
|
11
10
|
waitForElementToBeRemoved,
|
|
12
11
|
within,
|
|
13
12
|
} from "../test/test-utils";
|
|
14
13
|
import { Reports } from "../widget/components/Reports";
|
|
15
|
-
import type {
|
|
16
|
-
IModelConnection,
|
|
17
|
-
SelectionSet,
|
|
18
|
-
SelectionSetEvent,
|
|
19
|
-
} from "@itwin/core-frontend";
|
|
20
|
-
import { NoRenderApp } from "@itwin/core-frontend";
|
|
21
14
|
import { ReportsConfigWidget } from "../ReportsConfigWidget";
|
|
22
15
|
import { rest } from "msw";
|
|
23
16
|
import { setupServer } from "msw/node";
|
|
24
|
-
import * as moq from "typemoq";
|
|
25
|
-
import type {
|
|
26
|
-
SelectionManager,
|
|
27
|
-
SelectionScopesManager,
|
|
28
|
-
} from "@itwin/presentation-frontend";
|
|
29
|
-
import {
|
|
30
|
-
Presentation,
|
|
31
|
-
SelectionChangeEvent,
|
|
32
|
-
} from "@itwin/presentation-frontend";
|
|
33
17
|
import faker from "@faker-js/faker";
|
|
34
18
|
import type { ReportCollection } from "@itwin/insights-client";
|
|
35
19
|
import userEvent from "@testing-library/user-event";
|
|
36
20
|
import { REPORTS_CONFIG_BASE_URL } from "../widget/ReportsConfigUiProvider";
|
|
37
|
-
import
|
|
38
|
-
|
|
39
|
-
const mockITwinId = faker.datatype.uuid();
|
|
40
|
-
const mockIModelId = faker.datatype.uuid();
|
|
21
|
+
import { EmptyLocalization } from "@itwin/core-common";
|
|
41
22
|
|
|
42
23
|
const reportsFactory = (): ReportCollection => ({
|
|
43
24
|
reports: Array.from(
|
|
@@ -62,56 +43,15 @@ const reportsFactory = (): ReportCollection => ({
|
|
|
62
43
|
},
|
|
63
44
|
});
|
|
64
45
|
|
|
65
|
-
const connectionMock = moq.Mock.ofType<IModelConnection>();
|
|
66
|
-
const selectionManagerMock = moq.Mock.ofType<SelectionManager>();
|
|
67
|
-
const selectionScopesManagerMock = moq.Mock.ofType<SelectionScopesManager>();
|
|
68
|
-
|
|
69
|
-
jest.mock("@itwin/appui-react", () => ({
|
|
70
|
-
...jest.requireActual("@itwin/appui-react"),
|
|
71
|
-
useActiveIModelConnection: () => connectionMock.object,
|
|
72
|
-
}));
|
|
73
|
-
|
|
74
|
-
jest.mock("../widget/components/ReportMappings", () => ({
|
|
75
|
-
ReportMappings: () => "MockReportMappings",
|
|
76
|
-
}));
|
|
77
|
-
|
|
78
46
|
const server = setupServer();
|
|
79
47
|
|
|
80
48
|
beforeAll(async () => {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
await NoRenderApp.startup();
|
|
85
|
-
await Presentation.initialize();
|
|
86
|
-
const selectionSet = moq.Mock.ofType<SelectionSet>();
|
|
87
|
-
const onChanged = moq.Mock.ofType<BeEvent<(ev: SelectionSetEvent) => void>>();
|
|
88
|
-
selectionSet.setup((x) => x.elements).returns(() => new Set([]));
|
|
89
|
-
selectionSet.setup((x) => x.onChanged).returns(() => onChanged.object);
|
|
90
|
-
connectionMock
|
|
91
|
-
.setup((x) => x.selectionSet)
|
|
92
|
-
.returns(() => selectionSet.object);
|
|
93
|
-
connectionMock.setup((x) => x.iModelId).returns(() => mockIModelId);
|
|
94
|
-
connectionMock.setup((x) => x.iTwinId).returns(() => mockITwinId);
|
|
95
|
-
|
|
96
|
-
selectionManagerMock
|
|
97
|
-
.setup((x) => x.selectionChange)
|
|
98
|
-
.returns(() => new SelectionChangeEvent());
|
|
99
|
-
|
|
100
|
-
selectionScopesManagerMock
|
|
101
|
-
.setup(async (x) => x.getSelectionScopes(connectionMock.object))
|
|
102
|
-
.returns(async () => []);
|
|
103
|
-
selectionManagerMock
|
|
104
|
-
.setup((x) => x.scopes)
|
|
105
|
-
.returns(() => selectionScopesManagerMock.object);
|
|
106
|
-
|
|
107
|
-
Presentation.setSelectionManager(selectionManagerMock.object);
|
|
108
|
-
await TestUtils.initializeUiFramework(connectionMock.object);
|
|
109
|
-
await ReportsConfigWidget.initialize();
|
|
49
|
+
const localization = new EmptyLocalization();
|
|
50
|
+
await ReportsConfigWidget.initialize(localization);
|
|
110
51
|
server.listen();
|
|
111
52
|
});
|
|
112
53
|
|
|
113
54
|
afterAll(() => {
|
|
114
|
-
TestUtils.terminateUiFramework();
|
|
115
55
|
server.close();
|
|
116
56
|
});
|
|
117
57
|
|
|
@@ -132,14 +72,16 @@ describe("Reports View", () => {
|
|
|
132
72
|
)
|
|
133
73
|
);
|
|
134
74
|
|
|
135
|
-
const
|
|
75
|
+
const onClickAddMock = jest.fn();
|
|
76
|
+
|
|
77
|
+
const { user } = render(<Reports onClickAddReport={onClickAddMock} />);
|
|
136
78
|
|
|
137
79
|
await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
|
|
138
80
|
const ctaButton = screen.getByRole("button", {
|
|
139
81
|
name: /createonereportcta/i,
|
|
140
82
|
});
|
|
141
83
|
await user.click(ctaButton);
|
|
142
|
-
expect(
|
|
84
|
+
expect(onClickAddMock).toBeCalled();
|
|
143
85
|
});
|
|
144
86
|
|
|
145
87
|
it("be able to add new report", async () => {
|
|
@@ -156,14 +98,15 @@ describe("Reports View", () => {
|
|
|
156
98
|
)
|
|
157
99
|
);
|
|
158
100
|
|
|
159
|
-
const
|
|
101
|
+
const onClickAddMock = jest.fn();
|
|
102
|
+
const { user } = render(<Reports onClickAddReport={onClickAddMock} />);
|
|
160
103
|
|
|
161
104
|
await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
|
|
162
105
|
const newButton = screen.getByRole("button", {
|
|
163
106
|
name: /new/i,
|
|
164
107
|
});
|
|
165
108
|
await user.click(newButton);
|
|
166
|
-
expect(
|
|
109
|
+
expect(onClickAddMock).toBeCalled();
|
|
167
110
|
});
|
|
168
111
|
|
|
169
112
|
it("list all reports", async () => {
|
|
@@ -209,8 +152,8 @@ describe("Reports View", () => {
|
|
|
209
152
|
}
|
|
210
153
|
)
|
|
211
154
|
);
|
|
212
|
-
|
|
213
|
-
const { user } = render(<Reports />);
|
|
155
|
+
const onClickModifyMock = jest.fn();
|
|
156
|
+
const { user } = render(<Reports onClickReportModify={onClickModifyMock} />);
|
|
214
157
|
|
|
215
158
|
await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
|
|
216
159
|
|
|
@@ -221,7 +164,7 @@ describe("Reports View", () => {
|
|
|
221
164
|
const modifyButton = screen.getByRole("menuitem", { name: /modify/i });
|
|
222
165
|
await user.click(modifyButton);
|
|
223
166
|
|
|
224
|
-
expect(
|
|
167
|
+
expect(onClickModifyMock).toBeCalled();
|
|
225
168
|
});
|
|
226
169
|
|
|
227
170
|
it("remove a report", async () => {
|
|
@@ -291,9 +234,8 @@ describe("Reports View", () => {
|
|
|
291
234
|
|
|
292
235
|
await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
|
|
293
236
|
|
|
294
|
-
const searchButton =
|
|
295
|
-
|
|
296
|
-
);
|
|
237
|
+
const searchButton = screen.getByTestId(/rcw-search-button/i);
|
|
238
|
+
|
|
297
239
|
await user.click(searchButton);
|
|
298
240
|
const searchInput = screen.getByRole("textbox", {
|
|
299
241
|
name: /search\-textbox/i,
|
|
@@ -331,8 +273,8 @@ describe("Reports View", () => {
|
|
|
331
273
|
}
|
|
332
274
|
)
|
|
333
275
|
);
|
|
334
|
-
|
|
335
|
-
const { user } = render(<Reports />);
|
|
276
|
+
const onClickModifyMock = jest.fn();
|
|
277
|
+
const { user } = render(<Reports onClickReportModify={onClickModifyMock} />);
|
|
336
278
|
|
|
337
279
|
await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
|
|
338
280
|
|
|
@@ -342,8 +284,7 @@ describe("Reports View", () => {
|
|
|
342
284
|
await user.click(firstMenuDropdown);
|
|
343
285
|
const modifyButton = screen.getByRole("menuitem", { name: /modify/i });
|
|
344
286
|
await user.click(modifyButton);
|
|
345
|
-
|
|
346
|
-
expect(screen.getByText(/modifyreport/i)).toBeInTheDocument();
|
|
287
|
+
expect(onClickModifyMock).toBeCalled();
|
|
347
288
|
});
|
|
348
289
|
|
|
349
290
|
it("click a report", async () => {
|
|
@@ -356,8 +297,8 @@ describe("Reports View", () => {
|
|
|
356
297
|
}
|
|
357
298
|
)
|
|
358
299
|
);
|
|
359
|
-
|
|
360
|
-
const { user } = render(<Reports />);
|
|
300
|
+
const onClickTitleMock = jest.fn();
|
|
301
|
+
const { user } = render(<Reports onClickReportTitle={onClickTitleMock} />);
|
|
361
302
|
|
|
362
303
|
await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
|
|
363
304
|
|
|
@@ -365,6 +306,6 @@ describe("Reports View", () => {
|
|
|
365
306
|
mockedReports.reports[0].displayName
|
|
366
307
|
);
|
|
367
308
|
await user.click(reportName);
|
|
368
|
-
expect(
|
|
309
|
+
expect(onClickTitleMock).toBeCalled();
|
|
369
310
|
});
|
|
370
311
|
});
|
|
@@ -7,8 +7,15 @@ import "@testing-library/jest-dom";
|
|
|
7
7
|
import { render, screen } from "../test/test-utils";
|
|
8
8
|
import { WidgetHeader } from "../widget/components/utils";
|
|
9
9
|
import { faker } from "@faker-js/faker";
|
|
10
|
+
import { EmptyLocalization } from "@itwin/core-common";
|
|
11
|
+
import { ReportsConfigWidget } from "../ReportsConfigWidget";
|
|
10
12
|
|
|
11
13
|
describe("Widget Header Component", () => {
|
|
14
|
+
beforeAll(async () => {
|
|
15
|
+
const localization = new EmptyLocalization();
|
|
16
|
+
await ReportsConfigWidget.initialize(localization);
|
|
17
|
+
});
|
|
18
|
+
|
|
12
19
|
it("title renders", async () => {
|
|
13
20
|
const fakeTitle = faker.word.interjection();
|
|
14
21
|
render(<WidgetHeader title={fakeTitle} />);
|
|
@@ -20,9 +27,9 @@ describe("Widget Header Component", () => {
|
|
|
20
27
|
|
|
21
28
|
it("header allows return callback", async () => {
|
|
22
29
|
const mockReturnFn = jest.fn();
|
|
23
|
-
const { user } = render(<WidgetHeader title="" returnFn={mockReturnFn} />);
|
|
30
|
+
const { user, container } = render(<WidgetHeader title="" returnFn={mockReturnFn} />);
|
|
24
31
|
|
|
25
|
-
const returnBtn =
|
|
32
|
+
const returnBtn = container.getElementsByClassName("rcw-chevron")[0];
|
|
26
33
|
await user.click(returnBtn);
|
|
27
34
|
expect(mockReturnFn).toHaveBeenCalledTimes(1);
|
|
28
35
|
});
|
package/src/test/test-utils.tsx
CHANGED
|
@@ -4,35 +4,26 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import { render as rtlRender } from "@testing-library/react";
|
|
7
|
-
import { ReportsApiConfigContext } from "../widget/context/ReportsApiConfigContext";
|
|
8
|
-
import type { Store } from "redux";
|
|
9
|
-
import { combineReducers, createStore } from "redux";
|
|
10
|
-
import {
|
|
11
|
-
FrameworkReducer,
|
|
12
|
-
SyncUiEventDispatcher,
|
|
13
|
-
UiFramework,
|
|
14
|
-
} from "@itwin/appui-react";
|
|
15
|
-
import type { IModelConnection } from "@itwin/core-frontend";
|
|
16
|
-
import { ReportsConfigWidget } from "../ReportsConfigWidget";
|
|
17
7
|
import userEvent from "@testing-library/user-event";
|
|
18
|
-
import {
|
|
8
|
+
import type { ReportsConfigContextProps } from "../widget/components/ReportsConfigContext";
|
|
9
|
+
import { ReportsConfigContext } from "../widget/components/ReportsConfigContext";
|
|
19
10
|
|
|
20
11
|
export const mockAccessToken = async () => "Bearer eyJhbGci";
|
|
21
12
|
|
|
22
13
|
interface WrapperProps {
|
|
23
14
|
children?: React.ReactNode;
|
|
24
15
|
}
|
|
16
|
+
export const mockITwinId: string = "mockiTwinId";
|
|
25
17
|
|
|
26
|
-
function render(ui: React.ReactElement, { ...options } = {}) {
|
|
18
|
+
function render(ui: React.ReactElement, contextProps?: Partial<ReportsConfigContextProps>, { ...options } = {}) {
|
|
27
19
|
const Wrapper = ({ children }: WrapperProps) => (
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}}
|
|
20
|
+
<ReportsConfigContext
|
|
21
|
+
getAccessToken={mockAccessToken}
|
|
22
|
+
iTwinId={contextProps?.iTwinId ?? mockITwinId}
|
|
23
|
+
{...contextProps}
|
|
33
24
|
>
|
|
34
25
|
{children}
|
|
35
|
-
</
|
|
26
|
+
</ReportsConfigContext>
|
|
36
27
|
);
|
|
37
28
|
|
|
38
29
|
return {
|
|
@@ -44,34 +35,3 @@ function render(ui: React.ReactElement, { ...options } = {}) {
|
|
|
44
35
|
export * from "@testing-library/react";
|
|
45
36
|
// override React Testing Library's render with our own
|
|
46
37
|
export { render };
|
|
47
|
-
|
|
48
|
-
export class TestUtils {
|
|
49
|
-
public static createAppStore(): Store {
|
|
50
|
-
const rootReducer = combineReducers({
|
|
51
|
-
frameworkState: FrameworkReducer,
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
return createStore(
|
|
55
|
-
rootReducer,
|
|
56
|
-
(window as any).__REDUX_DEVTOOLS_EXTENSION__ &&
|
|
57
|
-
(window as any).__REDUX_DEVTOOLS_EXTENSION__()
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
public static async initializeUiFramework(_?: IModelConnection) {
|
|
62
|
-
const store = this.createAppStore();
|
|
63
|
-
|
|
64
|
-
await UiFramework.initialize(store);
|
|
65
|
-
|
|
66
|
-
// Set the iModelConnection in the Redux store
|
|
67
|
-
// Can not get it to function as intended. Store does not update with the iModel connection
|
|
68
|
-
// if (imodel)
|
|
69
|
-
// UiFramework.setIModelConnection(imodel);
|
|
70
|
-
|
|
71
|
-
SyncUiEventDispatcher.setTimeoutPeriod(0); // disables non-immediate event processing.
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
public static terminateUiFramework() {
|
|
75
|
-
ReportsConfigWidget.terminate();
|
|
76
|
-
}
|
|
77
|
-
}
|