angular-slickgrid 9.0.0 → 9.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/{dist/fesm2022 → fesm2022}/angular-slickgrid.mjs +16 -16
- package/package.json +27 -14
- package/.gitbook.yaml +0 -5
- package/CHANGELOG.md +0 -1691
- package/CONTRIBUTING.md +0 -17
- package/angular.json +0 -133
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/clover.xml +0 -1620
- package/coverage/coverage-final.json +0 -9
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +0 -176
- package/coverage/library/components/angular-slickgrid.component.ts.html +0 -5074
- package/coverage/library/components/index.html +0 -116
- package/coverage/library/constants.ts.html +0 -397
- package/coverage/library/extensions/index.html +0 -116
- package/coverage/library/extensions/slickRowDetailView.ts.html +0 -1261
- package/coverage/library/index.html +0 -116
- package/coverage/library/modules/angular-slickgrid.module.ts.html +0 -166
- package/coverage/library/modules/index.html +0 -116
- package/coverage/library/services/angularUtil.service.ts.html +0 -445
- package/coverage/library/services/container.service.ts.html +0 -163
- package/coverage/library/services/index.html +0 -161
- package/coverage/library/services/translater.service.ts.html +0 -199
- package/coverage/library/services/utilities.ts.html +0 -142
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -196
- package/dist/LICENSE +0 -21
- package/dist/README.md +0 -142
- package/docs/README.md +0 -5
- package/docs/TOC.md +0 -105
- package/docs/backend-services/Custom-Backend-Service.md +0 -50
- package/docs/backend-services/GraphQL.md +0 -276
- package/docs/backend-services/OData.md +0 -245
- package/docs/backend-services/graphql/GraphQL-Filtering.md +0 -156
- package/docs/backend-services/graphql/GraphQL-JSON-Result.md +0 -85
- package/docs/backend-services/graphql/GraphQL-Pagination.md +0 -77
- package/docs/backend-services/graphql/GraphQL-Sorting.md +0 -78
- package/docs/column-functionalities/cell-menu.md +0 -212
- package/docs/column-functionalities/editors/autocomplete-editor.md +0 -466
- package/docs/column-functionalities/editors/date-editor-flatpickr.md +0 -71
- package/docs/column-functionalities/editors/date-editor-vanilla-calendar.md +0 -91
- package/docs/column-functionalities/editors/longtext-editor-textarea.md +0 -80
- package/docs/column-functionalities/editors/select-dropdown-editor.md +0 -227
- package/docs/column-functionalities/editors.md +0 -604
- package/docs/column-functionalities/filters/autocomplete-filter.md +0 -183
- package/docs/column-functionalities/filters/compound-filters.md +0 -234
- package/docs/column-functionalities/filters/custom-filter.md +0 -117
- package/docs/column-functionalities/filters/filter-intro.md +0 -81
- package/docs/column-functionalities/filters/input-filter.md +0 -260
- package/docs/column-functionalities/filters/range-filters.md +0 -188
- package/docs/column-functionalities/filters/select-filter.md +0 -695
- package/docs/column-functionalities/filters/single-search-filter.md +0 -77
- package/docs/column-functionalities/filters/styling-filled-filters.md +0 -45
- package/docs/column-functionalities/formatters.md +0 -325
- package/docs/column-functionalities/sorting.md +0 -200
- package/docs/developer-guides/csp-compliance.md +0 -64
- package/docs/events/Available-Events.md +0 -223
- package/docs/events/Grid-&-DataView-Events.md +0 -211
- package/docs/getting-started/quick-start.md +0 -230
- package/docs/getting-started/troubleshooting.md +0 -80
- package/docs/grid-functionalities/Column-Picker.md +0 -22
- package/docs/grid-functionalities/Composite-Editor-Modal.md +0 -627
- package/docs/grid-functionalities/Context-Menu.md +0 -226
- package/docs/grid-functionalities/Custom-Footer.md +0 -80
- package/docs/grid-functionalities/Custom-Tooltip-(plugin).md +0 -258
- package/docs/grid-functionalities/Export-to-Excel.md +0 -457
- package/docs/grid-functionalities/Export-to-Text-File.md +0 -165
- package/docs/grid-functionalities/FAQ.md +0 -53
- package/docs/grid-functionalities/Global-Options.md +0 -29
- package/docs/grid-functionalities/Grid-Auto-Resize.md +0 -218
- package/docs/grid-functionalities/Grid-Menu.md +0 -134
- package/docs/grid-functionalities/Grid-State-&-Preset.md +0 -245
- package/docs/grid-functionalities/Header-Menu-&-Header-Buttons.md +0 -125
- package/docs/grid-functionalities/Resize-by-Cell-Content.md +0 -138
- package/docs/grid-functionalities/Row-Selection.md +0 -247
- package/docs/grid-functionalities/Row-based-edit.md +0 -71
- package/docs/grid-functionalities/add-update-highlight.md +0 -258
- package/docs/grid-functionalities/column-row-spanning.md +0 -74
- package/docs/grid-functionalities/dynamic-item-metadata.md +0 -124
- package/docs/grid-functionalities/excel-copy-buffer.md +0 -145
- package/docs/grid-functionalities/frozen-columns-rows.md +0 -164
- package/docs/grid-functionalities/grouping-and-aggregators.md +0 -269
- package/docs/grid-functionalities/header-footer-slots.md +0 -22
- package/docs/grid-functionalities/infinite-scroll.md +0 -150
- package/docs/grid-functionalities/providing-grid-data.md +0 -61
- package/docs/grid-functionalities/row-detail.md +0 -530
- package/docs/grid-functionalities/tree-data-grid.md +0 -391
- package/docs/localization/Localization---Component-Sample.md +0 -87
- package/docs/localization/Localization-with-Custom-Locales.md +0 -66
- package/docs/localization/Localization-with-ngx-translate.md +0 -148
- package/docs/migrations/migration-to-2.x.md +0 -304
- package/docs/migrations/migration-to-3.x.md +0 -295
- package/docs/migrations/migration-to-4.x.md +0 -83
- package/docs/migrations/migration-to-5.x.md +0 -160
- package/docs/migrations/migration-to-6.x.md +0 -128
- package/docs/migrations/migration-to-7.x.md +0 -294
- package/docs/migrations/migration-to-8.x.md +0 -316
- package/docs/migrations/migration-to-9.x.md +0 -219
- package/docs/slick-grid-dataview-objects/slickgrid-dataview-objects.md +0 -79
- package/docs/styling/dark-mode.md +0 -100
- package/docs/styling/styling.md +0 -250
- package/docs/testing/testing-patterns.md +0 -73
- package/eslint.config.mjs +0 -60
- package/ng-package.json +0 -10
- package/src/assets/angular-logo.png +0 -0
- package/src/assets/angular-logo2.png +0 -0
- package/src/assets/data/collection_100_numbers.json +0 -12
- package/src/assets/data/collection_500_numbers.json +0 -52
- package/src/assets/data/countries.json +0 -245
- package/src/assets/data/country_names.json +0 -245
- package/src/assets/data/customers_100.json +0 -102
- package/src/assets/data/users.csv +0 -5
- package/src/assets/i18n/en.json +0 -102
- package/src/assets/i18n/fr.json +0 -103
- package/src/demos/app-routing.module.ts +0 -108
- package/src/demos/app.component.html +0 -187
- package/src/demos/app.component.scss +0 -79
- package/src/demos/app.component.ts +0 -11
- package/src/demos/app.module.ts +0 -196
- package/src/demos/environments/environment.dev.ts +0 -3
- package/src/demos/environments/environment.prod.ts +0 -3
- package/src/demos/environments/environment.ts +0 -8
- package/src/demos/examples/custom-angularComponentEditor.ts +0 -187
- package/src/demos/examples/custom-angularComponentFilter.ts +0 -123
- package/src/demos/examples/custom-buttonFormatter.component.ts +0 -13
- package/src/demos/examples/custom-inputEditor.ts +0 -132
- package/src/demos/examples/custom-inputFilter.ts +0 -134
- package/src/demos/examples/custom-titleFormatter.component.ts +0 -9
- package/src/demos/examples/data/collection_100_numbers.json +0 -12
- package/src/demos/examples/data/collection_500_numbers.json +0 -52
- package/src/demos/examples/data/countries.json +0 -245
- package/src/demos/examples/data/country_names.json +0 -245
- package/src/demos/examples/data/customers_100.json +0 -102
- package/src/demos/examples/data/users.csv +0 -5
- package/src/demos/examples/editor-ng-select.component.ts +0 -38
- package/src/demos/examples/example01.component.html +0 -48
- package/src/demos/examples/example01.component.ts +0 -109
- package/src/demos/examples/example02.component.html +0 -45
- package/src/demos/examples/example02.component.ts +0 -218
- package/src/demos/examples/example03.component.html +0 -118
- package/src/demos/examples/example03.component.ts +0 -694
- package/src/demos/examples/example04.component.html +0 -87
- package/src/demos/examples/example04.component.ts +0 -326
- package/src/demos/examples/example05.component.html +0 -151
- package/src/demos/examples/example05.component.ts +0 -474
- package/src/demos/examples/example06.component.html +0 -163
- package/src/demos/examples/example06.component.ts +0 -446
- package/src/demos/examples/example07.component.html +0 -56
- package/src/demos/examples/example07.component.scss +0 -10
- package/src/demos/examples/example07.component.ts +0 -216
- package/src/demos/examples/example08.component.html +0 -51
- package/src/demos/examples/example08.component.scss +0 -23
- package/src/demos/examples/example08.component.ts +0 -195
- package/src/demos/examples/example09.component.html +0 -55
- package/src/demos/examples/example09.component.scss +0 -22
- package/src/demos/examples/example09.component.ts +0 -302
- package/src/demos/examples/example10.component.html +0 -103
- package/src/demos/examples/example10.component.ts +0 -309
- package/src/demos/examples/example11.component.html +0 -91
- package/src/demos/examples/example11.component.ts +0 -276
- package/src/demos/examples/example12.component.html +0 -98
- package/src/demos/examples/example12.component.ts +0 -317
- package/src/demos/examples/example13.component.html +0 -96
- package/src/demos/examples/example13.component.ts +0 -370
- package/src/demos/examples/example14.component.html +0 -50
- package/src/demos/examples/example14.component.scss +0 -11
- package/src/demos/examples/example14.component.ts +0 -156
- package/src/demos/examples/example15.component.html +0 -56
- package/src/demos/examples/example15.component.ts +0 -304
- package/src/demos/examples/example16.component.html +0 -77
- package/src/demos/examples/example16.component.ts +0 -277
- package/src/demos/examples/example17.component.html +0 -50
- package/src/demos/examples/example17.component.ts +0 -109
- package/src/demos/examples/example18.component.html +0 -132
- package/src/demos/examples/example18.component.ts +0 -445
- package/src/demos/examples/example19-rowdetail.component.html +0 -40
- package/src/demos/examples/example19-rowdetail.component.ts +0 -54
- package/src/demos/examples/example19.component.html +0 -79
- package/src/demos/examples/example19.component.ts +0 -316
- package/src/demos/examples/example20.component.html +0 -76
- package/src/demos/examples/example20.component.scss +0 -11
- package/src/demos/examples/example20.component.ts +0 -341
- package/src/demos/examples/example21.component.html +0 -86
- package/src/demos/examples/example21.component.scss +0 -16
- package/src/demos/examples/example21.component.ts +0 -140
- package/src/demos/examples/example22.component.html +0 -41
- package/src/demos/examples/example22.component.ts +0 -117
- package/src/demos/examples/example23.component.html +0 -111
- package/src/demos/examples/example23.component.ts +0 -323
- package/src/demos/examples/example24.component.html +0 -120
- package/src/demos/examples/example24.component.scss +0 -62
- package/src/demos/examples/example24.component.ts +0 -641
- package/src/demos/examples/example25.component.html +0 -60
- package/src/demos/examples/example25.component.scss +0 -8
- package/src/demos/examples/example25.component.ts +0 -255
- package/src/demos/examples/example26.component.html +0 -98
- package/src/demos/examples/example26.component.scss +0 -42
- package/src/demos/examples/example26.component.ts +0 -383
- package/src/demos/examples/example27.component.html +0 -138
- package/src/demos/examples/example27.component.scss +0 -10
- package/src/demos/examples/example27.component.ts +0 -369
- package/src/demos/examples/example28.component.html +0 -143
- package/src/demos/examples/example28.component.scss +0 -54
- package/src/demos/examples/example28.component.ts +0 -453
- package/src/demos/examples/example29.component.html +0 -30
- package/src/demos/examples/example29.component.ts +0 -70
- package/src/demos/examples/example30.component.html +0 -116
- package/src/demos/examples/example30.component.scss +0 -20
- package/src/demos/examples/example30.component.ts +0 -1070
- package/src/demos/examples/example32.component.html +0 -77
- package/src/demos/examples/example32.component.scss +0 -8
- package/src/demos/examples/example32.component.ts +0 -905
- package/src/demos/examples/example33.component.html +0 -50
- package/src/demos/examples/example33.component.scss +0 -46
- package/src/demos/examples/example33.component.ts +0 -571
- package/src/demos/examples/example34.component.html +0 -82
- package/src/demos/examples/example34.component.scss +0 -77
- package/src/demos/examples/example34.component.ts +0 -434
- package/src/demos/examples/example35.component.html +0 -77
- package/src/demos/examples/example35.component.scss +0 -18
- package/src/demos/examples/example35.component.ts +0 -264
- package/src/demos/examples/example36.component.html +0 -56
- package/src/demos/examples/example36.component.scss +0 -26
- package/src/demos/examples/example36.component.ts +0 -504
- package/src/demos/examples/example37.component.html +0 -30
- package/src/demos/examples/example37.component.ts +0 -123
- package/src/demos/examples/example38.component.html +0 -104
- package/src/demos/examples/example38.component.scss +0 -8
- package/src/demos/examples/example38.component.ts +0 -420
- package/src/demos/examples/example39.component.html +0 -112
- package/src/demos/examples/example39.component.scss +0 -8
- package/src/demos/examples/example39.component.ts +0 -371
- package/src/demos/examples/example40.component.html +0 -76
- package/src/demos/examples/example40.component.ts +0 -226
- package/src/demos/examples/example41.component.html +0 -50
- package/src/demos/examples/example41.component.scss +0 -42
- package/src/demos/examples/example41.component.ts +0 -229
- package/src/demos/examples/example42.component.html +0 -47
- package/src/demos/examples/example42.component.ts +0 -203
- package/src/demos/examples/example43.component.html +0 -94
- package/src/demos/examples/example43.component.scss +0 -30
- package/src/demos/examples/example43.component.ts +0 -449
- package/src/demos/examples/example44.component.html +0 -78
- package/src/demos/examples/example44.component.scss +0 -50
- package/src/demos/examples/example44.component.ts +0 -375
- package/src/demos/examples/example45-detail.component.html +0 -15
- package/src/demos/examples/example45-detail.component.ts +0 -97
- package/src/demos/examples/example45.component.html +0 -110
- package/src/demos/examples/example45.component.scss +0 -50
- package/src/demos/examples/example45.component.ts +0 -243
- package/src/demos/examples/filter-ng-select.component.ts +0 -33
- package/src/demos/examples/grid-custom-pager.component.html +0 -60
- package/src/demos/examples/grid-custom-pager.component.scss +0 -57
- package/src/demos/examples/grid-custom-pager.component.ts +0 -107
- package/src/demos/examples/grid-remote.component.html +0 -44
- package/src/demos/examples/grid-remote.component.ts +0 -164
- package/src/demos/examples/home.component.html +0 -39
- package/src/demos/examples/home.component.ts +0 -10
- package/src/demos/examples/jsonp.ts +0 -89
- package/src/demos/examples/rowdetail-preload.component.ts +0 -10
- package/src/demos/examples/swt-common-grid-pagination.component.ts +0 -160
- package/src/demos/examples/swt-common-grid-test.component.html +0 -37
- package/src/demos/examples/swt-common-grid-test.component.ts +0 -214
- package/src/demos/examples/swt-common-grid.component.ts +0 -436
- package/src/demos/examples/swt-logger.service.ts +0 -173
- package/src/demos/examples/utilities.ts +0 -9
- package/src/favicon.ico +0 -0
- package/src/index.html +0 -17
- package/src/library/components/__tests__/angular-slickgrid.component.spec.ts +0 -2638
- package/src/library/components/angular-slickgrid.component.html +0 -5
- package/src/library/components/angular-slickgrid.component.ts +0 -1662
- package/src/library/constants.ts +0 -105
- package/src/library/extensions/__tests__/slickRowDetailView.spec.ts +0 -751
- package/src/library/extensions/index.ts +0 -1
- package/src/library/extensions/slickRowDetailView.ts +0 -395
- package/src/library/global-grid-options.ts +0 -273
- package/src/library/index.ts +0 -11
- package/src/library/models/angularComponentOutput.interface.ts +0 -6
- package/src/library/models/angularGridInstance.interface.ts +0 -76
- package/src/library/models/externalTestingDependencies.interface.ts +0 -37
- package/src/library/models/gridOption.interface.ts +0 -15
- package/src/library/models/index.ts +0 -5
- package/src/library/models/rowDetailView.interface.ts +0 -16
- package/src/library/modules/angular-slickgrid.module.spec.ts +0 -25
- package/src/library/modules/angular-slickgrid.module.ts +0 -27
- package/src/library/services/__tests__/angularUtilService.spec.ts +0 -156
- package/src/library/services/__tests__/container.service.spec.ts +0 -25
- package/src/library/services/__tests__/translater.service.spec.ts +0 -43
- package/src/library/services/__tests__/utilities.spec.ts +0 -22
- package/src/library/services/angularUtil.service.ts +0 -120
- package/src/library/services/container.service.ts +0 -26
- package/src/library/services/index.ts +0 -4
- package/src/library/services/translater.service.ts +0 -38
- package/src/library/services/utilities.ts +0 -19
- package/src/library/slickgrid-config.ts +0 -10
- package/src/main.ts +0 -13
- package/src/public_api.ts +0 -1
- package/src/styles.scss +0 -178
- package/test/cypress/e2e/example01.cy.ts +0 -367
- package/test/cypress/e2e/example02.cy.ts +0 -60
- package/test/cypress/e2e/example03.cy.ts +0 -268
- package/test/cypress/e2e/example04.cy.ts +0 -254
- package/test/cypress/e2e/example05.cy.ts +0 -804
- package/test/cypress/e2e/example06.cy.ts +0 -890
- package/test/cypress/e2e/example07.cy.ts +0 -384
- package/test/cypress/e2e/example08.cy.ts +0 -190
- package/test/cypress/e2e/example09.cy.ts +0 -392
- package/test/cypress/e2e/example10.cy.ts +0 -650
- package/test/cypress/e2e/example11.cy.ts +0 -86
- package/test/cypress/e2e/example12.cy.ts +0 -269
- package/test/cypress/e2e/example13.cy.ts +0 -246
- package/test/cypress/e2e/example14.cy.ts +0 -122
- package/test/cypress/e2e/example15.cy.ts +0 -598
- package/test/cypress/e2e/example16.cy.ts +0 -427
- package/test/cypress/e2e/example17.cy.ts +0 -83
- package/test/cypress/e2e/example18.cy.ts +0 -431
- package/test/cypress/e2e/example19.cy.ts +0 -263
- package/test/cypress/e2e/example20.cy.ts +0 -264
- package/test/cypress/e2e/example21.cy.ts +0 -77
- package/test/cypress/e2e/example22.cy.ts +0 -94
- package/test/cypress/e2e/example23.cy.ts +0 -259
- package/test/cypress/e2e/example24.cy.ts +0 -707
- package/test/cypress/e2e/example25.cy.ts +0 -193
- package/test/cypress/e2e/example26.cy.ts +0 -111
- package/test/cypress/e2e/example27.cy.ts +0 -261
- package/test/cypress/e2e/example28.cy.ts +0 -740
- package/test/cypress/e2e/example29.cy.ts +0 -30
- package/test/cypress/e2e/example30.cy.ts +0 -757
- package/test/cypress/e2e/example31.cy.ts +0 -69
- package/test/cypress/e2e/example32.cy.ts +0 -272
- package/test/cypress/e2e/example33.cy.ts +0 -278
- package/test/cypress/e2e/example34.cy.ts +0 -84
- package/test/cypress/e2e/example35.cy.ts +0 -178
- package/test/cypress/e2e/example36.cy.ts +0 -219
- package/test/cypress/e2e/example37.cy.ts +0 -52
- package/test/cypress/e2e/example38.cy.ts +0 -160
- package/test/cypress/e2e/example39.cy.ts +0 -150
- package/test/cypress/e2e/example40.cy.ts +0 -126
- package/test/cypress/e2e/example41.cy.ts +0 -90
- package/test/cypress/e2e/example42.cy.ts +0 -82
- package/test/cypress/e2e/example43.cy.ts +0 -482
- package/test/cypress/e2e/example44.cy.ts +0 -458
- package/test/cypress/e2e/example45.cy.ts +0 -455
- package/test/cypress/e2e/home.cy.ts +0 -7
- package/test/cypress/fixtures/example.json +0 -5
- package/test/cypress/plugins/index.ts +0 -17
- package/test/cypress/plugins/utilities.ts +0 -28
- package/test/cypress/support/commands.ts +0 -88
- package/test/cypress/support/common.ts +0 -47
- package/test/cypress/support/drag.ts +0 -101
- package/test/cypress/support/index.ts +0 -20
- package/test/cypress/tsconfig.json +0 -9
- package/test/cypress.config.ts +0 -34
- package/test/mockSlickEvent.ts +0 -77
- package/test/rxjsResourceStub.ts +0 -69
- package/test/test-setup.ts +0 -6
- package/test/translateServiceStub.ts +0 -230
- package/test/translaterServiceStub.ts +0 -239
- package/test/tsconfig.json +0 -17
- package/test/vitest-global-mocks.ts +0 -41
- package/test/vitest-global-setup.ts +0 -3
- package/test/vitest-pretest.ts +0 -5
- package/tsconfig.app.json +0 -14
- package/tsconfig.json +0 -31
- package/tsconfig.spec.json +0 -11
- package/types/sortablejs.d.ts +0 -4
- package/vite.config.mts +0 -51
- /package/{dist/fesm2022 → fesm2022}/angular-slickgrid.mjs.map +0 -0
- /package/{dist/i18n → i18n}/en.json +0 -0
- /package/{dist/i18n → i18n}/fr.json +0 -0
- /package/{dist/index.d.ts → index.d.ts} +0 -0
- /package/{dist/library → library}/components/angular-slickgrid.component.d.ts +0 -0
- /package/{dist/library → library}/constants.d.ts +0 -0
- /package/{dist/library → library}/extensions/index.d.ts +0 -0
- /package/{dist/library → library}/extensions/slickRowDetailView.d.ts +0 -0
- /package/{dist/library → library}/global-grid-options.d.ts +0 -0
- /package/{dist/library → library}/index.d.ts +0 -0
- /package/{dist/library → library}/models/angularComponentOutput.interface.d.ts +0 -0
- /package/{dist/library → library}/models/angularGridInstance.interface.d.ts +0 -0
- /package/{dist/library → library}/models/externalTestingDependencies.interface.d.ts +0 -0
- /package/{dist/library → library}/models/gridOption.interface.d.ts +0 -0
- /package/{dist/library → library}/models/index.d.ts +0 -0
- /package/{dist/library → library}/models/rowDetailView.interface.d.ts +0 -0
- /package/{dist/library → library}/modules/angular-slickgrid.module.d.ts +0 -0
- /package/{dist/library → library}/services/angularUtil.service.d.ts +0 -0
- /package/{dist/library → library}/services/container.service.d.ts +0 -0
- /package/{dist/library → library}/services/index.d.ts +0 -0
- /package/{dist/library → library}/services/translater.service.d.ts +0 -0
- /package/{dist/library → library}/services/utilities.d.ts +0 -0
- /package/{dist/library → library}/slickgrid-config.d.ts +0 -0
- /package/{dist/public_api.d.ts → public_api.d.ts} +0 -0
|
@@ -1,751 +0,0 @@
|
|
|
1
|
-
import { ApplicationRef, Component } from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
Column,
|
|
4
|
-
OnSelectedRowsChangedEventArgs,
|
|
5
|
-
SlickEvent,
|
|
6
|
-
SlickEventData,
|
|
7
|
-
SlickEventHandler,
|
|
8
|
-
SlickGrid,
|
|
9
|
-
SlickRowSelectionModel,
|
|
10
|
-
} from '@slickgrid-universal/common';
|
|
11
|
-
import { EventPubSubService } from '@slickgrid-universal/event-pub-sub';
|
|
12
|
-
import { of } from 'rxjs';
|
|
13
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
14
|
-
|
|
15
|
-
import { GridOption } from '../../models/gridOption.interface.js';
|
|
16
|
-
import { AngularUtilService } from '../../services/index.js';
|
|
17
|
-
import { RowDetailView } from '../../models/rowDetailView.interface.js';
|
|
18
|
-
import { RxJsResourceStub } from '../../../../test/rxjsResourceStub.js';
|
|
19
|
-
import { SlickRowDetailView } from '../slickRowDetailView.js';
|
|
20
|
-
|
|
21
|
-
vi.mock('@slickgrid-universal/common', async () => ({
|
|
22
|
-
...((await vi.importActual('@slickgrid-universal/common')) as any),
|
|
23
|
-
SlickRowSelectionModel: vi.fn().mockImplementation(() => ({
|
|
24
|
-
constructor: vi.fn(),
|
|
25
|
-
init: vi.fn(),
|
|
26
|
-
destroy: vi.fn(),
|
|
27
|
-
dispose: vi.fn(),
|
|
28
|
-
getSelectedRows: vi.fn(),
|
|
29
|
-
setSelectedRows: vi.fn(),
|
|
30
|
-
getSelectedRanges: vi.fn(),
|
|
31
|
-
setSelectedRanges: vi.fn(),
|
|
32
|
-
onSelectedRangesChanged: new SlickEvent(),
|
|
33
|
-
})),
|
|
34
|
-
}));
|
|
35
|
-
|
|
36
|
-
vi.mock('@slickgrid-universal/row-detail-view-plugin', async () => ({
|
|
37
|
-
...((await vi.importActual('@slickgrid-universal/row-detail-view-plugin')) as any),
|
|
38
|
-
onAsyncResponse: new SlickEvent(),
|
|
39
|
-
onAsyncEndUpdate: new SlickEvent(),
|
|
40
|
-
onAfterRowDetailToggle: new SlickEvent(),
|
|
41
|
-
onBeforeRowDetailToggle: new SlickEvent(),
|
|
42
|
-
onRowOutOfViewportRange: new SlickEvent(),
|
|
43
|
-
onRowBackToViewportRange: new SlickEvent(),
|
|
44
|
-
}));
|
|
45
|
-
|
|
46
|
-
const ROW_DETAIL_CONTAINER_PREFIX = 'container_';
|
|
47
|
-
const PRELOAD_CONTAINER_PREFIX = 'container_loading';
|
|
48
|
-
|
|
49
|
-
const applicationRefStub = {
|
|
50
|
-
detachView: vi.fn(),
|
|
51
|
-
} as unknown as ApplicationRef;
|
|
52
|
-
|
|
53
|
-
const angularUtilServiceStub = {
|
|
54
|
-
createAngularComponent: vi.fn(),
|
|
55
|
-
createAngularComponentAppendToDom: vi.fn(),
|
|
56
|
-
} as unknown as AngularUtilService;
|
|
57
|
-
|
|
58
|
-
const gridOptionsMock = {
|
|
59
|
-
enableRowDetailView: true,
|
|
60
|
-
rowDetailView: {
|
|
61
|
-
cssClass: 'detail-view-toggle',
|
|
62
|
-
panelRows: 1,
|
|
63
|
-
keyPrefix: '__',
|
|
64
|
-
useRowClick: true,
|
|
65
|
-
saveDetailViewOnScroll: false,
|
|
66
|
-
process: () => new Promise((resolve) => resolve('process resolved')),
|
|
67
|
-
viewComponent: null as any,
|
|
68
|
-
onExtensionRegistered: vi.fn(),
|
|
69
|
-
onAsyncResponse: () => {},
|
|
70
|
-
onAsyncEndUpdate: () => {},
|
|
71
|
-
onAfterRowDetailToggle: () => {},
|
|
72
|
-
onBeforeRowDetailToggle: () => {},
|
|
73
|
-
onRowOutOfViewportRange: () => {},
|
|
74
|
-
onRowBackToViewportRange: () => {},
|
|
75
|
-
},
|
|
76
|
-
} as unknown as GridOption;
|
|
77
|
-
|
|
78
|
-
const dataViewStub = {
|
|
79
|
-
constructor: vi.fn(),
|
|
80
|
-
init: vi.fn(),
|
|
81
|
-
destroy: vi.fn(),
|
|
82
|
-
beginUpdate: vi.fn(),
|
|
83
|
-
endUpdate: vi.fn(),
|
|
84
|
-
getItem: vi.fn(),
|
|
85
|
-
getItems: vi.fn(),
|
|
86
|
-
getItemCount: vi.fn(),
|
|
87
|
-
onRowCountChanged: new SlickEvent(),
|
|
88
|
-
onRowsChanged: new SlickEvent(),
|
|
89
|
-
onSetItemsCalled: new SlickEvent(),
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
const gridStub = {
|
|
93
|
-
getData: () => dataViewStub,
|
|
94
|
-
getUID: vi.fn(),
|
|
95
|
-
getOptions: () => gridOptionsMock,
|
|
96
|
-
getSelectionModel: vi.fn(),
|
|
97
|
-
setSelectionModel: vi.fn(),
|
|
98
|
-
sanitizeHtmlString: (s: string) => s,
|
|
99
|
-
onColumnsReordered: new SlickEvent(),
|
|
100
|
-
onSelectedRowsChanged: new SlickEvent(),
|
|
101
|
-
onBeforeEditCell: new SlickEvent(),
|
|
102
|
-
onBeforeRemoveCachedRow: new SlickEvent(),
|
|
103
|
-
onClick: new SlickEvent(),
|
|
104
|
-
onScroll: new SlickEvent(),
|
|
105
|
-
onSort: new SlickEvent(),
|
|
106
|
-
} as unknown as SlickGrid;
|
|
107
|
-
|
|
108
|
-
@Component({ template: `<h4>Loading...</h4>`, standalone: false })
|
|
109
|
-
class TestPreloadComponent {}
|
|
110
|
-
|
|
111
|
-
@Component({ template: `<h1>Some Title</h1>` })
|
|
112
|
-
class TestComponent {}
|
|
113
|
-
|
|
114
|
-
describe('SlickRowDetailView', () => {
|
|
115
|
-
let eventHandler: SlickEventHandler;
|
|
116
|
-
let plugin: SlickRowDetailView;
|
|
117
|
-
let eventPubSubService: EventPubSubService;
|
|
118
|
-
let rxjsResourceStub: RxJsResourceStub;
|
|
119
|
-
const div = document.createElement('div');
|
|
120
|
-
div.innerHTML = `<div class="container_loading"></div><div class="container_field1"></div>`;
|
|
121
|
-
document.body.appendChild(div);
|
|
122
|
-
|
|
123
|
-
beforeEach(async () => {
|
|
124
|
-
eventHandler = new SlickEventHandler();
|
|
125
|
-
eventPubSubService = new EventPubSubService(div);
|
|
126
|
-
rxjsResourceStub = new RxJsResourceStub();
|
|
127
|
-
|
|
128
|
-
plugin = new SlickRowDetailView(angularUtilServiceStub, applicationRefStub, eventPubSubService, document.body as HTMLDivElement, rxjsResourceStub);
|
|
129
|
-
vi.spyOn(plugin, 'eventHandler', 'get').mockReturnValue(eventHandler);
|
|
130
|
-
vi.spyOn(plugin, 'getOptions').mockReturnValue(gridOptionsMock.rowDetailView as RowDetailView);
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
afterEach(() => {
|
|
134
|
-
eventHandler.unsubscribeAll();
|
|
135
|
-
vi.clearAllMocks();
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
it('should create the RowDetailView plugin', () => {
|
|
139
|
-
expect(plugin).toBeTruthy();
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
it('should expect "getOptions" to be called when calling addonOptions GETTER', () => {
|
|
143
|
-
const getOptionSpy = vi.spyOn(plugin, 'getOptions').mockReturnValue({ cssClass: 'some-class' } as any);
|
|
144
|
-
|
|
145
|
-
const options = plugin.addonOptions;
|
|
146
|
-
|
|
147
|
-
expect(options).toEqual({ cssClass: 'some-class' });
|
|
148
|
-
expect(getOptionSpy).toHaveBeenCalled();
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
describe('registered plugin', () => {
|
|
152
|
-
beforeEach(() => {
|
|
153
|
-
gridOptionsMock.datasetIdPropertyName = 'id';
|
|
154
|
-
vi.spyOn(gridStub, 'getOptions').mockReturnValue(gridOptionsMock);
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
afterEach(() => {
|
|
158
|
-
vi.clearAllMocks();
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
it('should run the "process" method when defined', async () => {
|
|
162
|
-
gridOptionsMock.rowDetailView!.process = () => new Promise((resolve) => resolve('process resolved'));
|
|
163
|
-
const output = await gridOptionsMock.rowDetailView!.process({ id: 'field1', field: 'field1' });
|
|
164
|
-
expect(output).toBe('process resolved');
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
it('should use "addRxJsResource" method and run the "process" method when defined', async () => {
|
|
168
|
-
plugin.addRxJsResource(rxjsResourceStub);
|
|
169
|
-
(gridOptionsMock.rowDetailView as RowDetailView).process = () => new Promise((resolve) => resolve('process resolved'));
|
|
170
|
-
const output = await (gridOptionsMock.rowDetailView as RowDetailView).process({ id: 'field1', field: 'field1' });
|
|
171
|
-
expect(output).toBe('process resolved');
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
it('should provide a sanitized "preTemplate" when only a "preloadComponent" is provided (meaning no "preTemplate" is originally provided)', async () => {
|
|
175
|
-
(gridOptionsMock.rowDetailView as RowDetailView).preloadComponent = TestPreloadComponent;
|
|
176
|
-
vi.spyOn(gridStub, 'getOptions').mockReturnValue(gridOptionsMock);
|
|
177
|
-
|
|
178
|
-
plugin.init(gridStub);
|
|
179
|
-
const output = (await (gridOptionsMock.rowDetailView as RowDetailView).preTemplate!()) as HTMLElement;
|
|
180
|
-
|
|
181
|
-
expect(output.outerHTML).toEqual(`<div class="${PRELOAD_CONTAINER_PREFIX}"></div>`);
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
it('should provide a sanitized "postTemplate" when only a "viewComponent" is provided (meaning no "postTemplate" is originally provided)', async () => {
|
|
185
|
-
(gridOptionsMock.rowDetailView as RowDetailView).viewComponent = TestComponent;
|
|
186
|
-
vi.spyOn(gridStub, 'getOptions').mockReturnValue(gridOptionsMock);
|
|
187
|
-
|
|
188
|
-
const output = (await gridOptionsMock.rowDetailView!.postTemplate!({ id: 'field1', field: 'field1' })) as HTMLElement;
|
|
189
|
-
expect(output.outerHTML).toEqual(`<div class="${ROW_DETAIL_CONTAINER_PREFIX}field1"></div>`);
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
it('should define "datasetIdPropertyName" with different "id" and provide a sanitized "postTemplate" when only a "viewComponent" is provided (meaning no "postTemplate" is originally provided)', async () => {
|
|
193
|
-
(gridOptionsMock.rowDetailView as RowDetailView).viewComponent = TestComponent;
|
|
194
|
-
gridOptionsMock.datasetIdPropertyName = 'rowId';
|
|
195
|
-
const output = (await gridOptionsMock.rowDetailView!.postTemplate!({ rowId: 'field1', field: 'field1' })) as HTMLElement;
|
|
196
|
-
expect(output.outerHTML).toEqual(`<div class="${ROW_DETAIL_CONTAINER_PREFIX}field1"></div>`);
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
describe('registered addon', () => {
|
|
200
|
-
let columnsMock: Column[];
|
|
201
|
-
|
|
202
|
-
beforeEach(() => {
|
|
203
|
-
gridOptionsMock.datasetIdPropertyName = 'id';
|
|
204
|
-
gridOptionsMock.rowDetailView!.preTemplate = null as any;
|
|
205
|
-
gridOptionsMock.rowDetailView!.postTemplate = null as any;
|
|
206
|
-
gridOptionsMock.rowDetailView!.preloadComponent = TestPreloadComponent;
|
|
207
|
-
gridOptionsMock.rowDetailView!.viewComponent = TestComponent;
|
|
208
|
-
columnsMock = [{ id: 'field1', field: 'field1', width: 100, cssClass: 'red' }];
|
|
209
|
-
vi.spyOn(gridStub, 'getOptions').mockReturnValue(gridOptionsMock);
|
|
210
|
-
vi.clearAllMocks();
|
|
211
|
-
gridStub.onColumnsReordered = new SlickEvent();
|
|
212
|
-
gridStub.onSort = new SlickEvent();
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
afterEach(() => {
|
|
216
|
-
plugin?.eventHandler?.unsubscribeAll();
|
|
217
|
-
plugin?.dispose();
|
|
218
|
-
vi.clearAllMocks();
|
|
219
|
-
(plugin.onAsyncResponse as any) = null;
|
|
220
|
-
(plugin.onAsyncEndUpdate as any) = null;
|
|
221
|
-
(plugin.onAfterRowDetailToggle as any) = null;
|
|
222
|
-
(plugin.onBeforeRowDetailToggle as any) = null;
|
|
223
|
-
(plugin.onRowBackToViewportRange as any) = null;
|
|
224
|
-
(plugin.onRowOutOfViewportRange as any) = null;
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
it('should register the addon', () => {
|
|
228
|
-
const copyGridOptionsMock = { ...gridOptionsMock };
|
|
229
|
-
gridOptionsMock.rowDetailView!.onExtensionRegistered = vi.fn();
|
|
230
|
-
vi.spyOn(gridStub, 'getOptions').mockReturnValue(copyGridOptionsMock);
|
|
231
|
-
const onRegisteredSpy = vi.spyOn(copyGridOptionsMock.rowDetailView!, 'onExtensionRegistered');
|
|
232
|
-
|
|
233
|
-
plugin.init(gridStub);
|
|
234
|
-
const instance = plugin.register();
|
|
235
|
-
const addonInstance = plugin.getAddonInstance();
|
|
236
|
-
|
|
237
|
-
expect(instance).toBeTruthy();
|
|
238
|
-
expect(instance).toEqual(addonInstance);
|
|
239
|
-
expect(onRegisteredSpy).toHaveBeenCalledWith(instance);
|
|
240
|
-
expect(SlickRowSelectionModel).toHaveBeenCalledWith({ selectActiveRow: true });
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
it('should call internal event handler subscribe and expect the "onAsyncResponse" option to be called when addon notify is called', () => {
|
|
244
|
-
const onAsyncRespSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onAsyncResponse');
|
|
245
|
-
const onAsyncEndSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onAsyncEndUpdate');
|
|
246
|
-
const onAfterRowSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onAfterRowDetailToggle');
|
|
247
|
-
const onBeforeRowSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onBeforeRowDetailToggle');
|
|
248
|
-
const onRowOutViewSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onRowOutOfViewportRange');
|
|
249
|
-
const onRowBackViewSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onRowBackToViewportRange');
|
|
250
|
-
|
|
251
|
-
plugin.init(gridStub);
|
|
252
|
-
plugin.onAsyncResponse = new SlickEvent();
|
|
253
|
-
plugin.register();
|
|
254
|
-
|
|
255
|
-
plugin.onAsyncResponse.notify({ item: columnsMock[0], detailView: {} }, new SlickEventData(), gridStub);
|
|
256
|
-
|
|
257
|
-
expect(onAsyncRespSpy).toHaveBeenCalledWith(expect.anything(), { item: columnsMock[0], detailView: {} });
|
|
258
|
-
expect(onAsyncEndSpy).not.toHaveBeenCalled();
|
|
259
|
-
expect(onAfterRowSpy).not.toHaveBeenCalled();
|
|
260
|
-
expect(onBeforeRowSpy).not.toHaveBeenCalled();
|
|
261
|
-
expect(onRowOutViewSpy).not.toHaveBeenCalled();
|
|
262
|
-
expect(onRowBackViewSpy).not.toHaveBeenCalled();
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
it('should call internal event handler subscribe and expect the "onAsyncEndUpdate" option to be called when addon notify is called', () =>
|
|
266
|
-
new Promise((done: any) => {
|
|
267
|
-
// const handlerSpy = vi.spyOn(plugin.eventHandler, 'subscribe');
|
|
268
|
-
const renderSpy = vi.spyOn(plugin, 'renderViewModel');
|
|
269
|
-
|
|
270
|
-
const onAsyncRespSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onAsyncResponse');
|
|
271
|
-
const onAsyncEndSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onAsyncEndUpdate');
|
|
272
|
-
const onAfterRowSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onAfterRowDetailToggle');
|
|
273
|
-
const onBeforeRowSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onBeforeRowDetailToggle');
|
|
274
|
-
const onRowOutViewSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onRowOutOfViewportRange');
|
|
275
|
-
const onRowBackViewSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onRowBackToViewportRange');
|
|
276
|
-
|
|
277
|
-
plugin.init(gridStub);
|
|
278
|
-
plugin.onAsyncEndUpdate = new SlickEvent();
|
|
279
|
-
plugin.register();
|
|
280
|
-
plugin.onAsyncEndUpdate.notify({ item: columnsMock[0], grid: gridStub }, new SlickEventData(), gridStub);
|
|
281
|
-
|
|
282
|
-
// expect(handlerSpy).toHaveBeenCalledTimes(8); // there are an extra 2x on the grid itself
|
|
283
|
-
// expect(handlerSpy).toHaveBeenCalledWith(
|
|
284
|
-
// { notify: expect.anything(), subscribe: expect.anything(), unsubscribe: expect.anything(), },
|
|
285
|
-
// expect.anything()
|
|
286
|
-
// );
|
|
287
|
-
setTimeout(() => {
|
|
288
|
-
expect(onAsyncRespSpy).not.toHaveBeenCalled();
|
|
289
|
-
expect(onAsyncEndSpy).toHaveBeenCalledWith(expect.anything(), { item: columnsMock[0], grid: gridStub });
|
|
290
|
-
expect(renderSpy).toHaveBeenCalledWith({ cssClass: 'red', field: 'field1', id: 'field1', width: 100 });
|
|
291
|
-
expect(onAfterRowSpy).not.toHaveBeenCalled();
|
|
292
|
-
expect(onBeforeRowSpy).not.toHaveBeenCalled();
|
|
293
|
-
expect(onRowOutViewSpy).not.toHaveBeenCalled();
|
|
294
|
-
expect(onRowBackViewSpy).not.toHaveBeenCalled();
|
|
295
|
-
done();
|
|
296
|
-
});
|
|
297
|
-
}));
|
|
298
|
-
|
|
299
|
-
it('should call internal event handler subscribe and expect the "onAfterRowDetailToggle" option to be called when addon notify is called', () => {
|
|
300
|
-
// const handlerSpy = vi.spyOn(plugin.eventHandler, 'subscribe');
|
|
301
|
-
const onAsyncRespSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onAsyncResponse');
|
|
302
|
-
const onAsyncEndSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onAsyncEndUpdate');
|
|
303
|
-
const onAfterRowSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onAfterRowDetailToggle');
|
|
304
|
-
const onBeforeRowSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onBeforeRowDetailToggle');
|
|
305
|
-
const onRowOutViewSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onRowOutOfViewportRange');
|
|
306
|
-
const onRowBackViewSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onRowBackToViewportRange');
|
|
307
|
-
const appendSpy = vi.spyOn(angularUtilServiceStub, 'createAngularComponentAppendToDom').mockReturnValue({ componentRef: { instance: vi.fn() } } as any);
|
|
308
|
-
|
|
309
|
-
plugin.init(gridStub);
|
|
310
|
-
plugin.onAfterRowDetailToggle = new SlickEvent();
|
|
311
|
-
plugin.register();
|
|
312
|
-
plugin.onAfterRowDetailToggle.notify({ item: columnsMock[0], expandedRows: [0], grid: gridStub }, new SlickEventData(), gridStub);
|
|
313
|
-
|
|
314
|
-
// expect(handlerSpy).toHaveBeenCalledTimes(8); // there are an extra 2x on the grid itself
|
|
315
|
-
// expect(handlerSpy).toHaveBeenCalledWith(
|
|
316
|
-
// { notify: expect.anything(), subscribe: expect.anything(), unsubscribe: expect.anything(), },
|
|
317
|
-
// expect.anything()
|
|
318
|
-
// );
|
|
319
|
-
expect(appendSpy).toHaveBeenCalled();
|
|
320
|
-
expect(onAsyncRespSpy).not.toHaveBeenCalled();
|
|
321
|
-
expect(onAsyncEndSpy).not.toHaveBeenCalled();
|
|
322
|
-
expect(onAfterRowSpy).toHaveBeenCalledWith(expect.anything(), { item: columnsMock[0], expandedRows: [0], grid: gridStub });
|
|
323
|
-
expect(onBeforeRowSpy).not.toHaveBeenCalled();
|
|
324
|
-
expect(onRowOutViewSpy).not.toHaveBeenCalled();
|
|
325
|
-
expect(onRowBackViewSpy).not.toHaveBeenCalled();
|
|
326
|
-
});
|
|
327
|
-
|
|
328
|
-
it('should call internal event handler subscribe and expect the "onBeforeRowDetailToggle" option to be called when addon notify is called', () => {
|
|
329
|
-
// const handlerSpy = vi.spyOn(plugin.eventHandler, 'subscribe');
|
|
330
|
-
const onAsyncRespSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onAsyncResponse');
|
|
331
|
-
const onAsyncEndSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onAsyncEndUpdate');
|
|
332
|
-
const onAfterRowSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onAfterRowDetailToggle');
|
|
333
|
-
const onBeforeRowSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onBeforeRowDetailToggle');
|
|
334
|
-
const onRowOutViewSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onRowOutOfViewportRange');
|
|
335
|
-
const onRowBackViewSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onRowBackToViewportRange');
|
|
336
|
-
|
|
337
|
-
plugin.init(gridStub);
|
|
338
|
-
plugin.onBeforeRowDetailToggle = new SlickEvent();
|
|
339
|
-
plugin.register();
|
|
340
|
-
plugin.onBeforeRowDetailToggle.notify({ item: columnsMock[0], grid: gridStub }, new SlickEventData(), gridStub);
|
|
341
|
-
|
|
342
|
-
expect(onAsyncRespSpy).not.toHaveBeenCalled();
|
|
343
|
-
expect(onAsyncEndSpy).not.toHaveBeenCalled();
|
|
344
|
-
expect(onAfterRowSpy).not.toHaveBeenCalled();
|
|
345
|
-
expect(onBeforeRowSpy).toHaveBeenCalledWith(expect.anything(), { item: columnsMock[0], grid: gridStub });
|
|
346
|
-
expect(onRowOutViewSpy).not.toHaveBeenCalled();
|
|
347
|
-
expect(onRowBackViewSpy).not.toHaveBeenCalled();
|
|
348
|
-
});
|
|
349
|
-
|
|
350
|
-
it('should call internal event handler subscribe and expect the "onRowOutOfViewportRange" option to be called when addon notify is called', () => {
|
|
351
|
-
// const handlerSpy = vi.spyOn(plugin.eventHandler, 'subscribe');
|
|
352
|
-
const onAsyncRespSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onAsyncResponse');
|
|
353
|
-
const onAsyncEndSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onAsyncEndUpdate');
|
|
354
|
-
const onAfterRowSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onAfterRowDetailToggle');
|
|
355
|
-
const onBeforeRowSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onBeforeRowDetailToggle');
|
|
356
|
-
const onRowOutViewSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onRowOutOfViewportRange');
|
|
357
|
-
const onRowBackViewSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onRowBackToViewportRange');
|
|
358
|
-
|
|
359
|
-
plugin.init(gridStub);
|
|
360
|
-
plugin.onRowOutOfViewportRange = new SlickEvent();
|
|
361
|
-
plugin.register();
|
|
362
|
-
plugin.onRowOutOfViewportRange.notify(
|
|
363
|
-
{ item: columnsMock[0], rowId: 0, rowIndex: 0, expandedRows: [0], rowIdsOutOfViewport: [], grid: gridStub },
|
|
364
|
-
new SlickEventData(),
|
|
365
|
-
gridStub
|
|
366
|
-
);
|
|
367
|
-
|
|
368
|
-
// expect(handlerSpy).toHaveBeenCalledTimes(8); // there are an extra 2x on the grid itself
|
|
369
|
-
// expect(handlerSpy).toHaveBeenCalledWith(
|
|
370
|
-
// { notify: expect.anything(), subscribe: expect.anything(), unsubscribe: expect.anything(), },
|
|
371
|
-
// expect.anything()
|
|
372
|
-
// );
|
|
373
|
-
expect(onAsyncRespSpy).not.toHaveBeenCalled();
|
|
374
|
-
expect(onAsyncEndSpy).not.toHaveBeenCalled();
|
|
375
|
-
expect(onAfterRowSpy).not.toHaveBeenCalled();
|
|
376
|
-
expect(onBeforeRowSpy).not.toHaveBeenCalled();
|
|
377
|
-
expect(onRowOutViewSpy).toHaveBeenCalledWith(expect.anything(), {
|
|
378
|
-
item: columnsMock[0],
|
|
379
|
-
rowId: 0,
|
|
380
|
-
rowIndex: 0,
|
|
381
|
-
expandedRows: [0],
|
|
382
|
-
rowIdsOutOfViewport: [],
|
|
383
|
-
grid: gridStub,
|
|
384
|
-
});
|
|
385
|
-
expect(onRowBackViewSpy).not.toHaveBeenCalled();
|
|
386
|
-
});
|
|
387
|
-
|
|
388
|
-
it('should call internal event handler subscribe and expect the "onRowBackToViewportRange" option to be called when addon notify is called', () => {
|
|
389
|
-
// const handlerSpy = vi.spyOn(plugin.eventHandler, 'subscribe');
|
|
390
|
-
const onAsyncRespSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onAsyncResponse');
|
|
391
|
-
const onAsyncEndSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onAsyncEndUpdate');
|
|
392
|
-
const onAfterRowSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onAfterRowDetailToggle');
|
|
393
|
-
const onBeforeRowSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onBeforeRowDetailToggle');
|
|
394
|
-
const onRowOutViewSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onRowOutOfViewportRange');
|
|
395
|
-
const onRowBackViewSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onRowBackToViewportRange');
|
|
396
|
-
|
|
397
|
-
plugin.init(gridStub);
|
|
398
|
-
plugin.onRowBackToViewportRange = new SlickEvent();
|
|
399
|
-
plugin.register();
|
|
400
|
-
plugin.onRowBackToViewportRange.notify(
|
|
401
|
-
{ item: columnsMock[0], rowId: 0, rowIndex: 0, expandedRows: [columnsMock[0] as any], rowIdsOutOfViewport: [], grid: gridStub },
|
|
402
|
-
new SlickEventData(),
|
|
403
|
-
gridStub
|
|
404
|
-
);
|
|
405
|
-
|
|
406
|
-
// expect(handlerSpy).toHaveBeenCalledTimes(8); // there are an extra 2x on the grid itself
|
|
407
|
-
// expect(handlerSpy).toHaveBeenCalledWith(
|
|
408
|
-
// { notify: expect.anything(), subscribe: expect.anything(), unsubscribe: expect.anything(), },
|
|
409
|
-
// expect.anything()
|
|
410
|
-
// );
|
|
411
|
-
expect(onAsyncRespSpy).not.toHaveBeenCalled();
|
|
412
|
-
expect(onAsyncEndSpy).not.toHaveBeenCalled();
|
|
413
|
-
expect(onAfterRowSpy).not.toHaveBeenCalled();
|
|
414
|
-
expect(onBeforeRowSpy).not.toHaveBeenCalled();
|
|
415
|
-
expect(onRowOutViewSpy).not.toHaveBeenCalled();
|
|
416
|
-
expect(onRowBackViewSpy).toHaveBeenCalledWith(expect.anything(), {
|
|
417
|
-
item: columnsMock[0],
|
|
418
|
-
rowId: 0,
|
|
419
|
-
rowIndex: 0,
|
|
420
|
-
expandedRows: [columnsMock[0] as any],
|
|
421
|
-
rowIdsOutOfViewport: [],
|
|
422
|
-
grid: gridStub,
|
|
423
|
-
});
|
|
424
|
-
});
|
|
425
|
-
|
|
426
|
-
it('should call Angular Util "createAngularComponentAppendToDom" when grid "onColumnsReordered" is triggered', () =>
|
|
427
|
-
new Promise((done: any) => {
|
|
428
|
-
const mockColumn = { id: 'field1', field: 'field1', width: 100, cssClass: 'red', __collapsed: true };
|
|
429
|
-
const handlerSpy = vi.spyOn(plugin.eventHandler, 'subscribe');
|
|
430
|
-
const appendSpy = vi
|
|
431
|
-
.spyOn(angularUtilServiceStub, 'createAngularComponentAppendToDom')
|
|
432
|
-
.mockReturnValue({ componentRef: { instance: vi.fn(), destroy: vi.fn() } } as any);
|
|
433
|
-
|
|
434
|
-
plugin.init(gridStub);
|
|
435
|
-
plugin.onBeforeRowDetailToggle = new SlickEvent();
|
|
436
|
-
plugin.register();
|
|
437
|
-
plugin.eventHandler.subscribe(plugin.onBeforeRowDetailToggle, () => {
|
|
438
|
-
gridStub.onColumnsReordered.notify({ impactedColumns: [mockColumn] } as any, new SlickEventData(), gridStub);
|
|
439
|
-
expect(appendSpy).toHaveBeenCalledWith(
|
|
440
|
-
TestComponent,
|
|
441
|
-
expect.objectContaining({ className: 'container_field1' }),
|
|
442
|
-
{
|
|
443
|
-
model: mockColumn,
|
|
444
|
-
addon: expect.anything(),
|
|
445
|
-
grid: gridStub,
|
|
446
|
-
dataView: dataViewStub,
|
|
447
|
-
parentRef: undefined,
|
|
448
|
-
},
|
|
449
|
-
{ sanitizer: expect.any(Function) }
|
|
450
|
-
);
|
|
451
|
-
done();
|
|
452
|
-
});
|
|
453
|
-
plugin.onBeforeRowDetailToggle.notify({ item: mockColumn, grid: gridStub }, new SlickEventData(), gridStub);
|
|
454
|
-
|
|
455
|
-
expect(handlerSpy).toHaveBeenCalled();
|
|
456
|
-
}));
|
|
457
|
-
|
|
458
|
-
it('should call "redrawAllViewComponents" when using Row Selection and the event "onSelectedRowsChanged" is triggered', () => {
|
|
459
|
-
const mockColumn = { id: 'field1', field: 'field1', width: 100, cssClass: 'red', __collapsed: true };
|
|
460
|
-
gridOptionsMock.enableCheckboxSelector = true;
|
|
461
|
-
const handlerSpy = vi.spyOn(plugin.eventHandler, 'subscribe');
|
|
462
|
-
const appendSpy = vi
|
|
463
|
-
.spyOn(angularUtilServiceStub, 'createAngularComponentAppendToDom')
|
|
464
|
-
.mockReturnValue({ componentRef: { instance: vi.fn(), destroy: vi.fn() } } as any);
|
|
465
|
-
|
|
466
|
-
plugin.init(gridStub);
|
|
467
|
-
const redrawSpy = vi.spyOn(plugin, 'redrawAllViewComponents');
|
|
468
|
-
plugin.onBeforeRowDetailToggle = new SlickEvent();
|
|
469
|
-
plugin.register();
|
|
470
|
-
plugin.eventHandler.subscribe(plugin.onBeforeRowDetailToggle, () => {
|
|
471
|
-
gridStub.onSelectedRowsChanged.notify(
|
|
472
|
-
{ rows: [0], previousSelectedRows: [], grid: gridStub } as unknown as OnSelectedRowsChangedEventArgs,
|
|
473
|
-
new SlickEventData(),
|
|
474
|
-
gridStub
|
|
475
|
-
);
|
|
476
|
-
expect(appendSpy).toHaveBeenCalledWith(
|
|
477
|
-
TestComponent,
|
|
478
|
-
expect.objectContaining({ className: 'container_field1' }),
|
|
479
|
-
{
|
|
480
|
-
model: mockColumn,
|
|
481
|
-
addon: expect.anything(),
|
|
482
|
-
grid: gridStub,
|
|
483
|
-
dataView: dataViewStub,
|
|
484
|
-
parentRef: undefined,
|
|
485
|
-
},
|
|
486
|
-
{ sanitizer: expect.any(Function) }
|
|
487
|
-
);
|
|
488
|
-
});
|
|
489
|
-
plugin.onBeforeRowDetailToggle.notify({ item: mockColumn, grid: gridStub }, new SlickEventData(), gridStub);
|
|
490
|
-
plugin.onBeforeRowDetailToggle.notify({ item: { ...mockColumn, __collapsed: false }, grid: gridStub }, new SlickEventData(), gridStub);
|
|
491
|
-
|
|
492
|
-
expect(handlerSpy).toHaveBeenCalled();
|
|
493
|
-
expect(redrawSpy).toHaveBeenCalledTimes(2);
|
|
494
|
-
});
|
|
495
|
-
|
|
496
|
-
for (const eventName of ['onFilterChanged', 'onGridMenuColumnsChanged', 'onColumnPickerColumnsChanged']) {
|
|
497
|
-
it(`should call "redrawAllViewComponents" when event ${eventName} is triggered`, () => {
|
|
498
|
-
const mockColumn = { id: 'field1', field: 'field1', width: 100, cssClass: 'red', __collapsed: true };
|
|
499
|
-
const handlerSpy = vi.spyOn(plugin.eventHandler, 'subscribe');
|
|
500
|
-
const appendSpy = vi
|
|
501
|
-
.spyOn(angularUtilServiceStub, 'createAngularComponentAppendToDom')
|
|
502
|
-
.mockReturnValue({ componentRef: { instance: vi.fn(), destroy: vi.fn() } } as any);
|
|
503
|
-
|
|
504
|
-
plugin.init(gridStub);
|
|
505
|
-
const redrawSpy = vi.spyOn(plugin, 'redrawAllViewComponents');
|
|
506
|
-
plugin.onBeforeRowDetailToggle = new SlickEvent();
|
|
507
|
-
plugin.register();
|
|
508
|
-
|
|
509
|
-
plugin.eventHandler.subscribe(plugin.onBeforeRowDetailToggle, () => {
|
|
510
|
-
eventPubSubService.publish(eventName, { columnId: 'field1', operator: '=', searchTerms: [] });
|
|
511
|
-
expect(appendSpy).toHaveBeenCalledWith(
|
|
512
|
-
TestComponent,
|
|
513
|
-
expect.objectContaining({ className: 'container_field1' }),
|
|
514
|
-
{
|
|
515
|
-
model: mockColumn,
|
|
516
|
-
addon: expect.anything(),
|
|
517
|
-
grid: gridStub,
|
|
518
|
-
dataView: dataViewStub,
|
|
519
|
-
parentRef: undefined,
|
|
520
|
-
},
|
|
521
|
-
{ sanitizer: expect.any(Function) }
|
|
522
|
-
);
|
|
523
|
-
});
|
|
524
|
-
plugin.onBeforeRowDetailToggle.notify({ item: mockColumn, grid: gridStub }, new SlickEventData(), gridStub);
|
|
525
|
-
plugin.onBeforeRowDetailToggle.notify({ item: { ...mockColumn, __collapsed: false }, grid: gridStub }, new SlickEventData(), gridStub);
|
|
526
|
-
|
|
527
|
-
expect(handlerSpy).toHaveBeenCalled();
|
|
528
|
-
expect(redrawSpy).toHaveBeenCalledTimes(2);
|
|
529
|
-
});
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
it('should call "redrawAllViewComponents" when event "onGridMenuClearAllFilters" is triggered', () =>
|
|
533
|
-
new Promise((done: any) => {
|
|
534
|
-
const mockColumn = { id: 'field1', field: 'field1', width: 100, cssClass: 'red', __collapsed: true };
|
|
535
|
-
const handlerSpy = vi.spyOn(plugin.eventHandler, 'subscribe');
|
|
536
|
-
|
|
537
|
-
plugin.init(gridStub);
|
|
538
|
-
const redrawSpy = vi.spyOn(plugin, 'redrawAllViewComponents');
|
|
539
|
-
plugin.onBeforeRowDetailToggle = new SlickEvent();
|
|
540
|
-
plugin.register();
|
|
541
|
-
|
|
542
|
-
plugin.eventHandler.subscribe(plugin.onBeforeRowDetailToggle, () => {
|
|
543
|
-
eventPubSubService.publish('onGridMenuClearAllFilters', { columnId: 'field1', operator: '=', searchTerms: [] });
|
|
544
|
-
});
|
|
545
|
-
plugin.onBeforeRowDetailToggle.notify({ item: mockColumn, grid: gridStub }, new SlickEventData(), gridStub);
|
|
546
|
-
plugin.onBeforeRowDetailToggle.notify({ item: { ...mockColumn, __collapsed: false }, grid: gridStub }, new SlickEventData(), gridStub);
|
|
547
|
-
|
|
548
|
-
expect(handlerSpy).toHaveBeenCalled();
|
|
549
|
-
setTimeout(() => {
|
|
550
|
-
expect(redrawSpy).toHaveBeenCalledTimes(4);
|
|
551
|
-
done();
|
|
552
|
-
});
|
|
553
|
-
}));
|
|
554
|
-
|
|
555
|
-
it('should call "redrawAllViewComponents" when event "onGridMenuClearAllSorting" is triggered', () =>
|
|
556
|
-
new Promise((done: any) => {
|
|
557
|
-
const mockColumn = { id: 'field1', field: 'field1', width: 100, cssClass: 'red', __collapsed: true };
|
|
558
|
-
const handlerSpy = vi.spyOn(plugin.eventHandler, 'subscribe');
|
|
559
|
-
|
|
560
|
-
plugin.init(gridStub);
|
|
561
|
-
const redrawSpy = vi.spyOn(plugin, 'redrawAllViewComponents');
|
|
562
|
-
plugin.onBeforeRowDetailToggle = new SlickEvent();
|
|
563
|
-
plugin.register();
|
|
564
|
-
|
|
565
|
-
plugin.eventHandler.subscribe(plugin.onBeforeRowDetailToggle, () => {
|
|
566
|
-
eventPubSubService.publish('onGridMenuClearAllSorting', { columnId: 'field1', operator: '=', searchTerms: [] });
|
|
567
|
-
});
|
|
568
|
-
plugin.onBeforeRowDetailToggle.notify({ item: mockColumn, grid: gridStub }, new SlickEventData(), gridStub);
|
|
569
|
-
plugin.onBeforeRowDetailToggle.notify({ item: { ...mockColumn, __collapsed: false }, grid: gridStub }, new SlickEventData(), gridStub);
|
|
570
|
-
|
|
571
|
-
expect(handlerSpy).toHaveBeenCalled();
|
|
572
|
-
setTimeout(() => {
|
|
573
|
-
expect(redrawSpy).toHaveBeenCalledTimes(4);
|
|
574
|
-
done();
|
|
575
|
-
});
|
|
576
|
-
}));
|
|
577
|
-
|
|
578
|
-
it('should call "redrawViewComponent" when grid event "onRowBackToViewportRange" is triggered', () => {
|
|
579
|
-
const mockColumn = { id: 'field1', field: 'field1', width: 100, cssClass: 'red', __collapsed: true };
|
|
580
|
-
const redrawSpy = vi.spyOn(plugin, 'redrawViewComponent');
|
|
581
|
-
|
|
582
|
-
plugin.init(gridStub);
|
|
583
|
-
plugin.onBeforeRowDetailToggle = new SlickEvent();
|
|
584
|
-
plugin.onRowBackToViewportRange = new SlickEvent();
|
|
585
|
-
plugin.register();
|
|
586
|
-
plugin.onBeforeRowDetailToggle.notify({ item: { ...mockColumn, __collapsed: false }, grid: gridStub }, new SlickEventData(), gridStub);
|
|
587
|
-
plugin.onBeforeRowDetailToggle.notify({ item: mockColumn, grid: gridStub }, new SlickEventData(), gridStub);
|
|
588
|
-
plugin.onRowBackToViewportRange.notify({ item: mockColumn, grid: gridStub, rowId: 'field1' } as any, new SlickEventData(), gridStub);
|
|
589
|
-
|
|
590
|
-
expect(redrawSpy).toHaveBeenCalled();
|
|
591
|
-
});
|
|
592
|
-
|
|
593
|
-
it('should run the internal "onProcessing" and call "notifyTemplate" with a Promise when "process" method is defined and executed', () =>
|
|
594
|
-
new Promise((done: any) => {
|
|
595
|
-
const mockItem = { id: 2, firstName: 'John', lastName: 'Doe' };
|
|
596
|
-
gridOptionsMock.rowDetailView!.process = () => new Promise((resolve) => resolve(mockItem));
|
|
597
|
-
|
|
598
|
-
plugin.init(gridStub);
|
|
599
|
-
plugin.onAsyncResponse = new SlickEvent();
|
|
600
|
-
plugin.onAsyncResponse.subscribe((_e, response) => {
|
|
601
|
-
expect(response).toEqual(expect.objectContaining({ item: mockItem }));
|
|
602
|
-
done();
|
|
603
|
-
});
|
|
604
|
-
|
|
605
|
-
gridOptionsMock.rowDetailView!.process(mockItem);
|
|
606
|
-
}));
|
|
607
|
-
|
|
608
|
-
it('should run the internal "onProcessing" and call "notifyTemplate" with an Object to simular HttpClient call when "process" method is defined and executed', () =>
|
|
609
|
-
new Promise((done: any) => {
|
|
610
|
-
const mockItem = { id: 2, firstName: 'John', lastName: 'Doe' };
|
|
611
|
-
(gridOptionsMock.rowDetailView as RowDetailView).process = () => of(mockItem);
|
|
612
|
-
|
|
613
|
-
plugin.init(gridStub);
|
|
614
|
-
plugin.onAsyncResponse = new SlickEvent();
|
|
615
|
-
plugin.onAsyncResponse.subscribe((_e: any, response: any) => {
|
|
616
|
-
expect(response).toEqual(expect.objectContaining({ item: mockItem }));
|
|
617
|
-
done();
|
|
618
|
-
});
|
|
619
|
-
|
|
620
|
-
(gridOptionsMock.rowDetailView as RowDetailView).process({ id: 'field1', field: 'field1' });
|
|
621
|
-
}));
|
|
622
|
-
|
|
623
|
-
it('should define "datasetIdPropertyName" with different "id" and run the internal "onProcessing" and call "notifyTemplate" with an Object to simular HttpClient call when "process" method is defined and executed', () =>
|
|
624
|
-
new Promise((done: any) => {
|
|
625
|
-
const mockItem = { rowId: 2, firstName: 'John', lastName: 'Doe' };
|
|
626
|
-
(gridOptionsMock.rowDetailView as RowDetailView).process = () => of(mockItem);
|
|
627
|
-
gridOptionsMock.datasetIdPropertyName = 'rowId';
|
|
628
|
-
|
|
629
|
-
plugin.init(gridStub);
|
|
630
|
-
plugin.onAsyncResponse = new SlickEvent();
|
|
631
|
-
plugin.onAsyncResponse.subscribe((_e: any, response: any) => {
|
|
632
|
-
expect(response).toEqual(expect.objectContaining({ item: mockItem }));
|
|
633
|
-
done();
|
|
634
|
-
});
|
|
635
|
-
|
|
636
|
-
(gridOptionsMock.rowDetailView as RowDetailView).process({ rowId: 'field1', field: 'field1' });
|
|
637
|
-
}));
|
|
638
|
-
|
|
639
|
-
it('should run the internal "onProcessing" and call "notifyTemplate" with an Object to simular HttpClient call when "process" method is defined and executed', async () => {
|
|
640
|
-
const mockItem = { firstName: 'John', lastName: 'Doe' };
|
|
641
|
-
(gridOptionsMock.rowDetailView as RowDetailView).process = (item) => new Promise((resolve) => resolve(item));
|
|
642
|
-
plugin.init(gridStub);
|
|
643
|
-
|
|
644
|
-
try {
|
|
645
|
-
await (gridOptionsMock.rowDetailView as RowDetailView).process(mockItem);
|
|
646
|
-
} catch (e: any) {
|
|
647
|
-
expect(e.toString()).toContain(`[Angular-Slickgrid] could not process the Row Detail, you must make sure that your "process" callback`);
|
|
648
|
-
}
|
|
649
|
-
});
|
|
650
|
-
|
|
651
|
-
it('should throw an error when running the "process" that does not return an object with an "id" property', async () => {
|
|
652
|
-
const mockItem = { firstName: 'John', lastName: 'Doe' };
|
|
653
|
-
gridOptionsMock.rowDetailView!.process = (item) => new Promise((resolve) => resolve(item));
|
|
654
|
-
plugin.init(gridStub);
|
|
655
|
-
|
|
656
|
-
try {
|
|
657
|
-
await gridOptionsMock.rowDetailView!.process(mockItem);
|
|
658
|
-
} catch (e: any) {
|
|
659
|
-
expect(e.toString()).toContain(`[Angular-Slickgrid] could not process the Row Detail, you must make sure that your "process" callback`);
|
|
660
|
-
}
|
|
661
|
-
});
|
|
662
|
-
|
|
663
|
-
it('should call Angular Util "disposeAllViewComponents" when grid "onSort" is triggered', () =>
|
|
664
|
-
new Promise((done: any) => {
|
|
665
|
-
const mockColumn = { id: 'field1', field: 'field1', width: 100, cssClass: 'red', __collapsed: true };
|
|
666
|
-
// const appendSpy = vi.spyOn(angularUtilServiceStub, 'createAngularComponentAppendToDom').mockReturnValue({ componentRef: { instance: vi.fn(), destroy: vi.fn() } } as any);
|
|
667
|
-
vi.spyOn(angularUtilServiceStub, 'createAngularComponentAppendToDom').mockReturnValue({ componentRef: { plugin: {} } } as any);
|
|
668
|
-
const handlerSpy = vi.spyOn(plugin.eventHandler, 'subscribe');
|
|
669
|
-
const disposeSpy = vi.spyOn(plugin, 'disposeAllViewComponents');
|
|
670
|
-
|
|
671
|
-
plugin.init(gridStub);
|
|
672
|
-
plugin.onBeforeRowDetailToggle = new SlickEvent();
|
|
673
|
-
plugin.eventHandler.subscribe(plugin.onBeforeRowDetailToggle, () => {
|
|
674
|
-
gridStub.onSort.notify({ impactedColumns: [mockColumn] } as any, new SlickEventData(), gridStub);
|
|
675
|
-
expect(disposeSpy).toHaveBeenCalled();
|
|
676
|
-
done();
|
|
677
|
-
});
|
|
678
|
-
plugin.onBeforeRowDetailToggle.notify({ item: mockColumn, grid: gridStub }, new SlickEventData(), gridStub);
|
|
679
|
-
|
|
680
|
-
expect(handlerSpy).toHaveBeenCalled();
|
|
681
|
-
}));
|
|
682
|
-
|
|
683
|
-
it('should dispose of the addon', () => {
|
|
684
|
-
plugin.init(gridStub);
|
|
685
|
-
const disposeSpy = vi.spyOn(plugin, 'dispose');
|
|
686
|
-
const disposeAllSpy = vi.spyOn(plugin, 'disposeAllViewComponents');
|
|
687
|
-
|
|
688
|
-
plugin.dispose();
|
|
689
|
-
|
|
690
|
-
expect(disposeSpy).toHaveBeenCalled();
|
|
691
|
-
expect(disposeAllSpy).toHaveBeenCalled();
|
|
692
|
-
});
|
|
693
|
-
|
|
694
|
-
it('should call internal event handler subscribe and expect the "onBeforeRowDetailToggle" option to be called and return true when addon notify is called', () => {
|
|
695
|
-
gridOptionsMock.rowDetailView!.onBeforeRowDetailToggle = undefined;
|
|
696
|
-
const onAsyncRespSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onAsyncResponse');
|
|
697
|
-
const onAsyncEndSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onAsyncEndUpdate');
|
|
698
|
-
const onAfterRowSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onAfterRowDetailToggle');
|
|
699
|
-
// const onBeforeRowSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onBeforeRowDetailToggle');
|
|
700
|
-
const onRowOutViewSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onRowOutOfViewportRange');
|
|
701
|
-
const onRowBackViewSpy = vi.spyOn(gridOptionsMock.rowDetailView as RowDetailView, 'onRowBackToViewportRange');
|
|
702
|
-
|
|
703
|
-
plugin.init(gridStub);
|
|
704
|
-
plugin.onBeforeRowDetailToggle = new SlickEvent();
|
|
705
|
-
plugin.register();
|
|
706
|
-
const result = plugin.onBeforeRowDetailToggle.notify({ item: columnsMock[0], grid: gridStub }, new SlickEventData(), gridStub);
|
|
707
|
-
|
|
708
|
-
expect(result.getReturnValue()).toEqual(true);
|
|
709
|
-
expect(onAsyncRespSpy).not.toHaveBeenCalled();
|
|
710
|
-
expect(onAsyncEndSpy).not.toHaveBeenCalled();
|
|
711
|
-
expect(onAfterRowSpy).not.toHaveBeenCalled();
|
|
712
|
-
expect(onRowOutViewSpy).not.toHaveBeenCalled();
|
|
713
|
-
expect(onRowBackViewSpy).not.toHaveBeenCalled();
|
|
714
|
-
});
|
|
715
|
-
|
|
716
|
-
it('should call internal event handler subscribe and expect the "onBeforeRowOutOfViewportRange" callback to be called', () => {
|
|
717
|
-
const onBeforeSpy = vi.fn();
|
|
718
|
-
gridOptionsMock.rowDetailView!.onBeforeRowOutOfViewportRange = onBeforeSpy;
|
|
719
|
-
|
|
720
|
-
plugin.init(gridStub);
|
|
721
|
-
plugin.onBeforeRowOutOfViewportRange = new SlickEvent();
|
|
722
|
-
plugin.register();
|
|
723
|
-
plugin.onBeforeRowOutOfViewportRange.notify({ item: columnsMock[0], rowId: columnsMock[0].id, grid: gridStub } as any, new SlickEventData(), gridStub);
|
|
724
|
-
|
|
725
|
-
expect(onBeforeSpy).toHaveBeenCalled();
|
|
726
|
-
});
|
|
727
|
-
});
|
|
728
|
-
|
|
729
|
-
describe('possible error thrown', () => {
|
|
730
|
-
it('should throw an error when creating with "init" and the row detail is without a "process" method defined', () => {
|
|
731
|
-
const copyGridOptionsMock = { ...gridOptionsMock };
|
|
732
|
-
copyGridOptionsMock.rowDetailView!.process = undefined as any;
|
|
733
|
-
vi.spyOn(gridStub, 'getOptions').mockReturnValue(gridOptionsMock);
|
|
734
|
-
|
|
735
|
-
expect(() => plugin.init(gridStub)).toThrowError(
|
|
736
|
-
`[Angular-Slickgrid] You need to provide a "process" function for the Row Detail Extension to work properly`
|
|
737
|
-
);
|
|
738
|
-
});
|
|
739
|
-
|
|
740
|
-
it('should throw an error when creating with "register" and the row detail is without a "process" method defined', () => {
|
|
741
|
-
const copyGridOptionsMock = { ...gridOptionsMock };
|
|
742
|
-
copyGridOptionsMock.rowDetailView!.process = undefined as any;
|
|
743
|
-
vi.spyOn(gridStub, 'getOptions').mockReturnValue(gridOptionsMock);
|
|
744
|
-
|
|
745
|
-
expect(() => plugin.register()).toThrowError(
|
|
746
|
-
`[Angular-Slickgrid] You need to provide a "process" function for the Row Detail Extension to work properly`
|
|
747
|
-
);
|
|
748
|
-
});
|
|
749
|
-
});
|
|
750
|
-
});
|
|
751
|
-
});
|