@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Reports.test.js","sourceRoot":"","sources":["../../../src/test/Reports.test.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,2BAA2B,CAAC;AACnC,OAAO,EACL,MAAM,EACN,MAAM,EACN,SAAS,EACT,yBAAyB,EACzB,MAAM,GACP,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAMvD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,GAAG,MAAM,SAAS,CA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C;QAC/B,8BAA8B;QAC9B,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gBAAgB,EAAE,KAAK,IAAI,EAAE;QAC9B,MAAM,aAAa,GAAqB,cAAc,EAAE,CAAC;QACzD,MAAM,CAAC,GAAG,CACR,IAAI,CAAC,GAAG,CACN,GAAG,uBAAuB,6BAA6B,EACvD,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;YACvB,OAAO,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;QACvE,CAAC,CACF,CACF,CAAC;QAEF,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,oBAAC,OAAO,OAAG,CAAC,CAAC;QAErC,MAAM,yBAAyB,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;QAEpE,MAAM,UAAU,GAAG,MAAM,CAAC,SAAS,CACjC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,CACrC,CAAC;QACF,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC7B,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;IACtE,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 {\n render,\n screen,\n TestUtils,\n waitForElementToBeRemoved,\n within,\n} from \"../test/test-utils\";\nimport { Reports } from \"../widget/components/Reports\";\nimport type {\n IModelConnection,\n SelectionSet,\n SelectionSetEvent,\n} from \"@itwin/core-frontend\";\nimport { NoRenderApp } from \"@itwin/core-frontend\";\nimport { ReportsConfigWidget } from \"../ReportsConfigWidget\";\nimport { rest } from \"msw\";\nimport { setupServer } from \"msw/node\";\nimport * as moq from \"typemoq\";\nimport type {\n SelectionManager,\n SelectionScopesManager,\n} from \"@itwin/presentation-frontend\";\nimport {\n Presentation,\n SelectionChangeEvent,\n} from \"@itwin/presentation-frontend\";\nimport faker from \"@faker-js/faker\";\nimport type { ReportCollection } from \"@itwin/insights-client\";\nimport userEvent from \"@testing-library/user-event\";\nimport { REPORTS_CONFIG_BASE_URL } from \"../widget/ReportsConfigUiProvider\";\nimport type { BeEvent } from \"@itwin/core-bentley\";\n\nconst mockITwinId = faker.datatype.uuid();\nconst mockIModelId = faker.datatype.uuid();\n\nconst reportsFactory = (): ReportCollection => ({\n reports: Array.from(\n { length: faker.datatype.number({ min: 3, max: 5 }) },\n (_, index) => ({\n id: `${faker.datatype.uuid()}`,\n displayName: `mOcKRePoRT${index}`,\n description: `mOcKRePoRTDeScRiPtIoN${index}`,\n deleted: false,\n _links: {\n project: {\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\njest.mock(\"../widget/components/ReportMappings\", () => ({\n ReportMappings: () => \"MockReportMappings\",\n}));\n\nconst server = setupServer();\n\nbeforeAll(async () => {\n // This is required by the i18n module within iTwin.js\n (global as any).XMLHttpRequest = require(\"xmlhttprequest\").XMLHttpRequest; // eslint-disable-line @typescript-eslint/no-var-requires\n\n await NoRenderApp.startup();\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 await ReportsConfigWidget.initialize();\n server.listen();\n});\n\nafterAll(() => {\n TestUtils.terminateUiFramework();\n server.close();\n});\n\nafterEach(() => server.resetHandlers());\n\ndescribe(\"Reports View\", () => {\n it(\"call to action button should be clickable with no reports\", async () => {\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(500),\n ctx.status(200),\n ctx.json({ reports: [] })\n );\n }\n )\n );\n\n const { user } = render(<Reports />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n const ctaButton = screen.getByRole(\"button\", {\n name: /createonereportcta/i,\n });\n await user.click(ctaButton);\n expect(screen.getByText(/addreport/i)).toBeInTheDocument();\n });\n\n it(\"be able to add new report\", async () => {\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(500),\n ctx.status(200),\n ctx.json({ reports: [] })\n );\n }\n )\n );\n\n const { user } = render(<Reports />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n const newButton = screen.getByRole(\"button\", {\n name: /new/i,\n });\n await user.click(newButton);\n expect(screen.getByText(/addreport/i)).toBeInTheDocument();\n });\n\n it(\"list all reports\", async () => {\n const mockedReports: ReportCollection = reportsFactory();\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(ctx.delay(500), ctx.status(200), ctx.json(mockedReports));\n }\n )\n );\n\n render(<Reports />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n const horizontalTiles = screen.getAllByTestId(\"horizontal-tile\");\n // TODO check for all descriptions and names and imodels\n expect(horizontalTiles).toHaveLength(mockedReports?.reports.length);\n\n for (const [index, horizontalTile] of horizontalTiles.entries()) {\n const reportMappingTile = within(horizontalTile);\n expect(\n reportMappingTile.getByText(\n mockedReports?.reports[index].displayName ?? \"\"\n )\n ).toBeInTheDocument();\n expect(\n reportMappingTile.getByTitle(\n mockedReports?.reports[index].description ?? \"\"\n )\n ).toBeInTheDocument();\n }\n });\n\n it(\"able to modify a report\", async () => {\n const mockedReports: ReportCollection = reportsFactory();\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(ctx.delay(500), ctx.status(200), ctx.json(mockedReports));\n }\n )\n );\n\n const { user } = render(<Reports />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const firstMenuDropdown = within(\n screen.getAllByTestId(/tile-action-button/i)[0]\n ).getByRole(\"button\");\n await user.click(firstMenuDropdown);\n const modifyButton = screen.getByRole(\"menuitem\", { name: /modify/i });\n await user.click(modifyButton);\n\n expect(screen.getByText(/modifyreport/i)).toBeInTheDocument();\n });\n\n it(\"remove a report\", async () => {\n const mockedReports: ReportCollection = reportsFactory();\n const mockedReportsOriginalLength = mockedReports.reports.length;\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(ctx.delay(200), ctx.status(200), ctx.json(mockedReports));\n }\n ),\n rest.delete(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports/${mockedReports.reports[0].id\n }`,\n async (_req, res, ctx) => {\n mockedReports.reports = mockedReports.reports.filter(\n (report) => report.id !== mockedReports.reports[0].id\n );\n return res(ctx.delay(100), ctx.status(204));\n }\n )\n );\n\n const { user } = render(<Reports />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const firstMenuDropdown = within(\n screen.getAllByTestId(/tile-action-button/i)[0]\n ).getByRole(\"button\");\n await user.click(firstMenuDropdown);\n const removeButton = screen.getByRole(\"menuitem\", { name: /remove/i });\n await user.click(removeButton);\n // Delete modal dialog should appear\n expect(screen.getByRole(\"dialog\")).toBeInTheDocument();\n\n const deleteButton = screen.getByRole(\"button\", {\n name: /delete/i,\n });\n\n await user.click(deleteButton);\n\n await waitForElementToBeRemoved(() =>\n screen.getByTestId(/rcw-loading-delete/i)\n );\n await waitForElementToBeRemoved(() => screen.getByRole(\"dialog\"));\n\n // Should be one less report\n expect(screen.getAllByTestId(\"horizontal-tile\")).toHaveLength(\n mockedReportsOriginalLength - 1\n );\n });\n\n it(\"search for a report\", async () => {\n const mockedReports: ReportCollection = reportsFactory();\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(ctx.delay(200), ctx.status(200), ctx.json(mockedReports));\n }\n )\n );\n\n const { user } = render(<Reports />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const searchButton = within(screen.getByTestId(/rcw-search-bar/i)).getByRole(\n \"button\"\n );\n await user.click(searchButton);\n const searchInput = screen.getByRole(\"textbox\", {\n name: /search\\-textbox/i,\n });\n\n // Be an exact match on display name.\n await userEvent.type(\n searchInput,\n mockedReports.reports[0].displayName\n );\n expect(screen.getAllByTestId(\"horizontal-tile\")).toHaveLength(1);\n expect(\n screen.getByText(mockedReports.reports[0].displayName)\n ).toBeInTheDocument();\n\n // Be an exact match on description.\n await userEvent.clear(searchInput);\n await userEvent.type(\n searchInput,\n mockedReports.reports[0].description ?? \"\"\n );\n expect(screen.getAllByTestId(\"horizontal-tile\")).toHaveLength(1);\n expect(\n screen.getByText(mockedReports.reports[0].displayName)\n ).toBeInTheDocument();\n });\n\n it(\"modify a report\", async () => {\n const mockedReports: ReportCollection = reportsFactory();\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(ctx.delay(200), ctx.status(200), ctx.json(mockedReports));\n }\n )\n );\n\n const { user } = render(<Reports />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const firstMenuDropdown = within(\n screen.getAllByTestId(/tile-action-button/i)[0]\n ).getByRole(\"button\");\n await user.click(firstMenuDropdown);\n const modifyButton = screen.getByRole(\"menuitem\", { name: /modify/i });\n await user.click(modifyButton);\n // Modify report should appear\n expect(screen.getByText(/modifyreport/i)).toBeInTheDocument();\n });\n\n it(\"click a report\", async () => {\n const mockedReports: ReportCollection = reportsFactory();\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(ctx.delay(200), ctx.status(200), ctx.json(mockedReports));\n }\n )\n );\n\n const { user } = render(<Reports />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const reportName = screen.getByText(\n mockedReports.reports[0].displayName\n );\n await user.click(reportName);\n expect(screen.getByText(/MockReportMappings/i)).toBeInTheDocument();\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"Reports.test.js","sourceRoot":"","sources":["../../../src/test/Reports.test.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,2BAA2B,CAAC;AACnC,OAAO,EACL,MAAM,EACN,MAAM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SAAS,CACjC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,CACrC,CAAC;QACF,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC7B,MAAM,CAAC,gBAAgB,CAAC,CAAC,UAAU,EAAE,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 {\n render,\n screen,\n waitForElementToBeRemoved,\n within,\n} from \"../test/test-utils\";\nimport { Reports } from \"../widget/components/Reports\";\nimport { ReportsConfigWidget } from \"../ReportsConfigWidget\";\nimport { rest } from \"msw\";\nimport { setupServer } from \"msw/node\";\nimport faker from \"@faker-js/faker\";\nimport type { ReportCollection } from \"@itwin/insights-client\";\nimport userEvent from \"@testing-library/user-event\";\nimport { REPORTS_CONFIG_BASE_URL } from \"../widget/ReportsConfigUiProvider\";\nimport { EmptyLocalization } from \"@itwin/core-common\";\n\nconst reportsFactory = (): ReportCollection => ({\n reports: Array.from(\n { length: faker.datatype.number({ min: 3, max: 5 }) },\n (_, index) => ({\n id: `${faker.datatype.uuid()}`,\n displayName: `mOcKRePoRT${index}`,\n description: `mOcKRePoRTDeScRiPtIoN${index}`,\n deleted: false,\n _links: {\n project: {\n href: \"\",\n },\n },\n })\n ),\n _links: {\n next: undefined,\n self: {\n href: \"\",\n },\n },\n});\n\nconst server = setupServer();\n\nbeforeAll(async () => {\n const localization = new EmptyLocalization();\n await ReportsConfigWidget.initialize(localization);\n server.listen();\n});\n\nafterAll(() => {\n server.close();\n});\n\nafterEach(() => server.resetHandlers());\n\ndescribe(\"Reports View\", () => {\n it(\"call to action button should be clickable with no reports\", async () => {\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(500),\n ctx.status(200),\n ctx.json({ reports: [] })\n );\n }\n )\n );\n\n const onClickAddMock = jest.fn();\n\n const { user } = render(<Reports onClickAddReport={onClickAddMock} />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n const ctaButton = screen.getByRole(\"button\", {\n name: /createonereportcta/i,\n });\n await user.click(ctaButton);\n expect(onClickAddMock).toBeCalled();\n });\n\n it(\"be able to add new report\", async () => {\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(\n ctx.delay(500),\n ctx.status(200),\n ctx.json({ reports: [] })\n );\n }\n )\n );\n\n const onClickAddMock = jest.fn();\n const { user } = render(<Reports onClickAddReport={onClickAddMock} />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n const newButton = screen.getByRole(\"button\", {\n name: /new/i,\n });\n await user.click(newButton);\n expect(onClickAddMock).toBeCalled();\n });\n\n it(\"list all reports\", async () => {\n const mockedReports: ReportCollection = reportsFactory();\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(ctx.delay(500), ctx.status(200), ctx.json(mockedReports));\n }\n )\n );\n\n render(<Reports />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n const horizontalTiles = screen.getAllByTestId(\"horizontal-tile\");\n // TODO check for all descriptions and names and imodels\n expect(horizontalTiles).toHaveLength(mockedReports?.reports.length);\n\n for (const [index, horizontalTile] of horizontalTiles.entries()) {\n const reportMappingTile = within(horizontalTile);\n expect(\n reportMappingTile.getByText(\n mockedReports?.reports[index].displayName ?? \"\"\n )\n ).toBeInTheDocument();\n expect(\n reportMappingTile.getByTitle(\n mockedReports?.reports[index].description ?? \"\"\n )\n ).toBeInTheDocument();\n }\n });\n\n it(\"able to modify a report\", async () => {\n const mockedReports: ReportCollection = reportsFactory();\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(ctx.delay(500), ctx.status(200), ctx.json(mockedReports));\n }\n )\n );\n const onClickModifyMock = jest.fn();\n const { user } = render(<Reports onClickReportModify={onClickModifyMock} />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const firstMenuDropdown = within(\n screen.getAllByTestId(/tile-action-button/i)[0]\n ).getByRole(\"button\");\n await user.click(firstMenuDropdown);\n const modifyButton = screen.getByRole(\"menuitem\", { name: /modify/i });\n await user.click(modifyButton);\n\n expect(onClickModifyMock).toBeCalled();\n });\n\n it(\"remove a report\", async () => {\n const mockedReports: ReportCollection = reportsFactory();\n const mockedReportsOriginalLength = mockedReports.reports.length;\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(ctx.delay(200), ctx.status(200), ctx.json(mockedReports));\n }\n ),\n rest.delete(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports/${mockedReports.reports[0].id\n }`,\n async (_req, res, ctx) => {\n mockedReports.reports = mockedReports.reports.filter(\n (report) => report.id !== mockedReports.reports[0].id\n );\n return res(ctx.delay(100), ctx.status(204));\n }\n )\n );\n\n const { user } = render(<Reports />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const firstMenuDropdown = within(\n screen.getAllByTestId(/tile-action-button/i)[0]\n ).getByRole(\"button\");\n await user.click(firstMenuDropdown);\n const removeButton = screen.getByRole(\"menuitem\", { name: /remove/i });\n await user.click(removeButton);\n // Delete modal dialog should appear\n expect(screen.getByRole(\"dialog\")).toBeInTheDocument();\n\n const deleteButton = screen.getByRole(\"button\", {\n name: /delete/i,\n });\n\n await user.click(deleteButton);\n\n await waitForElementToBeRemoved(() =>\n screen.getByTestId(/rcw-loading-delete/i)\n );\n await waitForElementToBeRemoved(() => screen.getByRole(\"dialog\"));\n\n // Should be one less report\n expect(screen.getAllByTestId(\"horizontal-tile\")).toHaveLength(\n mockedReportsOriginalLength - 1\n );\n });\n\n it(\"search for a report\", async () => {\n const mockedReports: ReportCollection = reportsFactory();\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(ctx.delay(200), ctx.status(200), ctx.json(mockedReports));\n }\n )\n );\n\n const { user } = render(<Reports />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const searchButton = screen.getByTestId(/rcw-search-button/i);\n\n await user.click(searchButton);\n const searchInput = screen.getByRole(\"textbox\", {\n name: /search\\-textbox/i,\n });\n\n // Be an exact match on display name.\n await userEvent.type(\n searchInput,\n mockedReports.reports[0].displayName\n );\n expect(screen.getAllByTestId(\"horizontal-tile\")).toHaveLength(1);\n expect(\n screen.getByText(mockedReports.reports[0].displayName)\n ).toBeInTheDocument();\n\n // Be an exact match on description.\n await userEvent.clear(searchInput);\n await userEvent.type(\n searchInput,\n mockedReports.reports[0].description ?? \"\"\n );\n expect(screen.getAllByTestId(\"horizontal-tile\")).toHaveLength(1);\n expect(\n screen.getByText(mockedReports.reports[0].displayName)\n ).toBeInTheDocument();\n });\n\n it(\"modify a report\", async () => {\n const mockedReports: ReportCollection = reportsFactory();\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(ctx.delay(200), ctx.status(200), ctx.json(mockedReports));\n }\n )\n );\n const onClickModifyMock = jest.fn();\n const { user } = render(<Reports onClickReportModify={onClickModifyMock} />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const firstMenuDropdown = within(\n screen.getAllByTestId(/tile-action-button/i)[0]\n ).getByRole(\"button\");\n await user.click(firstMenuDropdown);\n const modifyButton = screen.getByRole(\"menuitem\", { name: /modify/i });\n await user.click(modifyButton);\n expect(onClickModifyMock).toBeCalled();\n });\n\n it(\"click a report\", async () => {\n const mockedReports: ReportCollection = reportsFactory();\n server.use(\n rest.get(\n `${REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`,\n async (_req, res, ctx) => {\n return res(ctx.delay(200), ctx.status(200), ctx.json(mockedReports));\n }\n )\n );\n const onClickTitleMock = jest.fn();\n const { user } = render(<Reports onClickReportTitle={onClickTitleMock} />);\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n const reportName = screen.getByText(\n mockedReports.reports[0].displayName\n );\n await user.click(reportName);\n expect(onClickTitleMock).toBeCalled();\n });\n});\n"]}
|
|
@@ -7,7 +7,13 @@ 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
|
describe("Widget Header Component", () => {
|
|
13
|
+
beforeAll(async () => {
|
|
14
|
+
const localization = new EmptyLocalization();
|
|
15
|
+
await ReportsConfigWidget.initialize(localization);
|
|
16
|
+
});
|
|
11
17
|
it("title renders", async () => {
|
|
12
18
|
const fakeTitle = faker.word.interjection();
|
|
13
19
|
render(React.createElement(WidgetHeader, { title: fakeTitle }));
|
|
@@ -16,8 +22,8 @@ describe("Widget Header Component", () => {
|
|
|
16
22
|
});
|
|
17
23
|
it("header allows return callback", async () => {
|
|
18
24
|
const mockReturnFn = jest.fn();
|
|
19
|
-
const { user } = render(React.createElement(WidgetHeader, { title: "", returnFn: mockReturnFn }));
|
|
20
|
-
const returnBtn =
|
|
25
|
+
const { user, container } = render(React.createElement(WidgetHeader, { title: "", returnFn: mockReturnFn }));
|
|
26
|
+
const returnBtn = container.getElementsByClassName("rcw-chevron")[0];
|
|
21
27
|
await user.click(returnBtn);
|
|
22
28
|
expect(mockReturnFn).toHaveBeenCalledTimes(1);
|
|
23
29
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WidgetHeader.test.js","sourceRoot":"","sources":["../../../src/test/WidgetHeader.test.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"WidgetHeader.test.js","sourceRoot":"","sources":["../../../src/test/WidgetHeader.test.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,MAAM,YAAY,GAAG,IAAI,iBAAiB,EAAE,CAAC;QAC7C,MAAM,mBAAmB,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;QAC7B,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;QAC5C,MAAM,CAAC,oBAAC,YAAY,IAAC,KAAK,EAAE,SAAS,GAAI,CAAC,CAAC;QAE3C,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAE1C,MAAM,CAAC,KAAK,CAAC,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+BAA+B,EAAE,KAAK,IAAI,EAAE;QAC7C,MAAM,YAAY,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QAC/B,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC,oBAAC,YAAY,IAAC,KAAK,EAAC,EAAE,EAAC,QAAQ,EAAE,YAAY,GAAI,CAAC,CAAC;QAEtF,MAAM,SAAS,GAAG,SAAS,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;QACrE,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC5B,MAAM,CAAC,YAAY,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAChD,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 { render, screen } from \"../test/test-utils\";\nimport { WidgetHeader } from \"../widget/components/utils\";\nimport { faker } from \"@faker-js/faker\";\nimport { EmptyLocalization } from \"@itwin/core-common\";\nimport { ReportsConfigWidget } from \"../ReportsConfigWidget\";\n\ndescribe(\"Widget Header Component\", () => {\n beforeAll(async () => {\n const localization = new EmptyLocalization();\n await ReportsConfigWidget.initialize(localization);\n });\n\n it(\"title renders\", async () => {\n const fakeTitle = faker.word.interjection();\n render(<WidgetHeader title={fakeTitle} />);\n\n const title = screen.getByText(fakeTitle);\n\n expect(title).toHaveTextContent(fakeTitle);\n });\n\n it(\"header allows return callback\", async () => {\n const mockReturnFn = jest.fn();\n const { user, container } = render(<WidgetHeader title=\"\" returnFn={mockReturnFn} />);\n\n const returnBtn = container.getElementsByClassName(\"rcw-chevron\")[0];\n await user.click(returnBtn);\n expect(mockReturnFn).toHaveBeenCalledTimes(1);\n });\n});\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type {
|
|
3
|
-
import type { IModelConnection } from "@itwin/core-frontend";
|
|
2
|
+
import type { ReportsConfigContextProps } from "../widget/components/ReportsConfigContext";
|
|
4
3
|
export declare const mockAccessToken: () => Promise<string>;
|
|
5
|
-
declare
|
|
4
|
+
export declare const mockITwinId: string;
|
|
5
|
+
declare function render(ui: React.ReactElement, contextProps?: Partial<ReportsConfigContextProps>, { ...options }?: {}): {
|
|
6
6
|
container: HTMLElement;
|
|
7
7
|
baseElement: HTMLElement;
|
|
8
8
|
debug: (baseElement?: Element | DocumentFragment | (Element | DocumentFragment)[] | undefined, maxLength?: number | undefined, options?: any) => void;
|
|
@@ -61,9 +61,4 @@ declare function render(ui: React.ReactElement, { ...options }?: {}): {
|
|
|
61
61
|
};
|
|
62
62
|
export * from "@testing-library/react";
|
|
63
63
|
export { render };
|
|
64
|
-
export declare class TestUtils {
|
|
65
|
-
static createAppStore(): Store;
|
|
66
|
-
static initializeUiFramework(_?: IModelConnection): Promise<void>;
|
|
67
|
-
static terminateUiFramework(): void;
|
|
68
|
-
}
|
|
69
64
|
//# sourceMappingURL=test-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../../src/test/test-utils.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../../src/test/test-utils.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AAG3F,eAAO,MAAM,eAAe,uBAAgC,CAAC;AAK7D,eAAO,MAAM,WAAW,EAAE,MAAsB,CAAC;AAEjD,iBAAS,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,YAAY,EAAE,YAAY,CAAC,EAAE,OAAO,CAAC,yBAAyB,CAAC,EAAE,EAAE,GAAG,OAAO,EAAE,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAe7G;AAED,cAAc,wBAAwB,CAAC;AAEvC,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -4,18 +4,12 @@
|
|
|
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 { combineReducers, createStore } from "redux";
|
|
9
|
-
import { FrameworkReducer, SyncUiEventDispatcher, UiFramework, } from "@itwin/appui-react";
|
|
10
|
-
import { ReportsConfigWidget } from "../ReportsConfigWidget";
|
|
11
7
|
import userEvent from "@testing-library/user-event";
|
|
12
|
-
import {
|
|
8
|
+
import { ReportsConfigContext } from "../widget/components/ReportsConfigContext";
|
|
13
9
|
export const mockAccessToken = async () => "Bearer eyJhbGci";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
baseUrl: REPORTS_CONFIG_BASE_URL,
|
|
18
|
-
} }, children));
|
|
10
|
+
export const mockITwinId = "mockiTwinId";
|
|
11
|
+
function render(ui, contextProps, { ...options } = {}) {
|
|
12
|
+
const Wrapper = ({ children }) => (React.createElement(ReportsConfigContext, { getAccessToken: mockAccessToken, iTwinId: contextProps?.iTwinId ?? mockITwinId, ...contextProps }, children));
|
|
19
13
|
return {
|
|
20
14
|
user: userEvent.setup(),
|
|
21
15
|
...rtlRender(ui, { wrapper: Wrapper, ...options }),
|
|
@@ -24,25 +18,4 @@ function render(ui, { ...options } = {}) {
|
|
|
24
18
|
export * from "@testing-library/react";
|
|
25
19
|
// override React Testing Library's render with our own
|
|
26
20
|
export { render };
|
|
27
|
-
export class TestUtils {
|
|
28
|
-
static createAppStore() {
|
|
29
|
-
const rootReducer = combineReducers({
|
|
30
|
-
frameworkState: FrameworkReducer,
|
|
31
|
-
});
|
|
32
|
-
return createStore(rootReducer, window.__REDUX_DEVTOOLS_EXTENSION__ &&
|
|
33
|
-
window.__REDUX_DEVTOOLS_EXTENSION__());
|
|
34
|
-
}
|
|
35
|
-
static async initializeUiFramework(_) {
|
|
36
|
-
const store = this.createAppStore();
|
|
37
|
-
await UiFramework.initialize(store);
|
|
38
|
-
// Set the iModelConnection in the Redux store
|
|
39
|
-
// Can not get it to function as intended. Store does not update with the iModel connection
|
|
40
|
-
// if (imodel)
|
|
41
|
-
// UiFramework.setIModelConnection(imodel);
|
|
42
|
-
SyncUiEventDispatcher.setTimeoutPeriod(0); // disables non-immediate event processing.
|
|
43
|
-
}
|
|
44
|
-
static terminateUiFramework() {
|
|
45
|
-
ReportsConfigWidget.terminate();
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
21
|
//# sourceMappingURL=test-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-utils.js","sourceRoot":"","sources":["../../../src/test/test-utils.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,
|
|
1
|
+
{"version":3,"file":"test-utils.js","sourceRoot":"","sources":["../../../src/test/test-utils.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,SAAS,MAAM,6BAA6B,CAAC;AAEpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,IAAI,EAAE,CAAC,iBAAiB,CAAC;AAK7D,MAAM,CAAC,MAAM,WAAW,GAAW,aAAa,CAAC;AAEjD,SAAS,MAAM,CAAC,EAAsB,EAAE,YAAiD,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE;IAC5G,MAAM,OAAO,GAAG,CAAC,EAAE,QAAQ,EAAgB,EAAE,EAAE,CAAC,CAC9C,oBAAC,oBAAoB,IACnB,cAAc,EAAE,eAAe,EAC/B,OAAO,EAAE,YAAY,EAAE,OAAO,IAAI,WAAW,KACzC,YAAY,IAEf,QAAQ,CACY,CACxB,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,SAAS,CAAC,KAAK,EAAE;QACvB,GAAG,SAAS,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;KACnD,CAAC;AACJ,CAAC;AAED,cAAc,wBAAwB,CAAC;AACvC,uDAAuD;AACvD,OAAO,EAAE,MAAM,EAAE,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 * as React from \"react\";\nimport { render as rtlRender } from \"@testing-library/react\";\nimport userEvent from \"@testing-library/user-event\";\nimport type { ReportsConfigContextProps } from \"../widget/components/ReportsConfigContext\";\nimport { ReportsConfigContext } from \"../widget/components/ReportsConfigContext\";\n\nexport const mockAccessToken = async () => \"Bearer eyJhbGci\";\n\ninterface WrapperProps {\n children?: React.ReactNode;\n}\nexport const mockITwinId: string = \"mockiTwinId\";\n\nfunction render(ui: React.ReactElement, contextProps?: Partial<ReportsConfigContextProps>, { ...options } = {}) {\n const Wrapper = ({ children }: WrapperProps) => (\n <ReportsConfigContext\n getAccessToken={mockAccessToken}\n iTwinId={contextProps?.iTwinId ?? mockITwinId}\n {...contextProps}\n >\n {children}\n </ReportsConfigContext>\n );\n\n return {\n user: userEvent.setup(),\n ...rtlRender(ui, { wrapper: Wrapper, ...options }),\n };\n}\n\nexport * from \"@testing-library/react\";\n// override React Testing Library's render with our own\nexport { render };\n"]}
|