@kirbydesign/designsystem 0.0.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/README.md +7 -0
- package/karma.conf.js +34 -0
- package/ng-package.json +32 -0
- package/ngcc.config.js +3 -0
- package/package.json +27 -0
- package/src/index.ts +1 -0
- package/src/lib/animation/kirby-animation.ts +12 -0
- package/src/lib/components/accordion/accordion-item.component.html +25 -0
- package/src/lib/components/accordion/accordion-item.component.scss +64 -0
- package/src/lib/components/accordion/accordion-item.component.spec.ts +52 -0
- package/src/lib/components/accordion/accordion-item.component.ts +27 -0
- package/src/lib/components/accordion/accordion.directive.ts +7 -0
- package/src/lib/components/accordion/index.ts +2 -0
- package/src/lib/components/angular-component-lib/utils.ts +43 -0
- package/src/lib/components/app/app.component.html +3 -0
- package/src/lib/components/app/app.component.scss +10 -0
- package/src/lib/components/app/app.component.spec.ts +52 -0
- package/src/lib/components/app/app.component.ts +50 -0
- package/src/lib/components/app/app.module.ts +12 -0
- package/src/lib/components/app/index.ts +2 -0
- package/src/lib/components/avatar/avatar.component.html +6 -0
- package/src/lib/components/avatar/avatar.component.scss +153 -0
- package/src/lib/components/avatar/avatar.component.spec.ts +207 -0
- package/src/lib/components/avatar/avatar.component.ts +32 -0
- package/src/lib/components/badge/badge.component.spec.ts +78 -0
- package/src/lib/components/button/button.component.html +1 -0
- package/src/lib/components/button/button.component.integration.spec.ts +576 -0
- package/src/lib/components/button/button.component.scss +286 -0
- package/src/lib/components/button/button.component.spec.ts +404 -0
- package/src/lib/components/button/button.component.ts +96 -0
- package/src/lib/components/calendar/calendar.component.html +49 -0
- package/src/lib/components/calendar/calendar.component.initialization.spec.ts +93 -0
- package/src/lib/components/calendar/calendar.component.scss +132 -0
- package/src/lib/components/calendar/calendar.component.spec.ts +470 -0
- package/src/lib/components/calendar/calendar.component.ts +513 -0
- package/src/lib/components/calendar/helpers/calendar-cell.model.ts +7 -0
- package/src/lib/components/calendar/helpers/calendar-options.model.ts +10 -0
- package/src/lib/components/calendar/helpers/calendar.helper.ts +108 -0
- package/src/lib/components/calendar/index.ts +2 -0
- package/src/lib/components/calendar/options/calendar-year-navigator-config.ts +4 -0
- package/src/lib/components/card/card-footer/card-footer.component.html +3 -0
- package/src/lib/components/card/card-footer/card-footer.component.scss +19 -0
- package/src/lib/components/card/card-footer/card-footer.component.ts +13 -0
- package/src/lib/components/card/card-header/card-header.component.html +5 -0
- package/src/lib/components/card/card-header/card-header.component.scss +63 -0
- package/src/lib/components/card/card-header/card-header.component.ts +20 -0
- package/src/lib/components/card/card.component.html +5 -0
- package/src/lib/components/card/card.component.scss +56 -0
- package/src/lib/components/card/card.component.spec.ts +81 -0
- package/src/lib/components/card/card.component.ts +95 -0
- package/src/lib/components/card/index.ts +3 -0
- package/src/lib/components/chart/chart-js/chart-js.service.integration.spec.ts +320 -0
- package/src/lib/components/chart/chart-js/chart-js.service.spec.ts +1004 -0
- package/src/lib/components/chart/chart-js/chart-js.service.ts +445 -0
- package/src/lib/components/chart/chart-js/chartjs-plugin-marker/chartjs-plugin-marker.ts +254 -0
- package/src/lib/components/chart/chart-js/configured-chart-js.ts +39 -0
- package/src/lib/components/chart/chart-js/test-utils.ts +171 -0
- package/src/lib/components/chart/chart.component.html +7 -0
- package/src/lib/components/chart/chart.component.scss +6 -0
- package/src/lib/components/chart/chart.component.spec.ts +188 -0
- package/src/lib/components/chart/chart.component.ts +148 -0
- package/src/lib/components/chart/chart.module.ts +11 -0
- package/src/lib/components/chart/chart.types.ts +34 -0
- package/src/lib/components/chart/configs/annotations.config.ts +36 -0
- package/src/lib/components/chart/configs/chart-config.service.spec.ts +21 -0
- package/src/lib/components/chart/configs/chart-config.service.ts +34 -0
- package/src/lib/components/chart/configs/global-defaults.config.ts +50 -0
- package/src/lib/components/chart/configs/interaction-functions-extensions.config.ts +19 -0
- package/src/lib/components/chart/configs/shared.utils.ts +28 -0
- package/src/lib/components/chart/configs/type.config.ts +214 -0
- package/src/lib/components/chart/index.ts +5 -0
- package/src/lib/components/chart-deprecated/chart-deprecated-helper.ts +25 -0
- package/src/lib/components/chart-deprecated/chart-deprecated-type.ts +10 -0
- package/src/lib/components/chart-deprecated/chart-deprecated.component.scss +3 -0
- package/src/lib/components/chart-deprecated/chart-deprecated.component.spec.ts +271 -0
- package/src/lib/components/chart-deprecated/chart-deprecated.component.ts +233 -0
- package/src/lib/components/chart-deprecated/index.ts +2 -0
- package/src/lib/components/chart-deprecated/options/activitygauge.ts +87 -0
- package/src/lib/components/chart-deprecated/options/areaspline.ts +95 -0
- package/src/lib/components/chart-deprecated/options/bar.ts +93 -0
- package/src/lib/components/chart-deprecated/options/column.ts +101 -0
- package/src/lib/components/chart-deprecated/options/donut.ts +118 -0
- package/src/lib/components/chart-deprecated/options/timeseries.ts +96 -0
- package/src/lib/components/checkbox/checkbox.component.html +10 -0
- package/src/lib/components/checkbox/checkbox.component.integration.spec.ts +59 -0
- package/src/lib/components/checkbox/checkbox.component.scss +130 -0
- package/src/lib/components/checkbox/checkbox.component.spec.ts +205 -0
- package/src/lib/components/checkbox/checkbox.component.ts +56 -0
- package/src/lib/components/chip/chip.component.html +1 -0
- package/src/lib/components/chip/chip.component.integration.spec.ts +111 -0
- package/src/lib/components/chip/chip.component.scss +49 -0
- package/src/lib/components/chip/chip.component.spec.ts +84 -0
- package/src/lib/components/chip/chip.component.ts +16 -0
- package/src/lib/components/divider/divider.component.html +1 -0
- package/src/lib/components/divider/divider.component.scss +22 -0
- package/src/lib/components/divider/divider.component.spec.ts +24 -0
- package/src/lib/components/divider/divider.component.ts +12 -0
- package/src/lib/components/dropdown/dropdown-popover.component.integration.spec.ts +177 -0
- package/src/lib/components/dropdown/dropdown-popover.component.spec.ts +1154 -0
- package/src/lib/components/dropdown/dropdown.component.html +42 -0
- package/src/lib/components/dropdown/dropdown.component.scss +142 -0
- package/src/lib/components/dropdown/dropdown.component.spec.ts +1215 -0
- package/src/lib/components/dropdown/dropdown.component.ts +538 -0
- package/src/lib/components/dropdown/dropdown.types.ts +10 -0
- package/src/lib/components/dropdown/keyboard-handler.service.ts +38 -0
- package/src/lib/components/empty-state/empty-state.component.html +10 -0
- package/src/lib/components/empty-state/empty-state.component.integration.spec.ts +110 -0
- package/src/lib/components/empty-state/empty-state.component.scss +50 -0
- package/src/lib/components/empty-state/empty-state.component.spec.ts +40 -0
- package/src/lib/components/empty-state/empty-state.component.ts +50 -0
- package/src/lib/components/fab-sheet/fab-sheet.component.html +13 -0
- package/src/lib/components/fab-sheet/fab-sheet.component.scss +67 -0
- package/src/lib/components/fab-sheet/fab-sheet.component.spec.ts +29 -0
- package/src/lib/components/fab-sheet/fab-sheet.component.ts +100 -0
- package/src/lib/components/flag/flag.component.scss +40 -0
- package/src/lib/components/flag/flag.component.spec.ts +152 -0
- package/src/lib/components/flag/flag.component.ts +18 -0
- package/src/lib/components/form-field/_form-field-inputs.shared.scss +62 -0
- package/src/lib/components/form-field/directives/date/date-input.directive.spec.ts +127 -0
- package/src/lib/components/form-field/directives/date/date-input.directive.ts +94 -0
- package/src/lib/components/form-field/directives/decimal-mask/decimal-mask.directive.spec.ts +231 -0
- package/src/lib/components/form-field/directives/decimal-mask/decimal-mask.directive.ts +113 -0
- package/src/lib/components/form-field/form-field-message/form-field-message.component.html +1 -0
- package/src/lib/components/form-field/form-field-message/form-field-message.component.scss +11 -0
- package/src/lib/components/form-field/form-field-message/form-field-message.component.ts +12 -0
- package/src/lib/components/form-field/form-field.component.html +39 -0
- package/src/lib/components/form-field/form-field.component.scss +43 -0
- package/src/lib/components/form-field/form-field.component.spec.ts +521 -0
- package/src/lib/components/form-field/form-field.component.ts +141 -0
- package/src/lib/components/form-field/index.ts +7 -0
- package/src/lib/components/form-field/input/input.component.integration.spec.ts +83 -0
- package/src/lib/components/form-field/input/input.component.scss +54 -0
- package/src/lib/components/form-field/input/input.component.spec.ts +159 -0
- package/src/lib/components/form-field/input/input.component.ts +91 -0
- package/src/lib/components/form-field/input-counter/input-counter.component.html +1 -0
- package/src/lib/components/form-field/input-counter/input-counter.component.spec.ts +184 -0
- package/src/lib/components/form-field/input-counter/input-counter.component.ts +41 -0
- package/src/lib/components/form-field/textarea/textarea.component.html +2 -0
- package/src/lib/components/form-field/textarea/textarea.component.scss +11 -0
- package/src/lib/components/form-field/textarea/textarea.component.spec.ts +100 -0
- package/src/lib/components/form-field/textarea/textarea.component.ts +64 -0
- package/src/lib/components/grid/breakpoint-helper.service.ts +27 -0
- package/src/lib/components/grid/grid-card-configuration.ts +7 -0
- package/src/lib/components/grid/grid.component.html +6 -0
- package/src/lib/components/grid/grid.component.scss +26 -0
- package/src/lib/components/grid/grid.component.ts +106 -0
- package/src/lib/components/icon/icon-registry.service.spec.ts +107 -0
- package/src/lib/components/icon/icon-registry.service.ts +39 -0
- package/src/lib/components/icon/icon-settings.ts +8 -0
- package/src/lib/components/icon/icon.component.html +1 -0
- package/src/lib/components/icon/icon.component.scss +47 -0
- package/src/lib/components/icon/icon.component.spec.ts +254 -0
- package/src/lib/components/icon/icon.component.ts +89 -0
- package/src/lib/components/icon/icon.module.ts +11 -0
- package/src/lib/components/icon/index.ts +5 -0
- package/src/lib/components/icon/kirby-icon-settings.ts +65 -0
- package/src/lib/components/icon/readme.md +16 -0
- package/src/lib/components/icon/selection.json +1776 -0
- package/src/lib/components/index.ts +67 -0
- package/src/lib/components/item/_item.utils.scss +36 -0
- package/src/lib/components/item/index.ts +3 -0
- package/src/lib/components/item/item.component.html +16 -0
- package/src/lib/components/item/item.component.integration.spec.ts +64 -0
- package/src/lib/components/item/item.component.scss +156 -0
- package/src/lib/components/item/item.component.spec.ts +85 -0
- package/src/lib/components/item/item.component.ts +37 -0
- package/src/lib/components/item/item.module.ts +14 -0
- package/src/lib/components/item/label/label.component.html +3 -0
- package/src/lib/components/item/label/label.component.scss +36 -0
- package/src/lib/components/item/label/label.component.spec.ts +23 -0
- package/src/lib/components/item/label/label.component.ts +16 -0
- package/src/lib/components/item-group/item-group.component.html +1 -0
- package/src/lib/components/item-group/item-group.component.scss +3 -0
- package/src/lib/components/item-group/item-group.component.spec.ts +42 -0
- package/src/lib/components/item-group/item-group.component.ts +10 -0
- package/src/lib/components/item-sliding/index.ts +2 -0
- package/src/lib/components/item-sliding/item-sliding.component.html +20 -0
- package/src/lib/components/item-sliding/item-sliding.component.scss +9 -0
- package/src/lib/components/item-sliding/item-sliding.component.spec.ts +174 -0
- package/src/lib/components/item-sliding/item-sliding.component.ts +23 -0
- package/src/lib/components/item-sliding/item-sliding.shared.scss +18 -0
- package/src/lib/components/item-sliding/item-sliding.types.ts +13 -0
- package/src/lib/components/list/directives/infinite-scroll.directive.spec.ts +131 -0
- package/src/lib/components/list/directives/infinite-scroll.directive.ts +137 -0
- package/src/lib/components/list/directives/list-item-color.directive.ts +27 -0
- package/src/lib/components/list/directives/scroll.model.ts +5 -0
- package/src/lib/components/list/helpers/list-helper.spec.ts +109 -0
- package/src/lib/components/list/helpers/list-helper.ts +19 -0
- package/src/lib/components/list/index.ts +21 -0
- package/src/lib/components/list/list-experimental/list-experimental.component.html +4 -0
- package/src/lib/components/list/list-experimental/list-experimental.component.scss +6 -0
- package/src/lib/components/list/list-experimental/list-experimental.component.spec.ts +112 -0
- package/src/lib/components/list/list-experimental/list-experimental.component.ts +21 -0
- package/src/lib/components/list/list-header/list-header.component.html +1 -0
- package/src/lib/components/list/list-header/list-header.component.scss +10 -0
- package/src/lib/components/list/list-header/list-header.component.spec.ts +24 -0
- package/src/lib/components/list/list-header/list-header.component.ts +11 -0
- package/src/lib/components/list/list-item/list-item.component.html +39 -0
- package/src/lib/components/list/list-item/list-item.component.scss +13 -0
- package/src/lib/components/list/list-item/list-item.component.ts +144 -0
- package/src/lib/components/list/list-section-header/list-section-header.component.html +3 -0
- package/src/lib/components/list/list-section-header/list-section-header.component.spec.ts +24 -0
- package/src/lib/components/list/list-section-header/list-section-header.component.ts +13 -0
- package/src/lib/components/list/list-swipe-action.ts +2 -0
- package/src/lib/components/list/list-swipe-action.type.ts +23 -0
- package/src/lib/components/list/list.component.html +65 -0
- package/src/lib/components/list/list.component.integration.spec.ts +177 -0
- package/src/lib/components/list/list.component.scss +243 -0
- package/src/lib/components/list/list.component.spec.ts +219 -0
- package/src/lib/components/list/list.component.ts +213 -0
- package/src/lib/components/list/list.directive.ts +21 -0
- package/src/lib/components/list/list.event.ts +8 -0
- package/src/lib/components/list/list.module.ts +47 -0
- package/src/lib/components/list/pipes/group-by.pipe.spec.ts +71 -0
- package/src/lib/components/list/pipes/group-by.pipe.ts +34 -0
- package/src/lib/components/loading-overlay/index.ts +2 -0
- package/src/lib/components/loading-overlay/loading-overlay.component.html +8 -0
- package/src/lib/components/loading-overlay/loading-overlay.component.scss +37 -0
- package/src/lib/components/loading-overlay/loading-overlay.component.ts +12 -0
- package/src/lib/components/loading-overlay/loading-overlay.service.ts +44 -0
- package/src/lib/components/modal/action-sheet/action-sheet.component.html +24 -0
- package/src/lib/components/modal/action-sheet/action-sheet.component.scss +47 -0
- package/src/lib/components/modal/action-sheet/action-sheet.component.spec.ts +153 -0
- package/src/lib/components/modal/action-sheet/action-sheet.component.ts +27 -0
- package/src/lib/components/modal/action-sheet/config/action-sheet-config.ts +8 -0
- package/src/lib/components/modal/action-sheet/config/action-sheet-item.ts +4 -0
- package/src/lib/components/modal/alert/alert.component.html +29 -0
- package/src/lib/components/modal/alert/alert.component.scss +21 -0
- package/src/lib/components/modal/alert/alert.component.spec.ts +104 -0
- package/src/lib/components/modal/alert/alert.component.ts +67 -0
- package/src/lib/components/modal/alert/config/alert-config.ts +19 -0
- package/src/lib/components/modal/footer/modal-footer.component.html +3 -0
- package/src/lib/components/modal/footer/modal-footer.component.scss +57 -0
- package/src/lib/components/modal/footer/modal-footer.component.spec.ts +209 -0
- package/src/lib/components/modal/footer/modal-footer.component.ts +17 -0
- package/src/lib/components/modal/index.ts +9 -0
- package/src/lib/components/modal/modal-wrapper/compact/modal-compact-wrapper.component.html +3 -0
- package/src/lib/components/modal/modal-wrapper/compact/modal-compact-wrapper.component.scss +8 -0
- package/src/lib/components/modal/modal-wrapper/compact/modal-compact-wrapper.component.ts +79 -0
- package/src/lib/components/modal/modal-wrapper/config/drawer-supplementary-action.ts +4 -0
- package/src/lib/components/modal/modal-wrapper/config/modal-config.helper.ts +3 -0
- package/src/lib/components/modal/modal-wrapper/config/modal-config.ts +22 -0
- package/src/lib/components/modal/modal-wrapper/modal-wrapper.component.html +43 -0
- package/src/lib/components/modal/modal-wrapper/modal-wrapper.component.scss +159 -0
- package/src/lib/components/modal/modal-wrapper/modal-wrapper.component.spec.ts +942 -0
- package/src/lib/components/modal/modal-wrapper/modal-wrapper.component.ts +587 -0
- package/src/lib/components/modal/modal-wrapper/modal-wrapper.testbuilder.ts +155 -0
- package/src/lib/components/modal/services/action-sheet.helper.spec.ts +86 -0
- package/src/lib/components/modal/services/action-sheet.helper.ts +47 -0
- package/src/lib/components/modal/services/alert.helper.spec.ts +89 -0
- package/src/lib/components/modal/services/alert.helper.ts +57 -0
- package/src/lib/components/modal/services/modal-animation-builder.service.ts +276 -0
- package/src/lib/components/modal/services/modal-navigation.service.spec.ts +543 -0
- package/src/lib/components/modal/services/modal-navigation.service.ts +331 -0
- package/src/lib/components/modal/services/modal.controller.spec.ts +212 -0
- package/src/lib/components/modal/services/modal.controller.ts +194 -0
- package/src/lib/components/modal/services/modal.helper.spec.ts +828 -0
- package/src/lib/components/modal/services/modal.helper.ts +128 -0
- package/src/lib/components/modal/services/modal.interfaces.ts +28 -0
- package/src/lib/components/page/index.ts +13 -0
- package/src/lib/components/page/page-footer/page-footer.component.html +3 -0
- package/src/lib/components/page/page-footer/page-footer.component.scss +23 -0
- package/src/lib/components/page/page-footer/page-footer.component.spec.ts +52 -0
- package/src/lib/components/page/page-footer/page-footer.component.ts +46 -0
- package/src/lib/components/page/page.component.html +101 -0
- package/src/lib/components/page/page.component.scss +141 -0
- package/src/lib/components/page/page.component.spec.ts +224 -0
- package/src/lib/components/page/page.component.ts +415 -0
- package/src/lib/components/page/page.module.ts +52 -0
- package/src/lib/components/popover/popover.component.scss +26 -0
- package/src/lib/components/popover/popover.component.spec.ts +0 -0
- package/src/lib/components/popover/popover.component.ts +221 -0
- package/src/lib/components/progress-circle/progress-circle-ring.component.scss +22 -0
- package/src/lib/components/progress-circle/progress-circle-ring.component.spec.ts +143 -0
- package/src/lib/components/progress-circle/progress-circle-ring.component.svg +23 -0
- package/src/lib/components/progress-circle/progress-circle-ring.component.ts +42 -0
- package/src/lib/components/progress-circle/progress-circle.component.html +11 -0
- package/src/lib/components/progress-circle/progress-circle.component.scss +28 -0
- package/src/lib/components/progress-circle/progress-circle.component.spec.ts +339 -0
- package/src/lib/components/progress-circle/progress-circle.component.ts +96 -0
- package/src/lib/components/radio/index.ts +2 -0
- package/src/lib/components/radio/radio-group/radio-group.component.html +24 -0
- package/src/lib/components/radio/radio-group/radio-group.component.spec.ts +1328 -0
- package/src/lib/components/radio/radio-group/radio-group.component.ts +272 -0
- package/src/lib/components/radio/radio.component.html +9 -0
- package/src/lib/components/radio/radio.component.integration.spec.ts +93 -0
- package/src/lib/components/radio/radio.component.scss +133 -0
- package/src/lib/components/radio/radio.component.spec.ts +244 -0
- package/src/lib/components/radio/radio.component.ts +50 -0
- package/src/lib/components/range/range.component.html +16 -0
- package/src/lib/components/range/range.component.scss +81 -0
- package/src/lib/components/range/range.component.ts +105 -0
- package/src/lib/components/reorder-list/index.ts +3 -0
- package/src/lib/components/reorder-list/reorder-event.ts +17 -0
- package/src/lib/components/reorder-list/reorder-list.component.html +30 -0
- package/src/lib/components/reorder-list/reorder-list.component.scss +90 -0
- package/src/lib/components/reorder-list/reorder-list.component.spec.ts +123 -0
- package/src/lib/components/reorder-list/reorder-list.component.ts +86 -0
- package/src/lib/components/router-outlet/index.ts +5 -0
- package/src/lib/components/router-outlet/router-outlet.component.html +6 -0
- package/src/lib/components/router-outlet/router-outlet.component.scss +13 -0
- package/src/lib/components/router-outlet/router-outlet.component.spec.ts +28 -0
- package/src/lib/components/router-outlet/router-outlet.component.ts +11 -0
- package/src/lib/components/router-outlet/router-outlet.module.ts +12 -0
- package/src/lib/components/section-header/_section-header.utils.scss +34 -0
- package/src/lib/components/section-header/section-header.component.html +3 -0
- package/src/lib/components/section-header/section-header.component.scss +15 -0
- package/src/lib/components/section-header/section-header.component.spec.ts +59 -0
- package/src/lib/components/section-header/section-header.component.ts +9 -0
- package/src/lib/components/section-header/section-header.integration.spec.ts +67 -0
- package/src/lib/components/segmented-control/segment-item.ts +18 -0
- package/src/lib/components/segmented-control/segmented-control.component.html +39 -0
- package/src/lib/components/segmented-control/segmented-control.component.scss +84 -0
- package/src/lib/components/segmented-control/segmented-control.component.spec.ts +247 -0
- package/src/lib/components/segmented-control/segmented-control.component.ts +96 -0
- package/src/lib/components/shared/component-configuration.ts +6 -0
- package/src/lib/components/shared/component-loader.directive.ts +42 -0
- package/src/lib/components/shared/dynamic-component.ts +3 -0
- package/src/lib/components/shared/index.ts +9 -0
- package/src/lib/components/shared/resize-observer/resize-observer.factory.ts +20 -0
- package/src/lib/components/shared/resize-observer/resize-observer.service.ts +65 -0
- package/src/lib/components/shared/resize-observer/types/resize-observer-callback.ts +7 -0
- package/src/lib/components/shared/resize-observer/types/resize-observer-entry.ts +14 -0
- package/src/lib/components/shared/resize-observer/types/resize-observer.ts +17 -0
- package/src/lib/components/slide-button/slide-button.component.html +14 -0
- package/src/lib/components/slide-button/slide-button.component.scss +81 -0
- package/src/lib/components/slide-button/slide-button.component.shared.scss +12 -0
- package/src/lib/components/slide-button/slide-button.component.spec.ts +75 -0
- package/src/lib/components/slide-button/slide-button.component.ts +81 -0
- package/src/lib/components/slides/slides.component.spec.ts +76 -0
- package/src/lib/components/slides/slides.component.ts +57 -0
- package/src/lib/components/spinner/index.ts +2 -0
- package/src/lib/components/spinner/spinner.component.html +4 -0
- package/src/lib/components/spinner/spinner.component.scss +37 -0
- package/src/lib/components/spinner/spinner.component.ts +13 -0
- package/src/lib/components/spinner/spinner.module.ts +12 -0
- package/src/lib/components/stock-chart-deprecated/index.ts +2 -0
- package/src/lib/components/stock-chart-deprecated/options/stock-chart-deprecated-options.ts +220 -0
- package/src/lib/components/stock-chart-deprecated/stock-chart-deprecated.component.scss +3 -0
- package/src/lib/components/stock-chart-deprecated/stock-chart-deprecated.component.spec.ts +32 -0
- package/src/lib/components/stock-chart-deprecated/stock-chart-deprecated.component.ts +92 -0
- package/src/lib/components/tabs/index.ts +5 -0
- package/src/lib/components/tabs/tab-button/tab-button.component.html +13 -0
- package/src/lib/components/tabs/tab-button/tab-button.component.scss +48 -0
- package/src/lib/components/tabs/tab-button/tab-button.component.spec.ts +24 -0
- package/src/lib/components/tabs/tab-button/tab-button.component.ts +47 -0
- package/src/lib/components/tabs/tab-button/tab-button.events.ts +1 -0
- package/src/lib/components/tabs/tabs.component.html +5 -0
- package/src/lib/components/tabs/tabs.component.scss +52 -0
- package/src/lib/components/tabs/tabs.component.spec.ts +125 -0
- package/src/lib/components/tabs/tabs.component.ts +21 -0
- package/src/lib/components/tabs/tabs.module.ts +16 -0
- package/src/lib/components/tabs/tabs.service.ts +17 -0
- package/src/lib/components/toast/config/toast-config.ts +8 -0
- package/src/lib/components/toast/index.ts +2 -0
- package/src/lib/components/toast/services/toast.controller.ts +18 -0
- package/src/lib/components/toast/services/toast.helper.spec.ts +89 -0
- package/src/lib/components/toast/services/toast.helper.ts +39 -0
- package/src/lib/components/toggle/toggle.component.html +5 -0
- package/src/lib/components/toggle/toggle.component.scss +5 -0
- package/src/lib/components/toggle/toggle.component.spec.ts +62 -0
- package/src/lib/components/toggle/toggle.component.ts +17 -0
- package/src/lib/components/toggle-button/index.ts +2 -0
- package/src/lib/components/toggle-button/toggle-button.component.html +6 -0
- package/src/lib/components/toggle-button/toggle-button.component.spec.ts +23 -0
- package/src/lib/components/toggle-button/toggle-button.component.ts +24 -0
- package/src/lib/components/toggle-button/toggle-button.module.ts +13 -0
- package/src/lib/components/web-component-proxies.component.ts +25 -0
- package/src/lib/custom-elements-initializer.ts +19 -0
- package/src/lib/directives/element-as-button/element-as-button.directive.spec.ts +31 -0
- package/src/lib/directives/element-as-button/element-as-button.directive.ts +26 -0
- package/src/lib/directives/fit-heading/fit-heading.directive.ts +131 -0
- package/src/lib/directives/fit-heading/fit-heading.module.ts +9 -0
- package/src/lib/directives/index.ts +9 -0
- package/src/lib/directives/key-handler/key-handler.directive.ts +20 -0
- package/src/lib/directives/modal-router-link/modal-router-link.directive.ts +24 -0
- package/src/lib/directives/theme-color/theme-color.directive.ts +117 -0
- package/src/lib/helpers/color-helper.styles.ts +193 -0
- package/src/lib/helpers/color-helper.ts +1 -0
- package/src/lib/helpers/deep-copy.ts +13 -0
- package/src/lib/helpers/design-token-helper.styles.ts +78 -0
- package/src/lib/helpers/design-token-helper.ts +6 -0
- package/src/lib/helpers/element-has-ancestor.ts +28 -0
- package/src/lib/helpers/index.ts +8 -0
- package/src/lib/helpers/line-clamp-helper.ts +28 -0
- package/src/lib/helpers/merge-deep.spec.ts +11 -0
- package/src/lib/helpers/merge-deep.ts +41 -0
- package/src/lib/helpers/platform.service.ts +22 -0
- package/src/lib/helpers/string-helper.ts +6 -0
- package/src/lib/helpers/theme-color.type.ts +1 -0
- package/src/lib/helpers/unique-id-generator.helper.spec.ts +58 -0
- package/src/lib/helpers/unique-id-generator.helper.ts +19 -0
- package/src/lib/icons/svg/QR.svg +7 -0
- package/src/lib/icons/svg/accounts-outline.svg +9 -0
- package/src/lib/icons/svg/accounts.svg +9 -0
- package/src/lib/icons/svg/add.svg +7 -0
- package/src/lib/icons/svg/arrow-back.svg +7 -0
- package/src/lib/icons/svg/arrow-down.svg +7 -0
- package/src/lib/icons/svg/arrow-more.svg +7 -0
- package/src/lib/icons/svg/arrow-up.svg +7 -0
- package/src/lib/icons/svg/attach.svg +7 -0
- package/src/lib/icons/svg/backspace.svg +9 -0
- package/src/lib/icons/svg/calendar.svg +7 -0
- package/src/lib/icons/svg/camera.svg +9 -0
- package/src/lib/icons/svg/checkbox-outline.svg +7 -0
- package/src/lib/icons/svg/checkbox.svg +7 -0
- package/src/lib/icons/svg/checkmark-selected.svg +3 -0
- package/src/lib/icons/svg/clock.svg +7 -0
- package/src/lib/icons/svg/close.svg +7 -0
- package/src/lib/icons/svg/cog.svg +7 -0
- package/src/lib/icons/svg/copy.svg +9 -0
- package/src/lib/icons/svg/edit.svg +7 -0
- package/src/lib/icons/svg/filter.svg +7 -0
- package/src/lib/icons/svg/flag.svg +9 -0
- package/src/lib/icons/svg/flash-off.svg +7 -0
- package/src/lib/icons/svg/flash.svg +7 -0
- package/src/lib/icons/svg/foreign-payment.svg +7 -0
- package/src/lib/icons/svg/help.svg +7 -0
- package/src/lib/icons/svg/home.svg +5 -0
- package/src/lib/icons/svg/inbox-outline.svg +9 -0
- package/src/lib/icons/svg/inbox.svg +9 -0
- package/src/lib/icons/svg/information.svg +9 -0
- package/src/lib/icons/svg/investment.svg +5 -0
- package/src/lib/icons/svg/kirby.svg +3 -0
- package/src/lib/icons/svg/link.svg +7 -0
- package/src/lib/icons/svg/log-out.svg +7 -0
- package/src/lib/icons/svg/menu-outline.svg +9 -0
- package/src/lib/icons/svg/menu.svg +9 -0
- package/src/lib/icons/svg/misc.svg +5 -0
- package/src/lib/icons/svg/moneybag.svg +7 -0
- package/src/lib/icons/svg/more.svg +5 -0
- package/src/lib/icons/svg/move.svg +7 -0
- package/src/lib/icons/svg/payment-card.svg +6 -0
- package/src/lib/icons/svg/pension.svg +7 -0
- package/src/lib/icons/svg/person-outline.svg +9 -0
- package/src/lib/icons/svg/person.svg +9 -0
- package/src/lib/icons/svg/remove.svg +6 -0
- package/src/lib/icons/svg/reorder.svg +9 -0
- package/src/lib/icons/svg/search.svg +7 -0
- package/src/lib/icons/svg/share.svg +7 -0
- package/src/lib/icons/svg/sort.svg +7 -0
- package/src/lib/icons/svg/support.svg +9 -0
- package/src/lib/icons/svg/swap.svg +7 -0
- package/src/lib/icons/svg/trash.svg +7 -0
- package/src/lib/icons/svg/unsubscribe.svg +7 -0
- package/src/lib/icons/svg/verify.svg +7 -0
- package/src/lib/icons/svg/warning.svg +7 -0
- package/src/lib/icons/svg/write-message.svg +7 -0
- package/src/lib/index.ts +8 -0
- package/src/lib/kirby.module.spec.ts +20 -0
- package/src/lib/kirby.module.ts +219 -0
- package/src/lib/polyfills/intersection-observer-polyfill-loader.js +14 -0
- package/src/lib/polyfills/intersection-observer-polyfill-loader.min.js +1 -0
- package/src/lib/polyfills/intersection-observer-polyfill.js +2 -0
- package/src/lib/polyfills/intersection-observer-polyfill.min.js +1 -0
- package/src/lib/polyfills/resize-observer-polyfill-loader.js +14 -0
- package/src/lib/polyfills/resize-observer-polyfill-loader.min.js +1 -0
- package/src/lib/polyfills/resize-observer-polyfill.js +2 -0
- package/src/lib/polyfills/resize-observer-polyfill.min.js +1 -0
- package/src/lib/scss/link.spec.ts +47 -0
- package/src/lib/scss/scss-helper.ts +8 -0
- package/src/lib/scss/typography.spec.ts +241 -0
- package/src/lib/testing/element-css-custom-matchers.d.ts +7 -0
- package/src/lib/testing/element-css-custom-matchers.ts +139 -0
- package/src/lib/testing/styles.scss +13 -0
- package/src/lib/testing/test-helper.ts +158 -0
- package/src/lib/types/index.ts +1 -0
- package/src/lib/types/window-ref.ts +10 -0
- package/src/test.ts +34 -0
- package/src/typings.test.d.ts +1 -0
- package/testing-base/ng-package.json +3 -0
- package/testing-base/src/lib/components/index.ts +66 -0
- package/testing-base/src/lib/components/mock.accordion-item.component.ts +21 -0
- package/testing-base/src/lib/components/mock.action-sheet.component.ts +27 -0
- package/testing-base/src/lib/components/mock.app.component.ts +18 -0
- package/testing-base/src/lib/components/mock.avatar.component.ts +38 -0
- package/testing-base/src/lib/components/mock.badge.component.ts +20 -0
- package/testing-base/src/lib/components/mock.button.component.ts +26 -0
- package/testing-base/src/lib/components/mock.calendar.component.ts +36 -0
- package/testing-base/src/lib/components/mock.card-footer.component.ts +18 -0
- package/testing-base/src/lib/components/mock.card-header.component.ts +23 -0
- package/testing-base/src/lib/components/mock.card.component.ts +25 -0
- package/testing-base/src/lib/components/mock.chart-deprecated.component.ts +28 -0
- package/testing-base/src/lib/components/mock.chart.component.ts +36 -0
- package/testing-base/src/lib/components/mock.checkbox.component.ts +26 -0
- package/testing-base/src/lib/components/mock.chip.component.ts +21 -0
- package/testing-base/src/lib/components/mock.divider.component.ts +20 -0
- package/testing-base/src/lib/components/mock.dropdown.component.ts +32 -0
- package/testing-base/src/lib/components/mock.empty-state.component.ts +23 -0
- package/testing-base/src/lib/components/mock.fab-sheet.component.ts +21 -0
- package/testing-base/src/lib/components/mock.flag.component.ts +21 -0
- package/testing-base/src/lib/components/mock.form-field-message.component.ts +21 -0
- package/testing-base/src/lib/components/mock.form-field.component.ts +23 -0
- package/testing-base/src/lib/components/mock.grid.component.ts +21 -0
- package/testing-base/src/lib/components/mock.icon.component.ts +22 -0
- package/testing-base/src/lib/components/mock.input-counter.component.ts +24 -0
- package/testing-base/src/lib/components/mock.input.component.ts +29 -0
- package/testing-base/src/lib/components/mock.item-group.component.ts +18 -0
- package/testing-base/src/lib/components/mock.item-sliding.component.ts +21 -0
- package/testing-base/src/lib/components/mock.item.component.ts +24 -0
- package/testing-base/src/lib/components/mock.label.component.ts +20 -0
- package/testing-base/src/lib/components/mock.list-experimental.component.ts +18 -0
- package/testing-base/src/lib/components/mock.list-header.component.ts +18 -0
- package/testing-base/src/lib/components/mock.list-item.component.ts +33 -0
- package/testing-base/src/lib/components/mock.list-section-header.component.ts +20 -0
- package/testing-base/src/lib/components/mock.list.component.ts +39 -0
- package/testing-base/src/lib/components/mock.loading-overlay.component.ts +21 -0
- package/testing-base/src/lib/components/mock.modal-footer.component.ts +21 -0
- package/testing-base/src/lib/components/mock.page-footer.component.ts +20 -0
- package/testing-base/src/lib/components/mock.page.component.ts +152 -0
- package/testing-base/src/lib/components/mock.popover.component.ts +22 -0
- package/testing-base/src/lib/components/mock.progress-circle.component.ts +22 -0
- package/testing-base/src/lib/components/mock.radio-group.component.ts +27 -0
- package/testing-base/src/lib/components/mock.radio.component.ts +23 -0
- package/testing-base/src/lib/components/mock.range.component.ts +35 -0
- package/testing-base/src/lib/components/mock.reorder-list.component.ts +25 -0
- package/testing-base/src/lib/components/mock.router-outlet.component.ts +20 -0
- package/testing-base/src/lib/components/mock.section-header.component.ts +18 -0
- package/testing-base/src/lib/components/mock.segmented-control.component.ts +29 -0
- package/testing-base/src/lib/components/mock.slide-button.component.ts +23 -0
- package/testing-base/src/lib/components/mock.slides.component.ts +29 -0
- package/testing-base/src/lib/components/mock.spinner.component.ts +18 -0
- package/testing-base/src/lib/components/mock.tab-button.component.ts +21 -0
- package/testing-base/src/lib/components/mock.tabs.component.ts +18 -0
- package/testing-base/src/lib/components/mock.textarea.component.ts +26 -0
- package/testing-base/src/lib/components/mock.toggle-button.component.ts +21 -0
- package/testing-base/src/lib/components/mock.toggle.component.ts +22 -0
- package/testing-base/src/lib/components/mock.web-component-proxies.component.ts +32 -0
- package/testing-base/src/lib/directives/index.ts +3 -0
- package/testing-base/src/lib/directives/mock.accordion.directive.ts +15 -0
- package/testing-base/src/lib/directives/mock.fit-heading.directive.ts +19 -0
- package/testing-base/src/lib/directives/mock.theme-color.directive.ts +19 -0
- package/testing-base/src/lib/index.ts +4 -0
- package/testing-base/src/lib/kirby-testing-base.module.ts +10 -0
- package/testing-base/src/lib/mock-components.ts +133 -0
- package/testing-base/src/lib/mock-directives.ts +9 -0
- package/testing-base/src/public_api.ts +1 -0
- package/testing-base/src/tsconfig.json +9 -0
- package/testing-jasmine/ng-package.json +3 -0
- package/testing-jasmine/src/lib/kirby-testing.module.ts +14 -0
- package/testing-jasmine/src/lib/mock-providers.ts +68 -0
- package/testing-jasmine/src/public_api.ts +1 -0
- package/testing-jasmine/src/tsconfig.json +10 -0
- package/testing-jest/ng-package.json +3 -0
- package/testing-jest/src/lib/kirby-testing.module.ts +14 -0
- package/testing-jest/src/lib/mock-providers.ts +76 -0
- package/testing-jest/src/public_api.ts +1 -0
- package/testing-jest/src/tsconfig.json +10 -0
- package/tsconfig.json +17 -0
- package/tsconfig.lib.json +23 -0
- package/tsconfig.spec.json +9 -0
- package/tslint.json +10 -0
|
@@ -0,0 +1,828 @@
|
|
|
1
|
+
import { Component, ElementRef, OnInit, Optional, ViewChild } from '@angular/core';
|
|
2
|
+
import { RouterTestingModule } from '@angular/router/testing';
|
|
3
|
+
import { ModalController as IonicModalController } from '@ionic/angular';
|
|
4
|
+
import { createServiceFactory, SpectatorService } from '@ngneat/spectator';
|
|
5
|
+
import { MockComponents } from 'ng-mocks';
|
|
6
|
+
|
|
7
|
+
import { DesignTokenHelper } from '@kirbydesign/core';
|
|
8
|
+
|
|
9
|
+
import { ScreenSize, TestHelper } from '../../../testing/test-helper';
|
|
10
|
+
import { WindowRef } from '../../../types/window-ref';
|
|
11
|
+
import { ButtonComponent } from '../../button/button.component';
|
|
12
|
+
import { IconComponent } from '../../icon';
|
|
13
|
+
import { PageProgressComponent, PageTitleComponent } from '../../page/page.component';
|
|
14
|
+
import { ModalFooterComponent } from '../footer/modal-footer.component';
|
|
15
|
+
import { ModalCompactWrapperComponent } from '../modal-wrapper/compact/modal-compact-wrapper.component';
|
|
16
|
+
import { ModalConfig, ModalFlavor, ModalSize } from '../modal-wrapper/config/modal-config';
|
|
17
|
+
import { ModalWrapperComponent } from '../modal-wrapper/modal-wrapper.component';
|
|
18
|
+
|
|
19
|
+
import { ModalNavigationService } from './modal-navigation.service';
|
|
20
|
+
import { ModalHelper } from './modal.helper';
|
|
21
|
+
import { Modal, Overlay } from './modal.interfaces';
|
|
22
|
+
|
|
23
|
+
@Component({
|
|
24
|
+
template: `
|
|
25
|
+
<h2>Embedded Input</h2>
|
|
26
|
+
<input #input />
|
|
27
|
+
`,
|
|
28
|
+
})
|
|
29
|
+
class InputEmbeddedComponent implements OnInit {
|
|
30
|
+
@ViewChild('input', { static: true, read: ElementRef })
|
|
31
|
+
input: ElementRef;
|
|
32
|
+
|
|
33
|
+
constructor(@Optional() private modal?: Modal) {}
|
|
34
|
+
|
|
35
|
+
ngOnInit() {
|
|
36
|
+
this.modal && this.modal.didPresent.then(() => this.input.nativeElement.focus());
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@Component({
|
|
41
|
+
template: `
|
|
42
|
+
<div [style.height.px]="height">Content</div>
|
|
43
|
+
<kirby-modal-footer>
|
|
44
|
+
<button kirby-button>Button inside footer</button>
|
|
45
|
+
</kirby-modal-footer>
|
|
46
|
+
`,
|
|
47
|
+
})
|
|
48
|
+
class ContentOverflowsWithFooterEmbeddedComponent {
|
|
49
|
+
height: number = window.innerHeight;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@Component({
|
|
53
|
+
template: ` <div style="height: 1px;">Content</div> `,
|
|
54
|
+
})
|
|
55
|
+
class ContentWithNoOverflowEmbeddedComponent {}
|
|
56
|
+
|
|
57
|
+
@Component({
|
|
58
|
+
template: `
|
|
59
|
+
<kirby-page-progress>
|
|
60
|
+
<div style="height: 50px; width: 50px; border: 1px solid red;"></div>
|
|
61
|
+
</kirby-page-progress>
|
|
62
|
+
<kirby-page-title>Modal With Page Progress</kirby-page-title>
|
|
63
|
+
`,
|
|
64
|
+
})
|
|
65
|
+
class PageProgressEmbeddedComponent {}
|
|
66
|
+
|
|
67
|
+
describe('ModalHelper', () => {
|
|
68
|
+
let spectator: SpectatorService<ModalHelper>;
|
|
69
|
+
let modalHelper: ModalHelper;
|
|
70
|
+
let ionModalController: IonicModalController;
|
|
71
|
+
let overlay: Overlay;
|
|
72
|
+
let ionModal: HTMLIonModalElement;
|
|
73
|
+
let ionBackdrop: HTMLIonBackdropElement;
|
|
74
|
+
let modalShadow: HTMLElement;
|
|
75
|
+
let ionModalWrapper: HTMLElement;
|
|
76
|
+
let dummyPresentingElement: HTMLElement;
|
|
77
|
+
|
|
78
|
+
const defaultBackdropOpacity = '0.4';
|
|
79
|
+
const invisibleBackdropOpacity = '0.01';
|
|
80
|
+
const defaultBorderRadius = DesignTokenHelper.borderRadius();
|
|
81
|
+
const size = DesignTokenHelper.size;
|
|
82
|
+
const backgroundColor = DesignTokenHelper.backgroundColor();
|
|
83
|
+
const modalPaddingTopPx = size('xl');
|
|
84
|
+
const modalPaddingTop = parseInt(modalPaddingTopPx);
|
|
85
|
+
const modalHeaderHeight = 46;
|
|
86
|
+
|
|
87
|
+
const createService = createServiceFactory({
|
|
88
|
+
service: ModalHelper,
|
|
89
|
+
imports: [TestHelper.ionicModuleForTest, RouterTestingModule],
|
|
90
|
+
providers: [
|
|
91
|
+
{
|
|
92
|
+
provide: WindowRef,
|
|
93
|
+
useValue: <WindowRef>{ nativeWindow: window },
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
declarations: [
|
|
97
|
+
ButtonComponent,
|
|
98
|
+
ModalFooterComponent,
|
|
99
|
+
ModalWrapperComponent,
|
|
100
|
+
ModalCompactWrapperComponent,
|
|
101
|
+
PageTitleComponent,
|
|
102
|
+
MockComponents(IconComponent, PageProgressComponent),
|
|
103
|
+
],
|
|
104
|
+
entryComponents: [
|
|
105
|
+
InputEmbeddedComponent,
|
|
106
|
+
ContentOverflowsWithFooterEmbeddedComponent,
|
|
107
|
+
ContentWithNoOverflowEmbeddedComponent,
|
|
108
|
+
],
|
|
109
|
+
mocks: [ModalNavigationService],
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
beforeAll(() => {
|
|
113
|
+
dummyPresentingElement = window.document.createElement('div');
|
|
114
|
+
dummyPresentingElement.innerHTML = '<h1>Dummy Presenting Element</h1>';
|
|
115
|
+
dummyPresentingElement.style.position = 'absolute';
|
|
116
|
+
dummyPresentingElement.style.top = '0px';
|
|
117
|
+
dummyPresentingElement.style.right = '0px';
|
|
118
|
+
dummyPresentingElement.style.bottom = '0px';
|
|
119
|
+
dummyPresentingElement.style.left = '0px';
|
|
120
|
+
dummyPresentingElement.style.backgroundColor = DesignTokenHelper.backgroundColor();
|
|
121
|
+
window.document.body.append(dummyPresentingElement);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
afterAll(() => {
|
|
125
|
+
dummyPresentingElement.remove();
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
beforeEach(() => {
|
|
129
|
+
spectator = createService();
|
|
130
|
+
modalHelper = spectator.service;
|
|
131
|
+
ionModalController = spectator.inject(IonicModalController);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
const openOverlay = async (config: ModalConfig) => {
|
|
135
|
+
overlay = await modalHelper.showModalWindow(config);
|
|
136
|
+
ionModal = await ionModalController.getTop();
|
|
137
|
+
expect(ionModal).toBeTruthy();
|
|
138
|
+
ionModalWrapper = ionModal.querySelector(':scope > .modal-wrapper');
|
|
139
|
+
expect(ionModalWrapper).toBeTruthy();
|
|
140
|
+
ionBackdrop = ionModal.querySelector(':scope > ion-backdrop');
|
|
141
|
+
expect(ionBackdrop).toBeTruthy();
|
|
142
|
+
modalShadow = ionModal.querySelector<HTMLElement>(':scope > .modal-shadow');
|
|
143
|
+
expect(modalShadow).toBeTruthy();
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const openModal = async (component?: any, size?: ModalSize) => {
|
|
147
|
+
await openOverlay({ flavor: 'modal', component, size });
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const openDrawer = async (
|
|
151
|
+
title?: string,
|
|
152
|
+
component?: any,
|
|
153
|
+
size?: ModalSize,
|
|
154
|
+
interactWithBackground?: boolean
|
|
155
|
+
) => {
|
|
156
|
+
await openOverlay({ flavor: 'drawer', component, size, interactWithBackground });
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const expectShadowStyle = () => {
|
|
160
|
+
it('should not show shadow', () => {
|
|
161
|
+
expect(modalShadow).toHaveComputedStyle({ display: 'none' });
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const expectBackdropStyle = () => {
|
|
166
|
+
it('should have correct backdrop style', () => {
|
|
167
|
+
expect(ionBackdrop).toHaveComputedStyle({ opacity: defaultBackdropOpacity });
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
const expectModalWrapperStyle = (screenSize?: ScreenSize) => {
|
|
172
|
+
it('wrapper should have correct style', () => {
|
|
173
|
+
const expectedRadius = screenSize === 'phone' ? '0px' : defaultBorderRadius;
|
|
174
|
+
expect(ionModalWrapper).toHaveComputedStyle({
|
|
175
|
+
'background-color': backgroundColor,
|
|
176
|
+
'border-radius': expectedRadius,
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const expectDrawerWrapperStyle = () => {
|
|
182
|
+
it('wrapper should have correct style', () => {
|
|
183
|
+
expect(ionModalWrapper).toHaveComputedStyle({
|
|
184
|
+
'background-color': backgroundColor,
|
|
185
|
+
'border-radius': `${defaultBorderRadius} ${defaultBorderRadius} 0px 0px`,
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
describe('showModalWindow', () => {
|
|
191
|
+
const screenSizes: ScreenSize[] = ['phablet-landscape', 'tablet', 'desktop'];
|
|
192
|
+
const allow_scroll_class = 'allow-background-scroll';
|
|
193
|
+
|
|
194
|
+
screenSizes.forEach((screenSize) => {
|
|
195
|
+
describe(`on ${screenSize}`, () => {
|
|
196
|
+
beforeAll(async () => {
|
|
197
|
+
await TestHelper.resizeTestWindow(TestHelper.screensize[screenSize]);
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
afterAll(() => {
|
|
201
|
+
TestHelper.resetTestWindow();
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
describe(`when opened on presenting element`, () => {
|
|
205
|
+
beforeEach(() => {
|
|
206
|
+
modalHelper.registerPresentingElement(dummyPresentingElement);
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
afterEach(() => {
|
|
210
|
+
modalHelper.registerPresentingElement(undefined);
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
describe(`modal`, () => {
|
|
214
|
+
beforeEach(async () => {
|
|
215
|
+
await openModal();
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
afterEach(async () => {
|
|
219
|
+
await overlay.dismiss();
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
expectShadowStyle();
|
|
223
|
+
expectBackdropStyle();
|
|
224
|
+
expectModalWrapperStyle();
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
describe(`drawer`, () => {
|
|
228
|
+
beforeEach(async () => {
|
|
229
|
+
await openDrawer('Drawer On Presenting Element');
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
afterEach(async () => {
|
|
233
|
+
await overlay.dismiss();
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
expectShadowStyle();
|
|
237
|
+
expectBackdropStyle();
|
|
238
|
+
expectDrawerWrapperStyle();
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
describe(`When drawer can interact with background`, () => {
|
|
243
|
+
beforeEach(async () => {
|
|
244
|
+
await openDrawer('Drawer with interact with background', null, null, true);
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
it(`body should be scrollable`, async () => {
|
|
248
|
+
expect(window.document.body.classList).toContain(allow_scroll_class);
|
|
249
|
+
expect(window.document.body).toHaveComputedStyle({
|
|
250
|
+
overflow: 'visible',
|
|
251
|
+
});
|
|
252
|
+
await overlay.dismiss();
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
it(`Drawer close should remove '${allow_scroll_class}'`, async () => {
|
|
256
|
+
await overlay.dismiss();
|
|
257
|
+
expect(window.document.body.classList).not.toContain(allow_scroll_class);
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
describe(`When drawer can not interact with background`, () => {
|
|
262
|
+
beforeEach(async () => {
|
|
263
|
+
await openDrawer('Drawer with no interact with background', null, null, false);
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
afterEach(async () => {
|
|
267
|
+
await overlay.dismiss();
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
it(`body should not be scrollable`, () => {
|
|
271
|
+
expect(window.document.body.classList).not.toContain(allow_scroll_class);
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
describe('sizing', () => {
|
|
276
|
+
beforeEach(() => {
|
|
277
|
+
TestHelper.scrollMainWindowToTop();
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
afterEach(async () => {
|
|
281
|
+
await overlay.dismiss();
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
const expectSize = (size: ModalSize | undefined) => {
|
|
285
|
+
expect(ionModal.classList.contains('kirby-modal-small')).toBe(size === 'small');
|
|
286
|
+
expect(ionModal.classList.contains('kirby-modal-medium')).toBe(size === 'medium');
|
|
287
|
+
expect(ionModal.classList.contains('kirby-modal-large')).toBe(size === 'large');
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
it('modal should have min-height', async () => {
|
|
291
|
+
await openModal();
|
|
292
|
+
|
|
293
|
+
expect(ionModalWrapper).toHaveComputedStyle({
|
|
294
|
+
'--min-height': DesignTokenHelper.modalDefaultHeight,
|
|
295
|
+
});
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
it('drawer should have min-height', async () => {
|
|
299
|
+
await openDrawer();
|
|
300
|
+
|
|
301
|
+
expect(ionModalWrapper).toHaveComputedStyle({
|
|
302
|
+
'--min-height': DesignTokenHelper.drawerDefaultHeight,
|
|
303
|
+
});
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
it('modal should be default sized (medium), if size is not provided', async () => {
|
|
307
|
+
await openModal();
|
|
308
|
+
|
|
309
|
+
expectSize('medium');
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
it('modal should be sized `small`', async () => {
|
|
313
|
+
await openModal(undefined, 'small');
|
|
314
|
+
|
|
315
|
+
expectSize('small');
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
it('modal should be sized `medium`', async () => {
|
|
319
|
+
await openModal(undefined, 'medium');
|
|
320
|
+
|
|
321
|
+
expectSize('medium');
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
it('modal should be sized `large`', async () => {
|
|
325
|
+
await openModal(undefined, 'large');
|
|
326
|
+
|
|
327
|
+
expectSize('large');
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
it('modal should be sized `full-height`', async () => {
|
|
331
|
+
await openModal(undefined, 'full-height');
|
|
332
|
+
|
|
333
|
+
expectSize('full-height');
|
|
334
|
+
const expectedHeight = window.innerHeight - modalPaddingTop;
|
|
335
|
+
expect(ionModalWrapper).toHaveComputedStyle({ '--height': '100%' });
|
|
336
|
+
expect(ionModalWrapper).toHaveComputedStyle({ height: `${expectedHeight}px` });
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
it('drawer should be sized `full-height`', async () => {
|
|
340
|
+
await openDrawer('Full-height Drawer', undefined, 'full-height');
|
|
341
|
+
|
|
342
|
+
expectSize('full-height');
|
|
343
|
+
const drawerPaddingTop = modalPaddingTop + modalHeaderHeight / 2;
|
|
344
|
+
const expectedHeight = window.innerHeight - drawerPaddingTop;
|
|
345
|
+
expect(ionModalWrapper).toHaveComputedStyle({ '--height': '100%' });
|
|
346
|
+
expect(ionModalWrapper).toHaveComputedStyle({ height: `${expectedHeight}px` });
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
it('should not set default size class if flavor is `drawer`', async () => {
|
|
350
|
+
await openDrawer();
|
|
351
|
+
|
|
352
|
+
expectSize(undefined);
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
it("should add class `full-height`, if content can't fit in viewport", async () => {
|
|
356
|
+
await openDrawer('Modal with full height', ContentOverflowsWithFooterEmbeddedComponent);
|
|
357
|
+
await TestHelper.waitForResizeObserver();
|
|
358
|
+
|
|
359
|
+
expect(ionModalWrapper.classList.contains('full-height')).toBeTrue();
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
it('should NOT add class `full-height`, if content can fit in viewport', async () => {
|
|
363
|
+
await openModal(ContentWithNoOverflowEmbeddedComponent);
|
|
364
|
+
await TestHelper.waitForResizeObserver();
|
|
365
|
+
|
|
366
|
+
expect(ionModalWrapper.classList.contains('full-height')).toBeFalse();
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
it('should have footer visible at the bottom of viewport, when full-height', async () => {
|
|
370
|
+
await openModal(ContentOverflowsWithFooterEmbeddedComponent);
|
|
371
|
+
const footer = ionModal.querySelector('kirby-modal-footer');
|
|
372
|
+
expect(footer).toBeTruthy();
|
|
373
|
+
await TestHelper.waitForResizeObserver();
|
|
374
|
+
|
|
375
|
+
expect(ionModalWrapper.classList.contains('full-height')).toBeTrue();
|
|
376
|
+
expect(footer.getBoundingClientRect().bottom).toEqual(window.innerHeight);
|
|
377
|
+
});
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
describe(`with default flavor ('modal')`, () => {
|
|
381
|
+
beforeEach(async () => {
|
|
382
|
+
await openModal(InputEmbeddedComponent);
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
afterEach(async () => {
|
|
386
|
+
await overlay.dismiss();
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
expectShadowStyle();
|
|
390
|
+
expectBackdropStyle();
|
|
391
|
+
expectModalWrapperStyle();
|
|
392
|
+
|
|
393
|
+
it('modal should have correct padding-top', () => {
|
|
394
|
+
expect(ionModal).toHaveComputedStyle({ 'padding-top': modalPaddingTopPx });
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
it('modal window should not take focus from embedded input after opening', async () => {
|
|
398
|
+
const ionContent = ionModal.querySelector<HTMLElement>('ion-content');
|
|
399
|
+
await TestHelper.whenReady(ionContent);
|
|
400
|
+
|
|
401
|
+
const input: HTMLInputElement = ionContent.querySelector<HTMLInputElement>('input');
|
|
402
|
+
expect(input).withContext('Input is not defined').toEqual(jasmine.anything());
|
|
403
|
+
expect(document.activeElement).toEqual(input);
|
|
404
|
+
});
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
describe(`with 'drawer' flavor`, () => {
|
|
408
|
+
beforeEach(async () => {
|
|
409
|
+
await openDrawer();
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
afterEach(async () => {
|
|
413
|
+
await overlay.dismiss();
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
expectShadowStyle();
|
|
417
|
+
expectBackdropStyle();
|
|
418
|
+
expectDrawerWrapperStyle();
|
|
419
|
+
|
|
420
|
+
it('modal should have correct padding-top', () => {
|
|
421
|
+
expect(ionModal).toHaveComputedStyle({
|
|
422
|
+
'padding-top': `${modalPaddingTop + modalHeaderHeight / 2}px`,
|
|
423
|
+
});
|
|
424
|
+
});
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
describe(`with 'compact' flavor`, () => {
|
|
428
|
+
beforeEach(async () => {
|
|
429
|
+
await openOverlay({
|
|
430
|
+
flavor: 'compact',
|
|
431
|
+
component: undefined,
|
|
432
|
+
});
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
afterEach(async () => {
|
|
436
|
+
await overlay.dismiss();
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
expectShadowStyle();
|
|
440
|
+
expectBackdropStyle();
|
|
441
|
+
|
|
442
|
+
it('wrapper should have correct style', () => {
|
|
443
|
+
expect(ionModalWrapper).toHaveComputedStyle({
|
|
444
|
+
'background-color': backgroundColor,
|
|
445
|
+
'border-radius': defaultBorderRadius,
|
|
446
|
+
'max-width': DesignTokenHelper.compactModalMaxWidth(),
|
|
447
|
+
'text-align': 'center',
|
|
448
|
+
});
|
|
449
|
+
expect(ionModalWrapper.style.height).toEqual('');
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
it('modal should have correct padding-top', () => {
|
|
453
|
+
expect(ionModal).toHaveComputedStyle({ 'padding-top': '0px' });
|
|
454
|
+
});
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
describe(`when modal is opened on top of another modal`, () => {
|
|
458
|
+
const modalFlavors: ModalFlavor[] = ['modal', 'drawer', 'compact'];
|
|
459
|
+
modalFlavors.forEach((firstFlavor) => {
|
|
460
|
+
describe(`when first modal has '${firstFlavor}' flavor`, () => {
|
|
461
|
+
beforeEach(async () => {
|
|
462
|
+
await openOverlay({
|
|
463
|
+
flavor: firstFlavor,
|
|
464
|
+
component: undefined,
|
|
465
|
+
});
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
afterEach(async () => {
|
|
469
|
+
await overlay.dismiss();
|
|
470
|
+
});
|
|
471
|
+
|
|
472
|
+
modalFlavors.forEach((secondFlavor) => {
|
|
473
|
+
describe(`and second modal has '${secondFlavor}' flavor`, () => {
|
|
474
|
+
let secondOverlay: Overlay;
|
|
475
|
+
let secondBackdrop: HTMLIonBackdropElement;
|
|
476
|
+
beforeEach(async () => {
|
|
477
|
+
secondOverlay = await modalHelper.showModalWindow({
|
|
478
|
+
flavor: secondFlavor,
|
|
479
|
+
component: undefined,
|
|
480
|
+
});
|
|
481
|
+
const secondIonModal = await ionModalController.getTop();
|
|
482
|
+
expect(secondIonModal).toBeTruthy();
|
|
483
|
+
secondBackdrop = secondIonModal.querySelector(':scope > ion-backdrop');
|
|
484
|
+
expect(secondBackdrop).toBeTruthy();
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
afterEach(async () => {
|
|
488
|
+
await secondOverlay.dismiss();
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
it(`first modal should have no visible backdrop`, () => {
|
|
492
|
+
expect(ionBackdrop).toHaveComputedStyle({ opacity: invisibleBackdropOpacity });
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
it(`second modal should have should have correct backdrop style`, () => {
|
|
496
|
+
expect(secondBackdrop).toHaveComputedStyle({ opacity: defaultBackdropOpacity });
|
|
497
|
+
});
|
|
498
|
+
});
|
|
499
|
+
});
|
|
500
|
+
});
|
|
501
|
+
});
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
describe('title', () => {
|
|
505
|
+
let ionToolbarElement: HTMLIonToolbarElement;
|
|
506
|
+
let pageTitleElement: HTMLDivElement;
|
|
507
|
+
let pageTitleVerticalCenter: number;
|
|
508
|
+
|
|
509
|
+
beforeEach(async () => {
|
|
510
|
+
await openModal(PageProgressEmbeddedComponent);
|
|
511
|
+
ionToolbarElement = ionModalWrapper.querySelector('ion-toolbar');
|
|
512
|
+
pageTitleElement = ionToolbarElement.querySelector('kirby-page-title');
|
|
513
|
+
pageTitleVerticalCenter = getElementVerticalCenter(pageTitleElement);
|
|
514
|
+
});
|
|
515
|
+
|
|
516
|
+
afterEach(async () => {
|
|
517
|
+
await overlay.dismiss();
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
it('should align vertically with close button', () => {
|
|
521
|
+
const closeButtonElement = ionToolbarElement.querySelector('[kirby-button]');
|
|
522
|
+
const closeButtonVerticalCenter = getElementVerticalCenter(closeButtonElement);
|
|
523
|
+
|
|
524
|
+
expect(closeButtonVerticalCenter).toEqual(pageTitleVerticalCenter);
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
it('should align vertically with page progress', () => {
|
|
528
|
+
const pageProgressElement = ionToolbarElement.querySelector('kirby-page-progress');
|
|
529
|
+
const pageProgressVerticalCenter = getElementVerticalCenter(pageProgressElement);
|
|
530
|
+
|
|
531
|
+
expect(pageTitleVerticalCenter).toEqual(pageProgressVerticalCenter);
|
|
532
|
+
});
|
|
533
|
+
|
|
534
|
+
it('should have correct padding', () => {
|
|
535
|
+
const toolbarContainer =
|
|
536
|
+
ionToolbarElement.shadowRoot.querySelector('.toolbar-container');
|
|
537
|
+
const expectedPadding = size('s');
|
|
538
|
+
const expectedTopSpacingTotal = size('m');
|
|
539
|
+
const expectedAdditionalTopPadding =
|
|
540
|
+
parseInt(expectedTopSpacingTotal) - parseInt(expectedPadding);
|
|
541
|
+
|
|
542
|
+
expect(toolbarContainer).toHaveComputedStyle({
|
|
543
|
+
padding: expectedPadding,
|
|
544
|
+
});
|
|
545
|
+
expect(ionToolbarElement).toHaveComputedStyle({
|
|
546
|
+
'padding-top': `${expectedAdditionalTopPadding}px`,
|
|
547
|
+
});
|
|
548
|
+
});
|
|
549
|
+
});
|
|
550
|
+
});
|
|
551
|
+
});
|
|
552
|
+
|
|
553
|
+
describe('on small screens', () => {
|
|
554
|
+
beforeAll(async () => {
|
|
555
|
+
await TestHelper.resizeTestWindow(TestHelper.screensize.phone);
|
|
556
|
+
});
|
|
557
|
+
|
|
558
|
+
afterAll(() => {
|
|
559
|
+
TestHelper.resetTestWindow();
|
|
560
|
+
});
|
|
561
|
+
|
|
562
|
+
describe(`when opened on presenting element`, () => {
|
|
563
|
+
beforeEach(() => {
|
|
564
|
+
modalHelper.registerPresentingElement(dummyPresentingElement);
|
|
565
|
+
});
|
|
566
|
+
|
|
567
|
+
afterEach(() => {
|
|
568
|
+
modalHelper.registerPresentingElement(undefined);
|
|
569
|
+
});
|
|
570
|
+
|
|
571
|
+
it(`modal should have no visible backdrop`, async () => {
|
|
572
|
+
await openModal();
|
|
573
|
+
|
|
574
|
+
expect(ionBackdrop).toHaveComputedStyle({ opacity: invisibleBackdropOpacity });
|
|
575
|
+
await overlay.dismiss();
|
|
576
|
+
});
|
|
577
|
+
|
|
578
|
+
it('drawer should have correct backdrop style', async () => {
|
|
579
|
+
await openDrawer('Drawer On Presenting Element');
|
|
580
|
+
|
|
581
|
+
expect(ionBackdrop).toHaveComputedStyle({ opacity: defaultBackdropOpacity });
|
|
582
|
+
await overlay.dismiss();
|
|
583
|
+
});
|
|
584
|
+
|
|
585
|
+
describe('when iOS safe-area is present', () => {
|
|
586
|
+
const safeAreaTop = '20px';
|
|
587
|
+
|
|
588
|
+
beforeAll(() => {
|
|
589
|
+
window.document.documentElement.style.setProperty('--ion-safe-area-top', safeAreaTop);
|
|
590
|
+
});
|
|
591
|
+
|
|
592
|
+
afterAll(() => {
|
|
593
|
+
window.document.documentElement.style.removeProperty('--ion-safe-area-top');
|
|
594
|
+
});
|
|
595
|
+
|
|
596
|
+
it('modal toolbar should respect iOS safe-area', async () => {
|
|
597
|
+
await openModal();
|
|
598
|
+
|
|
599
|
+
const ionToolbar = ionModal.querySelector('ion-header > ion-toolbar');
|
|
600
|
+
expect(ionToolbar).toHaveComputedStyle({ 'padding-top': safeAreaTop });
|
|
601
|
+
await overlay.dismiss();
|
|
602
|
+
});
|
|
603
|
+
|
|
604
|
+
it('drawer should respect iOS safe-area', async () => {
|
|
605
|
+
await openDrawer('Drawer On Presenting Element');
|
|
606
|
+
|
|
607
|
+
const expectedPaddingTop = `${parseInt(size('m')) + parseInt(safeAreaTop)}px`;
|
|
608
|
+
expect(ionModal).toHaveComputedStyle({ 'padding-top': expectedPaddingTop });
|
|
609
|
+
await overlay.dismiss();
|
|
610
|
+
});
|
|
611
|
+
|
|
612
|
+
it('drawer toolbar should not have additional padding', async () => {
|
|
613
|
+
await openDrawer('Drawer On Presenting Element');
|
|
614
|
+
|
|
615
|
+
const ionToolbar = ionModal.querySelector('ion-header > ion-toolbar');
|
|
616
|
+
expect(ionToolbar).toHaveComputedStyle({ 'padding-top': '0px' });
|
|
617
|
+
await overlay.dismiss();
|
|
618
|
+
});
|
|
619
|
+
});
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
describe('sizing', () => {
|
|
623
|
+
afterEach(async () => {
|
|
624
|
+
await overlay.dismiss();
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
const expectSize = (size: ModalSize | undefined) => {
|
|
628
|
+
expect(ionModal.classList.contains('small')).toBe(size === 'small');
|
|
629
|
+
expect(ionModal.classList.contains('medium')).toBe(size === 'medium');
|
|
630
|
+
expect(ionModal.classList.contains('large')).toBe(size === 'large');
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
it('modal should be full height', async () => {
|
|
634
|
+
await openModal();
|
|
635
|
+
|
|
636
|
+
expect(ionModalWrapper).toHaveComputedStyle({
|
|
637
|
+
'--height': '100%',
|
|
638
|
+
});
|
|
639
|
+
});
|
|
640
|
+
|
|
641
|
+
it('drawer should have min-height', async () => {
|
|
642
|
+
await openDrawer();
|
|
643
|
+
|
|
644
|
+
expect(ionModalWrapper).toHaveComputedStyle({
|
|
645
|
+
'--min-height': DesignTokenHelper.drawerDefaultHeight,
|
|
646
|
+
});
|
|
647
|
+
});
|
|
648
|
+
|
|
649
|
+
it('drawer should be sized `full-height`', async () => {
|
|
650
|
+
await openDrawer('Full-height Drawer', undefined, 'full-height');
|
|
651
|
+
|
|
652
|
+
expectSize('full-height');
|
|
653
|
+
const drawerPaddingTop = parseInt(size('m'));
|
|
654
|
+
const expectedHeight = window.innerHeight - drawerPaddingTop;
|
|
655
|
+
expect(ionModalWrapper).toHaveComputedStyle({ '--height': '100%' });
|
|
656
|
+
expect(ionModalWrapper).toHaveComputedStyle({ height: `${expectedHeight}px` });
|
|
657
|
+
});
|
|
658
|
+
});
|
|
659
|
+
|
|
660
|
+
describe(`with default flavor ('modal')`, () => {
|
|
661
|
+
beforeEach(async () => {
|
|
662
|
+
await openModal();
|
|
663
|
+
});
|
|
664
|
+
|
|
665
|
+
afterEach(async () => {
|
|
666
|
+
await overlay.dismiss();
|
|
667
|
+
});
|
|
668
|
+
|
|
669
|
+
expectShadowStyle();
|
|
670
|
+
expectBackdropStyle();
|
|
671
|
+
expectModalWrapperStyle('phone');
|
|
672
|
+
});
|
|
673
|
+
|
|
674
|
+
describe(`with 'drawer' flavor`, () => {
|
|
675
|
+
beforeEach(async () => {
|
|
676
|
+
await openDrawer();
|
|
677
|
+
});
|
|
678
|
+
|
|
679
|
+
afterEach(async () => {
|
|
680
|
+
await overlay.dismiss();
|
|
681
|
+
});
|
|
682
|
+
|
|
683
|
+
expectShadowStyle();
|
|
684
|
+
expectBackdropStyle();
|
|
685
|
+
expectDrawerWrapperStyle();
|
|
686
|
+
|
|
687
|
+
it('drawer should have correct padding-top', () => {
|
|
688
|
+
expect(ionModal).toHaveComputedStyle({ 'padding-top': size('m') });
|
|
689
|
+
});
|
|
690
|
+
});
|
|
691
|
+
|
|
692
|
+
describe('when iOS safe-area is present', () => {
|
|
693
|
+
const safeAreaTop = '20px';
|
|
694
|
+
beforeAll(() => {
|
|
695
|
+
window.document.documentElement.style.setProperty('--ion-safe-area-top', safeAreaTop);
|
|
696
|
+
});
|
|
697
|
+
|
|
698
|
+
afterAll(() => {
|
|
699
|
+
window.document.documentElement.style.removeProperty('--ion-safe-area-top');
|
|
700
|
+
});
|
|
701
|
+
|
|
702
|
+
it('modal toolbar should respect iOS safe-area', async () => {
|
|
703
|
+
await openModal();
|
|
704
|
+
|
|
705
|
+
const ionToolbar = ionModal.querySelector('ion-header > ion-toolbar');
|
|
706
|
+
expect(ionToolbar).toHaveComputedStyle({ 'padding-top': safeAreaTop });
|
|
707
|
+
await overlay.dismiss();
|
|
708
|
+
});
|
|
709
|
+
|
|
710
|
+
it('drawer should respect iOS safe-area', async () => {
|
|
711
|
+
await openDrawer();
|
|
712
|
+
|
|
713
|
+
const expectedPaddingTop = `${parseInt(size('m')) + parseInt(safeAreaTop)}px`;
|
|
714
|
+
expect(ionModal).toHaveComputedStyle({ 'padding-top': expectedPaddingTop });
|
|
715
|
+
await overlay.dismiss();
|
|
716
|
+
});
|
|
717
|
+
|
|
718
|
+
it('drawer toolbar should not have additional padding', async () => {
|
|
719
|
+
await openDrawer();
|
|
720
|
+
|
|
721
|
+
const ionToolbar = ionModal.querySelector('ion-header > ion-toolbar');
|
|
722
|
+
expect(ionToolbar).toHaveComputedStyle({ 'padding-top': '0px' });
|
|
723
|
+
await overlay.dismiss();
|
|
724
|
+
});
|
|
725
|
+
});
|
|
726
|
+
|
|
727
|
+
describe(`when modal is opened on top of another modal`, () => {
|
|
728
|
+
const modalFlavors: ModalFlavor[] = ['modal', 'drawer', 'compact'];
|
|
729
|
+
modalFlavors.forEach((firstFlavor) => {
|
|
730
|
+
describe(`when first modal has '${firstFlavor}' flavor`, () => {
|
|
731
|
+
beforeEach(async () => {
|
|
732
|
+
await openOverlay({
|
|
733
|
+
flavor: firstFlavor,
|
|
734
|
+
component: undefined,
|
|
735
|
+
});
|
|
736
|
+
});
|
|
737
|
+
|
|
738
|
+
afterEach(async () => {
|
|
739
|
+
await overlay.dismiss();
|
|
740
|
+
});
|
|
741
|
+
|
|
742
|
+
modalFlavors.forEach((secondFlavor) => {
|
|
743
|
+
describe(`and second modal has '${secondFlavor}' flavor`, () => {
|
|
744
|
+
let secondOverlay: Overlay;
|
|
745
|
+
let secondBackdrop: HTMLIonBackdropElement;
|
|
746
|
+
beforeEach(async () => {
|
|
747
|
+
secondOverlay = await modalHelper.showModalWindow({
|
|
748
|
+
flavor: secondFlavor,
|
|
749
|
+
component: undefined,
|
|
750
|
+
});
|
|
751
|
+
const secondIonModal = await ionModalController.getTop();
|
|
752
|
+
expect(secondIonModal).toBeTruthy();
|
|
753
|
+
secondBackdrop = secondIonModal.querySelector(':scope > ion-backdrop');
|
|
754
|
+
expect(secondBackdrop).toBeTruthy();
|
|
755
|
+
});
|
|
756
|
+
|
|
757
|
+
afterEach(async () => {
|
|
758
|
+
await secondOverlay.dismiss();
|
|
759
|
+
});
|
|
760
|
+
|
|
761
|
+
if (firstFlavor === 'drawer') {
|
|
762
|
+
it(`first drawer should have no visible backdrop`, () => {
|
|
763
|
+
expect(ionBackdrop).toHaveComputedStyle({ opacity: invisibleBackdropOpacity });
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
it(`second modal should have should have correct backdrop style`, () => {
|
|
768
|
+
let expectedBackdropOpacity = defaultBackdropOpacity;
|
|
769
|
+
if (firstFlavor === 'modal' && secondFlavor === 'modal') {
|
|
770
|
+
expectedBackdropOpacity = invisibleBackdropOpacity;
|
|
771
|
+
}
|
|
772
|
+
expect(secondBackdrop).toHaveComputedStyle({ opacity: expectedBackdropOpacity });
|
|
773
|
+
});
|
|
774
|
+
});
|
|
775
|
+
});
|
|
776
|
+
});
|
|
777
|
+
});
|
|
778
|
+
});
|
|
779
|
+
|
|
780
|
+
describe('title', () => {
|
|
781
|
+
let ionToolbarElement: HTMLIonToolbarElement;
|
|
782
|
+
let pageTitleElement: HTMLDivElement;
|
|
783
|
+
let pageTitleVerticalCenter: number;
|
|
784
|
+
|
|
785
|
+
beforeEach(async () => {
|
|
786
|
+
await openModal(PageProgressEmbeddedComponent);
|
|
787
|
+
ionToolbarElement = ionModalWrapper.querySelector('ion-toolbar');
|
|
788
|
+
pageTitleElement = ionToolbarElement.querySelector('kirby-page-title');
|
|
789
|
+
pageTitleVerticalCenter = getElementVerticalCenter(pageTitleElement);
|
|
790
|
+
});
|
|
791
|
+
|
|
792
|
+
afterEach(async () => {
|
|
793
|
+
await overlay.dismiss();
|
|
794
|
+
});
|
|
795
|
+
|
|
796
|
+
it('should align vertically with close button', () => {
|
|
797
|
+
const closeButtonElement = ionToolbarElement.querySelector('[kirby-button]');
|
|
798
|
+
const closeButtonVerticalCenter = getElementVerticalCenter(closeButtonElement);
|
|
799
|
+
|
|
800
|
+
expect(closeButtonVerticalCenter).toEqual(pageTitleVerticalCenter);
|
|
801
|
+
});
|
|
802
|
+
|
|
803
|
+
it('should align vertically with page progress', () => {
|
|
804
|
+
const pageProgressElement = ionToolbarElement.querySelector('kirby-page-progress');
|
|
805
|
+
const pageProgressVerticalCenter = getElementVerticalCenter(pageProgressElement);
|
|
806
|
+
|
|
807
|
+
expect(pageTitleVerticalCenter).toEqual(pageProgressVerticalCenter);
|
|
808
|
+
});
|
|
809
|
+
|
|
810
|
+
it('should have correct padding', () => {
|
|
811
|
+
const toolbarContainer = ionToolbarElement.shadowRoot.querySelector('.toolbar-container');
|
|
812
|
+
|
|
813
|
+
expect(toolbarContainer).toHaveComputedStyle({
|
|
814
|
+
padding: size('s'),
|
|
815
|
+
});
|
|
816
|
+
expect(ionToolbarElement).toHaveComputedStyle({
|
|
817
|
+
'padding-top': '0px',
|
|
818
|
+
});
|
|
819
|
+
});
|
|
820
|
+
});
|
|
821
|
+
});
|
|
822
|
+
});
|
|
823
|
+
});
|
|
824
|
+
|
|
825
|
+
function getElementVerticalCenter(element: Element): number {
|
|
826
|
+
const elementDOMRect = element.getBoundingClientRect();
|
|
827
|
+
return elementDOMRect.top + elementDOMRect.height / 2;
|
|
828
|
+
}
|