@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,23 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
4
|
};
|
|
@@ -30,17 +11,13 @@ const react_1 = __importDefault(require("react"));
|
|
|
30
11
|
require("@testing-library/jest-dom");
|
|
31
12
|
const test_utils_1 = require("../test/test-utils");
|
|
32
13
|
const Reports_1 = require("../widget/components/Reports");
|
|
33
|
-
const core_frontend_1 = require("@itwin/core-frontend");
|
|
34
14
|
const ReportsConfigWidget_1 = require("../ReportsConfigWidget");
|
|
35
15
|
const msw_1 = require("msw");
|
|
36
16
|
const node_1 = require("msw/node");
|
|
37
|
-
const moq = __importStar(require("typemoq"));
|
|
38
|
-
const presentation_frontend_1 = require("@itwin/presentation-frontend");
|
|
39
17
|
const faker_1 = __importDefault(require("@faker-js/faker"));
|
|
40
18
|
const user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
41
19
|
const ReportsConfigUiProvider_1 = require("../widget/ReportsConfigUiProvider");
|
|
42
|
-
const
|
|
43
|
-
const mockIModelId = faker_1.default.datatype.uuid();
|
|
20
|
+
const core_common_1 = require("@itwin/core-common");
|
|
44
21
|
const reportsFactory = () => ({
|
|
45
22
|
reports: Array.from({ length: faker_1.default.datatype.number({ min: 3, max: 5 }) }, (_, index) => ({
|
|
46
23
|
id: `${faker_1.default.datatype.uuid()}`,
|
|
@@ -60,47 +37,13 @@ const reportsFactory = () => ({
|
|
|
60
37
|
},
|
|
61
38
|
},
|
|
62
39
|
});
|
|
63
|
-
const
|
|
64
|
-
const selectionManagerMock = moq.Mock.ofType();
|
|
65
|
-
const selectionScopesManagerMock = moq.Mock.ofType();
|
|
66
|
-
jest.mock("@itwin/appui-react", () => ({
|
|
67
|
-
...jest.requireActual("@itwin/appui-react"),
|
|
68
|
-
useActiveIModelConnection: () => connectionMock.object,
|
|
69
|
-
}));
|
|
70
|
-
jest.mock("../widget/components/ReportMappings", () => ({
|
|
71
|
-
ReportMappings: () => "MockReportMappings",
|
|
72
|
-
}));
|
|
73
|
-
const server = node_1.setupServer();
|
|
40
|
+
const server = (0, node_1.setupServer)();
|
|
74
41
|
beforeAll(async () => {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
await core_frontend_1.NoRenderApp.startup();
|
|
78
|
-
await presentation_frontend_1.Presentation.initialize();
|
|
79
|
-
const selectionSet = moq.Mock.ofType();
|
|
80
|
-
const onChanged = moq.Mock.ofType();
|
|
81
|
-
selectionSet.setup((x) => x.elements).returns(() => new Set([]));
|
|
82
|
-
selectionSet.setup((x) => x.onChanged).returns(() => onChanged.object);
|
|
83
|
-
connectionMock
|
|
84
|
-
.setup((x) => x.selectionSet)
|
|
85
|
-
.returns(() => selectionSet.object);
|
|
86
|
-
connectionMock.setup((x) => x.iModelId).returns(() => mockIModelId);
|
|
87
|
-
connectionMock.setup((x) => x.iTwinId).returns(() => mockITwinId);
|
|
88
|
-
selectionManagerMock
|
|
89
|
-
.setup((x) => x.selectionChange)
|
|
90
|
-
.returns(() => new presentation_frontend_1.SelectionChangeEvent());
|
|
91
|
-
selectionScopesManagerMock
|
|
92
|
-
.setup(async (x) => x.getSelectionScopes(connectionMock.object))
|
|
93
|
-
.returns(async () => []);
|
|
94
|
-
selectionManagerMock
|
|
95
|
-
.setup((x) => x.scopes)
|
|
96
|
-
.returns(() => selectionScopesManagerMock.object);
|
|
97
|
-
presentation_frontend_1.Presentation.setSelectionManager(selectionManagerMock.object);
|
|
98
|
-
await test_utils_1.TestUtils.initializeUiFramework(connectionMock.object);
|
|
99
|
-
await ReportsConfigWidget_1.ReportsConfigWidget.initialize();
|
|
42
|
+
const localization = new core_common_1.EmptyLocalization();
|
|
43
|
+
await ReportsConfigWidget_1.ReportsConfigWidget.initialize(localization);
|
|
100
44
|
server.listen();
|
|
101
45
|
});
|
|
102
46
|
afterAll(() => {
|
|
103
|
-
test_utils_1.TestUtils.terminateUiFramework();
|
|
104
47
|
server.close();
|
|
105
48
|
});
|
|
106
49
|
afterEach(() => server.resetHandlers());
|
|
@@ -109,41 +52,42 @@ describe("Reports View", () => {
|
|
|
109
52
|
server.use(msw_1.rest.get(`${ReportsConfigUiProvider_1.REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`, async (_req, res, ctx) => {
|
|
110
53
|
return res(ctx.delay(500), ctx.status(200), ctx.json({ reports: [] }));
|
|
111
54
|
}));
|
|
112
|
-
const
|
|
113
|
-
|
|
55
|
+
const onClickAddMock = jest.fn();
|
|
56
|
+
const { user } = (0, test_utils_1.render)(react_1.default.createElement(Reports_1.Reports, { onClickAddReport: onClickAddMock }));
|
|
57
|
+
await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByText(/loading/i));
|
|
114
58
|
const ctaButton = test_utils_1.screen.getByRole("button", {
|
|
115
59
|
name: /createonereportcta/i,
|
|
116
60
|
});
|
|
117
61
|
await user.click(ctaButton);
|
|
118
|
-
expect(
|
|
62
|
+
expect(onClickAddMock).toBeCalled();
|
|
119
63
|
});
|
|
120
64
|
it("be able to add new report", async () => {
|
|
121
65
|
server.use(msw_1.rest.get(`${ReportsConfigUiProvider_1.REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`, async (_req, res, ctx) => {
|
|
122
66
|
return res(ctx.delay(500), ctx.status(200), ctx.json({ reports: [] }));
|
|
123
67
|
}));
|
|
124
|
-
const
|
|
125
|
-
|
|
68
|
+
const onClickAddMock = jest.fn();
|
|
69
|
+
const { user } = (0, test_utils_1.render)(react_1.default.createElement(Reports_1.Reports, { onClickAddReport: onClickAddMock }));
|
|
70
|
+
await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByText(/loading/i));
|
|
126
71
|
const newButton = test_utils_1.screen.getByRole("button", {
|
|
127
72
|
name: /new/i,
|
|
128
73
|
});
|
|
129
74
|
await user.click(newButton);
|
|
130
|
-
expect(
|
|
75
|
+
expect(onClickAddMock).toBeCalled();
|
|
131
76
|
});
|
|
132
77
|
it("list all reports", async () => {
|
|
133
|
-
var _a, _b;
|
|
134
78
|
const mockedReports = reportsFactory();
|
|
135
79
|
server.use(msw_1.rest.get(`${ReportsConfigUiProvider_1.REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`, async (_req, res, ctx) => {
|
|
136
80
|
return res(ctx.delay(500), ctx.status(200), ctx.json(mockedReports));
|
|
137
81
|
}));
|
|
138
|
-
test_utils_1.render(react_1.default.createElement(Reports_1.Reports, null));
|
|
139
|
-
await test_utils_1.waitForElementToBeRemoved(() => test_utils_1.screen.getByText(/loading/i));
|
|
82
|
+
(0, test_utils_1.render)(react_1.default.createElement(Reports_1.Reports, null));
|
|
83
|
+
await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByText(/loading/i));
|
|
140
84
|
const horizontalTiles = test_utils_1.screen.getAllByTestId("horizontal-tile");
|
|
141
85
|
// TODO check for all descriptions and names and imodels
|
|
142
|
-
expect(horizontalTiles).toHaveLength(mockedReports
|
|
86
|
+
expect(horizontalTiles).toHaveLength(mockedReports?.reports.length);
|
|
143
87
|
for (const [index, horizontalTile] of horizontalTiles.entries()) {
|
|
144
|
-
const reportMappingTile = test_utils_1.within(horizontalTile);
|
|
145
|
-
expect(reportMappingTile.getByText(
|
|
146
|
-
expect(reportMappingTile.getByTitle(
|
|
88
|
+
const reportMappingTile = (0, test_utils_1.within)(horizontalTile);
|
|
89
|
+
expect(reportMappingTile.getByText(mockedReports?.reports[index].displayName ?? "")).toBeInTheDocument();
|
|
90
|
+
expect(reportMappingTile.getByTitle(mockedReports?.reports[index].description ?? "")).toBeInTheDocument();
|
|
147
91
|
}
|
|
148
92
|
});
|
|
149
93
|
it("able to modify a report", async () => {
|
|
@@ -151,13 +95,14 @@ describe("Reports View", () => {
|
|
|
151
95
|
server.use(msw_1.rest.get(`${ReportsConfigUiProvider_1.REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`, async (_req, res, ctx) => {
|
|
152
96
|
return res(ctx.delay(500), ctx.status(200), ctx.json(mockedReports));
|
|
153
97
|
}));
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
98
|
+
const onClickModifyMock = jest.fn();
|
|
99
|
+
const { user } = (0, test_utils_1.render)(react_1.default.createElement(Reports_1.Reports, { onClickReportModify: onClickModifyMock }));
|
|
100
|
+
await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByText(/loading/i));
|
|
101
|
+
const firstMenuDropdown = (0, test_utils_1.within)(test_utils_1.screen.getAllByTestId(/tile-action-button/i)[0]).getByRole("button");
|
|
157
102
|
await user.click(firstMenuDropdown);
|
|
158
103
|
const modifyButton = test_utils_1.screen.getByRole("menuitem", { name: /modify/i });
|
|
159
104
|
await user.click(modifyButton);
|
|
160
|
-
expect(
|
|
105
|
+
expect(onClickModifyMock).toBeCalled();
|
|
161
106
|
});
|
|
162
107
|
it("remove a report", async () => {
|
|
163
108
|
const mockedReports = reportsFactory();
|
|
@@ -168,9 +113,9 @@ describe("Reports View", () => {
|
|
|
168
113
|
mockedReports.reports = mockedReports.reports.filter((report) => report.id !== mockedReports.reports[0].id);
|
|
169
114
|
return res(ctx.delay(100), ctx.status(204));
|
|
170
115
|
}));
|
|
171
|
-
const { user } = test_utils_1.render(react_1.default.createElement(Reports_1.Reports, null));
|
|
172
|
-
await test_utils_1.waitForElementToBeRemoved(() => test_utils_1.screen.getByText(/loading/i));
|
|
173
|
-
const firstMenuDropdown = test_utils_1.within(test_utils_1.screen.getAllByTestId(/tile-action-button/i)[0]).getByRole("button");
|
|
116
|
+
const { user } = (0, test_utils_1.render)(react_1.default.createElement(Reports_1.Reports, null));
|
|
117
|
+
await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByText(/loading/i));
|
|
118
|
+
const firstMenuDropdown = (0, test_utils_1.within)(test_utils_1.screen.getAllByTestId(/tile-action-button/i)[0]).getByRole("button");
|
|
174
119
|
await user.click(firstMenuDropdown);
|
|
175
120
|
const removeButton = test_utils_1.screen.getByRole("menuitem", { name: /remove/i });
|
|
176
121
|
await user.click(removeButton);
|
|
@@ -180,20 +125,19 @@ describe("Reports View", () => {
|
|
|
180
125
|
name: /delete/i,
|
|
181
126
|
});
|
|
182
127
|
await user.click(deleteButton);
|
|
183
|
-
await test_utils_1.waitForElementToBeRemoved(() => test_utils_1.screen.getByTestId(/rcw-loading-delete/i));
|
|
184
|
-
await test_utils_1.waitForElementToBeRemoved(() => test_utils_1.screen.getByRole("dialog"));
|
|
128
|
+
await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByTestId(/rcw-loading-delete/i));
|
|
129
|
+
await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByRole("dialog"));
|
|
185
130
|
// Should be one less report
|
|
186
131
|
expect(test_utils_1.screen.getAllByTestId("horizontal-tile")).toHaveLength(mockedReportsOriginalLength - 1);
|
|
187
132
|
});
|
|
188
133
|
it("search for a report", async () => {
|
|
189
|
-
var _a;
|
|
190
134
|
const mockedReports = reportsFactory();
|
|
191
135
|
server.use(msw_1.rest.get(`${ReportsConfigUiProvider_1.REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`, async (_req, res, ctx) => {
|
|
192
136
|
return res(ctx.delay(200), ctx.status(200), ctx.json(mockedReports));
|
|
193
137
|
}));
|
|
194
|
-
const { user } = test_utils_1.render(react_1.default.createElement(Reports_1.Reports, null));
|
|
195
|
-
await test_utils_1.waitForElementToBeRemoved(() => test_utils_1.screen.getByText(/loading/i));
|
|
196
|
-
const searchButton = test_utils_1.
|
|
138
|
+
const { user } = (0, test_utils_1.render)(react_1.default.createElement(Reports_1.Reports, null));
|
|
139
|
+
await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByText(/loading/i));
|
|
140
|
+
const searchButton = test_utils_1.screen.getByTestId(/rcw-search-button/i);
|
|
197
141
|
await user.click(searchButton);
|
|
198
142
|
const searchInput = test_utils_1.screen.getByRole("textbox", {
|
|
199
143
|
name: /search\-textbox/i,
|
|
@@ -204,7 +148,7 @@ describe("Reports View", () => {
|
|
|
204
148
|
expect(test_utils_1.screen.getByText(mockedReports.reports[0].displayName)).toBeInTheDocument();
|
|
205
149
|
// Be an exact match on description.
|
|
206
150
|
await user_event_1.default.clear(searchInput);
|
|
207
|
-
await user_event_1.default.type(searchInput,
|
|
151
|
+
await user_event_1.default.type(searchInput, mockedReports.reports[0].description ?? "");
|
|
208
152
|
expect(test_utils_1.screen.getAllByTestId("horizontal-tile")).toHaveLength(1);
|
|
209
153
|
expect(test_utils_1.screen.getByText(mockedReports.reports[0].displayName)).toBeInTheDocument();
|
|
210
154
|
});
|
|
@@ -213,25 +157,26 @@ describe("Reports View", () => {
|
|
|
213
157
|
server.use(msw_1.rest.get(`${ReportsConfigUiProvider_1.REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`, async (_req, res, ctx) => {
|
|
214
158
|
return res(ctx.delay(200), ctx.status(200), ctx.json(mockedReports));
|
|
215
159
|
}));
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
|
|
160
|
+
const onClickModifyMock = jest.fn();
|
|
161
|
+
const { user } = (0, test_utils_1.render)(react_1.default.createElement(Reports_1.Reports, { onClickReportModify: onClickModifyMock }));
|
|
162
|
+
await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByText(/loading/i));
|
|
163
|
+
const firstMenuDropdown = (0, test_utils_1.within)(test_utils_1.screen.getAllByTestId(/tile-action-button/i)[0]).getByRole("button");
|
|
219
164
|
await user.click(firstMenuDropdown);
|
|
220
165
|
const modifyButton = test_utils_1.screen.getByRole("menuitem", { name: /modify/i });
|
|
221
166
|
await user.click(modifyButton);
|
|
222
|
-
|
|
223
|
-
expect(test_utils_1.screen.getByText(/modifyreport/i)).toBeInTheDocument();
|
|
167
|
+
expect(onClickModifyMock).toBeCalled();
|
|
224
168
|
});
|
|
225
169
|
it("click a report", async () => {
|
|
226
170
|
const mockedReports = reportsFactory();
|
|
227
171
|
server.use(msw_1.rest.get(`${ReportsConfigUiProvider_1.REPORTS_CONFIG_BASE_URL}/insights/reporting/reports`, async (_req, res, ctx) => {
|
|
228
172
|
return res(ctx.delay(200), ctx.status(200), ctx.json(mockedReports));
|
|
229
173
|
}));
|
|
230
|
-
const
|
|
231
|
-
|
|
174
|
+
const onClickTitleMock = jest.fn();
|
|
175
|
+
const { user } = (0, test_utils_1.render)(react_1.default.createElement(Reports_1.Reports, { onClickReportTitle: onClickTitleMock }));
|
|
176
|
+
await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByText(/loading/i));
|
|
232
177
|
const reportName = test_utils_1.screen.getByText(mockedReports.reports[0].displayName);
|
|
233
178
|
await user.click(reportName);
|
|
234
|
-
expect(
|
|
179
|
+
expect(onClickTitleMock).toBeCalled();
|
|
235
180
|
});
|
|
236
181
|
});
|
|
237
182
|
//# sourceMappingURL=Reports.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Reports.test.js","sourceRoot":"","sources":["../../../src/test/Reports.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,kDAA0B;AAC1B,qCAAmC;AACnC,mDAM4B;AAC5B,0DAAuD;AAMvD,wDAAmD;AACnD,gEAA6D;AAC7D,6BAA2B;AAC3B,mCAAuC;AACvC,6CAA+B;AAK/B,wEAGsC;AACtC,4DAAoC;AAEpC,6EAAoD;AACpD,+EAA4E;AAG5E,MAAM,WAAW,GAAG,eAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC1C,MAAM,YAAY,GAAG,eAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAE3C,MAAM,cAAc,GAAG,GAAqB,EAAE,CAAC,CAAC;IAC9C,OAAO,EAAE,KAAK,CAAC,IAAI,CACj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E;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,mBAAM,CAAC,8BAAC,iBAAO,OAAG,CAAC,CAAC;QAErC,MAAM,sCAAyB,CAAC,GAAG,EAAE,CAAC,mBAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;QAEpE,MAAM,UAAU,GAAG,mBAAM,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,mBAAM,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,kDAA0B;AAC1B,qCAAmC;AACnC,mDAK4B;AAC5B,0DAAuD;AACvD,gEAA6D;AAC7D,6BAA2B;AAC3B,mCAAuC;AACvC,4DAAoC;AAEpC,6EAAoD;AACpD,+EAA4E;AAC5E,oDAAuD;AAEvD,MAAM,cAAc,GAAG,GAAqB,EAAE,CAAC,CAAC;IAC9C,OAAO,EAAE,KAAK,CAAC,IAAI,CACjB,EAAE,MAAM,EAAE,eAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,EACrD,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QACb,EA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AE,CAAC,gBAAgB,EAAE,KAAK,IAAI,EAAE;QAC9B,MAAM,aAAa,GAAqB,cAAc,EAAE,CAAC;QACzD,MAAM,CAAC,GAAG,CACR,UAAI,CAAC,GAAG,CACN,GAAG,iDAAuB,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;QACF,MAAM,gBAAgB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QACnC,MAAM,EAAE,IAAI,EAAE,GAAG,IAAA,mBAAM,EAAC,8BAAC,iBAAO,IAAC,kBAAkB,EAAE,gBAAgB,GAAI,CAAC,CAAC;QAE3E,MAAM,IAAA,sCAAyB,EAAC,GAAG,EAAE,CAAC,mBAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;QAEpE,MAAM,UAAU,GAAG,mBAAM,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,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"]}
|
|
@@ -12,17 +12,23 @@ require("@testing-library/jest-dom");
|
|
|
12
12
|
const test_utils_1 = require("../test/test-utils");
|
|
13
13
|
const utils_1 = require("../widget/components/utils");
|
|
14
14
|
const faker_1 = require("@faker-js/faker");
|
|
15
|
+
const core_common_1 = require("@itwin/core-common");
|
|
16
|
+
const ReportsConfigWidget_1 = require("../ReportsConfigWidget");
|
|
15
17
|
describe("Widget Header Component", () => {
|
|
18
|
+
beforeAll(async () => {
|
|
19
|
+
const localization = new core_common_1.EmptyLocalization();
|
|
20
|
+
await ReportsConfigWidget_1.ReportsConfigWidget.initialize(localization);
|
|
21
|
+
});
|
|
16
22
|
it("title renders", async () => {
|
|
17
23
|
const fakeTitle = faker_1.faker.word.interjection();
|
|
18
|
-
test_utils_1.render(react_1.default.createElement(utils_1.WidgetHeader, { title: fakeTitle }));
|
|
24
|
+
(0, test_utils_1.render)(react_1.default.createElement(utils_1.WidgetHeader, { title: fakeTitle }));
|
|
19
25
|
const title = test_utils_1.screen.getByText(fakeTitle);
|
|
20
26
|
expect(title).toHaveTextContent(fakeTitle);
|
|
21
27
|
});
|
|
22
28
|
it("header allows return callback", async () => {
|
|
23
29
|
const mockReturnFn = jest.fn();
|
|
24
|
-
const { user } = test_utils_1.render(react_1.default.createElement(utils_1.WidgetHeader, { title: "", returnFn: mockReturnFn }));
|
|
25
|
-
const returnBtn =
|
|
30
|
+
const { user, container } = (0, test_utils_1.render)(react_1.default.createElement(utils_1.WidgetHeader, { title: "", returnFn: mockReturnFn }));
|
|
31
|
+
const returnBtn = container.getElementsByClassName("rcw-chevron")[0];
|
|
26
32
|
await user.click(returnBtn);
|
|
27
33
|
expect(mockReturnFn).toHaveBeenCalledTimes(1);
|
|
28
34
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WidgetHeader.test.js","sourceRoot":"","sources":["../../../src/test/WidgetHeader.test.tsx"],"names":[],"mappings":";;;;;AAAA;;;+FAG+F;AAC/F,kDAA0B;AAC1B,qCAAmC;AACnC,mDAAoD;AACpD,sDAA0D;AAC1D,2CAAwC;
|
|
1
|
+
{"version":3,"file":"WidgetHeader.test.js","sourceRoot":"","sources":["../../../src/test/WidgetHeader.test.tsx"],"names":[],"mappings":";;;;;AAAA;;;+FAG+F;AAC/F,kDAA0B;AAC1B,qCAAmC;AACnC,mDAAoD;AACpD,sDAA0D;AAC1D,2CAAwC;AACxC,oDAAuD;AACvD,gEAA6D;AAE7D,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,MAAM,YAAY,GAAG,IAAI,+BAAiB,EAAE,CAAC;QAC7C,MAAM,yCAAmB,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;QAC7B,MAAM,SAAS,GAAG,aAAK,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;QAC5C,IAAA,mBAAM,EAAC,8BAAC,oBAAY,IAAC,KAAK,EAAE,SAAS,GAAI,CAAC,CAAC;QAE3C,MAAM,KAAK,GAAG,mBAAM,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,IAAA,mBAAM,EAAC,8BAAC,oBAAY,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"}
|
|
@@ -25,53 +25,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
25
25
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
26
|
};
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.
|
|
28
|
+
exports.render = exports.mockITwinId = exports.mockAccessToken = void 0;
|
|
29
29
|
/*---------------------------------------------------------------------------------------------
|
|
30
30
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
31
31
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
32
32
|
*--------------------------------------------------------------------------------------------*/
|
|
33
33
|
const React = __importStar(require("react"));
|
|
34
34
|
const react_1 = require("@testing-library/react");
|
|
35
|
-
const ReportsApiConfigContext_1 = require("../widget/context/ReportsApiConfigContext");
|
|
36
|
-
const redux_1 = require("redux");
|
|
37
|
-
const appui_react_1 = require("@itwin/appui-react");
|
|
38
|
-
const ReportsConfigWidget_1 = require("../ReportsConfigWidget");
|
|
39
35
|
const user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
40
|
-
const
|
|
36
|
+
const ReportsConfigContext_1 = require("../widget/components/ReportsConfigContext");
|
|
41
37
|
const mockAccessToken = async () => "Bearer eyJhbGci";
|
|
42
38
|
exports.mockAccessToken = mockAccessToken;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
baseUrl: ReportsConfigUiProvider_1.REPORTS_CONFIG_BASE_URL,
|
|
47
|
-
} }, children));
|
|
39
|
+
exports.mockITwinId = "mockiTwinId";
|
|
40
|
+
function render(ui, contextProps, { ...options } = {}) {
|
|
41
|
+
const Wrapper = ({ children }) => (React.createElement(ReportsConfigContext_1.ReportsConfigContext, { getAccessToken: exports.mockAccessToken, iTwinId: contextProps?.iTwinId ?? exports.mockITwinId, ...contextProps }, children));
|
|
48
42
|
return {
|
|
49
43
|
user: user_event_1.default.setup(),
|
|
50
|
-
...react_1.render(ui, { wrapper: Wrapper, ...options }),
|
|
44
|
+
...(0, react_1.render)(ui, { wrapper: Wrapper, ...options }),
|
|
51
45
|
};
|
|
52
46
|
}
|
|
53
47
|
exports.render = render;
|
|
54
48
|
__exportStar(require("@testing-library/react"), exports);
|
|
55
|
-
class TestUtils {
|
|
56
|
-
static createAppStore() {
|
|
57
|
-
const rootReducer = redux_1.combineReducers({
|
|
58
|
-
frameworkState: appui_react_1.FrameworkReducer,
|
|
59
|
-
});
|
|
60
|
-
return redux_1.createStore(rootReducer, window.__REDUX_DEVTOOLS_EXTENSION__ &&
|
|
61
|
-
window.__REDUX_DEVTOOLS_EXTENSION__());
|
|
62
|
-
}
|
|
63
|
-
static async initializeUiFramework(_) {
|
|
64
|
-
const store = this.createAppStore();
|
|
65
|
-
await appui_react_1.UiFramework.initialize(store);
|
|
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
|
-
appui_react_1.SyncUiEventDispatcher.setTimeoutPeriod(0); // disables non-immediate event processing.
|
|
71
|
-
}
|
|
72
|
-
static terminateUiFramework() {
|
|
73
|
-
ReportsConfigWidget_1.ReportsConfigWidget.terminate();
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
exports.TestUtils = TestUtils;
|
|
77
49
|
//# 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,6CAA+B;AAC/B,kDAA6D;AAC7D,
|
|
1
|
+
{"version":3,"file":"test-utils.js","sourceRoot":"","sources":["../../../src/test/test-utils.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,6CAA+B;AAC/B,kDAA6D;AAC7D,6EAAoD;AAEpD,oFAAiF;AAE1E,MAAM,eAAe,GAAG,KAAK,IAAI,EAAE,CAAC,iBAAiB,CAAC;AAAhD,QAAA,eAAe,mBAAiC;AAKhD,QAAA,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,2CAAoB,IACnB,cAAc,EAAE,uBAAe,EAC/B,OAAO,EAAE,YAAY,EAAE,OAAO,IAAI,mBAAW,KACzC,YAAY,IAEf,QAAQ,CACY,CACxB,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,oBAAS,CAAC,KAAK,EAAE;QACvB,GAAG,IAAA,cAAS,EAAC,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;KACnD,CAAC;AACJ,CAAC;AAIQ,wBAAM;AAFf,yDAAuC","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"]}
|