seb-oss / green

Green is an open-source design system built by SEB.
https://storybook.seb.io/
Apache License 2.0
37 stars 55 forks source link

Datepicker/Dropdown: Failing unit tests #1679

Closed gabrieledaugenaite closed 3 weeks ago

gabrieledaugenaite commented 1 month ago

Unit tests failing for components that contain NggDatepicker and/or NggDropdown

Bug already reported?

For which framework/library you are reporting the bug

Core, Angular

Component name

dropdown, datepicker

Description

There seems to be some issues while running unit tests for components that contain datepicker or dropdown within their templates. I am not sure if this used to be working before as we are only now introducing unit tests in our MFEs.

Error thrown in tests TypeError: (0 , chunk_5VURDMKE_js_1.__privateGet)(...).checkValidity is not a function at GdsDatepicker.set invalid (node_modules/@sebgroup/green-core/chunks/chunk.JIIVJ7QV.js:69:36) at GdsDatepicker.set [as invalid] (node_modules/@lit/reactive-element/reactive-element.js:6:1251) at NoneEncapsulationDomRenderer.setProperty (node_modules/@angular/platform-browser/fesm2022/platform-browser.mjs:640:16) at elementPropertyInternal (node_modules/@angular/core/fesm2022/core.mjs:12613:18) at ɵɵproperty (node_modules/@angular/core/fesm2022/core.mjs:22488:9) at _NggDatepickerComponent_gds_datepicker_1_Template (ng:\_NggDatepickerComponent\ɵcmp.js:21:65) at executeTemplate (node_modules/@angular/core/fesm2022/core.mjs:12165:9) at refreshView (node_modules/@angular/core/fesm2022/core.mjs:13783:13) at detectChangesInView (node_modules/@angular/core/fesm2022/core.mjs:13999:9) at detectChangesInViewIfAttached (node_modules/@angular/core/fesm2022/core.mjs:13959:5) at detectChangesInEmbeddedViews (node_modules/@angular/core/fesm2022/core.mjs:13918:13) at refreshView (node_modules/@angular/core/fesm2022/core.mjs:13811:9) at detectChangesInView (node_modules/@angular/core/fesm2022/core.mjs:13999:9) at detectChangesInViewWhileDirty (node_modules/@angular/core/fesm2022/core.mjs:13694:9) at detectChangesInternal (node_modules/@angular/core/fesm2022/core.mjs:13673:9) at ViewRef$1.detectChanges (node_modules/@angular/core/fesm2022/core.mjs:14303:9) at _NggDatepickerComponent.writeValue (node_modules/@sebgroup/green-angular/fesm2022/sebgroup-green-angular.mjs:417:19) at setUpControl (node_modules/@angular/forms/fesm2022/forms.mjs:3032:23) at _NgModel._setUpStandalone (node_modules/@angular/forms/fesm2022/forms.mjs:4136:9) at _NgModel._setUpControl (node_modules/@angular/forms/fesm2022/forms.mjs:4124:37) at _NgModel.ngOnChanges (node_modules/@angular/forms/fesm2022/forms.mjs:4083:18) at _NgModel.rememberChangeHistoryAndInvokeOnChangesHook (node_modules/@angular/core/fesm2022/core.mjs:4114:14) at callHookInternal (node_modules/@angular/core/fesm2022/core.mjs:5154:14) at callHook (node_modules/@angular/core/fesm2022/core.mjs:5185:9) at callHooks (node_modules/@angular/core/fesm2022/core.mjs:5135:17) at executeInitAndCheckHooks (node_modules/@angular/core/fesm2022/core.mjs:5085:9) at selectIndexInternal (node_modules/@angular/core/fesm2022/core.mjs:11918:17) at ɵɵadvance (node_modules/@angular/core/fesm2022/core.mjs:11901:5) at _DateInputComponent_Template (ng:\_DateInputComponent\ɵcmp.js:69:9) at executeTemplate (node_modules/@angular/core/fesm2022/core.mjs:12165:9) at refreshView (node_modules/@angular/core/fesm2022/core.mjs:13783:13) at detectChangesInView (node_modules/@angular/core/fesm2022/core.mjs:13999:9) at detectChangesInViewIfAttached (node_modules/@angular/core/fesm2022/core.mjs:13959:5) at detectChangesInComponent (node_modules/@angular/core/fesm2022/core.mjs:13948:5) at detectChangesInChildComponents (node_modules/@angular/core/fesm2022/core.mjs:14012:9) at refreshView (node_modules/@angular/core/fesm2022/core.mjs:13837:13) at detectChangesInView (node_modules/@angular/core/fesm2022/core.mjs:13999:9) at detectChangesInViewIfAttached (node_modules/@angular/core/fesm2022/core.mjs:13959:5) at detectChangesInEmbeddedViews (node_modules/@angular/core/fesm2022/core.mjs:13918:13) at refreshView (node_modules/@angular/core/fesm2022/core.mjs:13811:9) at detectChangesInView (node_modules/@angular/core/fesm2022/core.mjs:13999:9) at detectChangesInViewIfAttached (node_modules/@angular/core/fesm2022/core.mjs:13959:5) at detectChangesInEmbeddedViews (node_modules/@angular/core/fesm2022/core.mjs:13918:13) at refreshView (node_modules/@angular/core/fesm2022/core.mjs:13811:9) at detectChangesInView (node_modules/@angular/core/fesm2022/core.mjs:13999:9) at detectChangesInViewIfAttached (node_modules/@angular/core/fesm2022/core.mjs:13959:5) at detectChangesInComponent (node_modules/@angular/core/fesm2022/core.mjs:13948:5) at detectChangesInChildComponents (node_modules/@angular/core/fesm2022/core.mjs:14012:9) at refreshView (node_modules/@angular/core/fesm2022/core.mjs:13837:13) at detectChangesInView (node_modules/@angular/core/fesm2022/core.mjs:13999:9) at detectChangesInViewIfAttached (node_modules/@angular/core/fesm2022/core.mjs:13959:5) at detectChangesInEmbeddedViews (node_modules/@angular/core/fesm2022/core.mjs:13918:13) at refreshView (node_modules/@angular/core/fesm2022/core.mjs:13811:9) at detectChangesInView (node_modules/@angular/core/fesm2022/core.mjs:13999:9) at detectChangesInViewIfAttached (node_modules/@angular/core/fesm2022/core.mjs:13959:5) at detectChangesInComponent (node_modules/@angular/core/fesm2022/core.mjs:13948:5) at detectChangesInChildComponents (node_modules/@angular/core/fesm2022/core.mjs:14012:9) at refreshView (node_modules/@angular/core/fesm2022/core.mjs:13837:13) at detectChangesInView (node_modules/@angular/core/fesm2022/core.mjs:13999:9) at detectChangesInViewIfAttached (node_modules/@angular/core/fesm2022/core.mjs:13959:5) at detectChangesInComponent (node_modules/@angular/core/fesm2022/core.mjs:13948:5) at detectChangesInChildComponents (node_modules/@angular/core/fesm2022/core.mjs:14012:9) at refreshView (node_modules/@angular/core/fesm2022/core.mjs:13837:13) at detectChangesInView (node_modules/@angular/core/fesm2022/core.mjs:13999:9) at detectChangesInViewWhileDirty (node_modules/@angular/core/fesm2022/core.mjs:13694:9) at detectChangesInternal (node_modules/@angular/core/fesm2022/core.mjs:13673:9) at ViewRef$1.detectChanges (node_modules/@angular/core/fesm2022/core.mjs:14303:9) at node_modules/@angular/core/fesm2022/testing.mjs:362:36 at _ZoneDelegate.invoke (node_modules/zone.js/bundles/zone.umd.js:416:32) at Object.onInvoke (node_modules/@angular/core/fesm2022/core.mjs:7248:33) at _ZoneDelegate.invoke (node_modules/zone.js/bundles/zone.umd.js:415:38) at ZoneImpl.run (node_modules/zone.js/bundles/zone.umd.js:147:47) at NgZone.run (node_modules/@angular/core/fesm2022/core.mjs:7094:28) at PseudoApplicationComponentFixture.detectChanges (node_modules/@angular/core/fesm2022/testing.mjs:361:22)

This issue happens while following jest setup as per documentation in here and we are using Green Angular v4.6.3, Green Core v1.43.4 and Jest v29.7.0

Steps To Reproduce

No response

Current Behaviour

Currently all components that contain datepicker or dropdown component from Green have Jest unit tests failing. The error I get when running tests is below.

Error from tests TypeError: (0 , chunk_5VURDMKE_js_1.__privateGet)(...).checkValidity is not a function at GdsDatepicker.set invalid (node_modules/@sebgroup/green-core/chunks/chunk.JIIVJ7QV.js:69:36) at GdsDatepicker.set [as invalid] (node_modules/@lit/reactive-element/reactive-element.js:6:1251) at NoneEncapsulationDomRenderer.setProperty (node_modules/@angular/platform-browser/fesm2022/platform-browser.mjs:640:16) at elementPropertyInternal (node_modules/@angular/core/fesm2022/core.mjs:12613:18) at ɵɵproperty (node_modules/@angular/core/fesm2022/core.mjs:22488:9) at _NggDatepickerComponent_gds_datepicker_1_Template (ng:\_NggDatepickerComponent\ɵcmp.js:21:65) at executeTemplate (node_modules/@angular/core/fesm2022/core.mjs:12165:9) at refreshView (node_modules/@angular/core/fesm2022/core.mjs:13783:13) at detectChangesInView (node_modules/@angular/core/fesm2022/core.mjs:13999:9) at detectChangesInViewIfAttached (node_modules/@angular/core/fesm2022/core.mjs:13959:5) at detectChangesInEmbeddedViews (node_modules/@angular/core/fesm2022/core.mjs:13918:13) at refreshView (node_modules/@angular/core/fesm2022/core.mjs:13811:9) at detectChangesInView (node_modules/@angular/core/fesm2022/core.mjs:13999:9) at detectChangesInViewWhileDirty (node_modules/@angular/core/fesm2022/core.mjs:13694:9) at detectChangesInternal (node_modules/@angular/core/fesm2022/core.mjs:13673:9) at ViewRef$1.detectChanges (node_modules/@angular/core/fesm2022/core.mjs:14303:9) at _NggDatepickerComponent.writeValue (node_modules/@sebgroup/green-angular/fesm2022/sebgroup-green-angular.mjs:417:19) at setUpControl (node_modules/@angular/forms/fesm2022/forms.mjs:3032:23) at _NgModel._setUpStandalone (node_modules/@angular/forms/fesm2022/forms.mjs:4136:9) at _NgModel._setUpControl (node_modules/@angular/forms/fesm2022/forms.mjs:4124:37) at _NgModel.ngOnChanges (node_modules/@angular/forms/fesm2022/forms.mjs:4083:18) at _NgModel.rememberChangeHistoryAndInvokeOnChangesHook (node_modules/@angular/core/fesm2022/core.mjs:4114:14) at callHookInternal (node_modules/@angular/core/fesm2022/core.mjs:5154:14) at callHook (node_modules/@angular/core/fesm2022/core.mjs:5185:9) at callHooks (node_modules/@angular/core/fesm2022/core.mjs:5135:17) at executeInitAndCheckHooks (node_modules/@angular/core/fesm2022/core.mjs:5085:9) at selectIndexInternal (node_modules/@angular/core/fesm2022/core.mjs:11918:17) at ɵɵadvance (node_modules/@angular/core/fesm2022/core.mjs:11901:5) at _DateInputComponent_Template (ng:\_DateInputComponent\ɵcmp.js:69:9) at executeTemplate (node_modules/@angular/core/fesm2022/core.mjs:12165:9) at refreshView (node_modules/@angular/core/fesm2022/core.mjs:13783:13) at detectChangesInView (node_modules/@angular/core/fesm2022/core.mjs:13999:9) at detectChangesInViewIfAttached (node_modules/@angular/core/fesm2022/core.mjs:13959:5) at detectChangesInComponent (node_modules/@angular/core/fesm2022/core.mjs:13948:5) at detectChangesInChildComponents (node_modules/@angular/core/fesm2022/core.mjs:14012:9) at refreshView (node_modules/@angular/core/fesm2022/core.mjs:13837:13) at detectChangesInView (node_modules/@angular/core/fesm2022/core.mjs:13999:9) at detectChangesInViewIfAttached (node_modules/@angular/core/fesm2022/core.mjs:13959:5) at detectChangesInEmbeddedViews (node_modules/@angular/core/fesm2022/core.mjs:13918:13) at refreshView (node_modules/@angular/core/fesm2022/core.mjs:13811:9) at detectChangesInView (node_modules/@angular/core/fesm2022/core.mjs:13999:9) at detectChangesInViewIfAttached (node_modules/@angular/core/fesm2022/core.mjs:13959:5) at detectChangesInEmbeddedViews (node_modules/@angular/core/fesm2022/core.mjs:13918:13) at refreshView (node_modules/@angular/core/fesm2022/core.mjs:13811:9) at detectChangesInView (node_modules/@angular/core/fesm2022/core.mjs:13999:9) at detectChangesInViewIfAttached (node_modules/@angular/core/fesm2022/core.mjs:13959:5) at detectChangesInComponent (node_modules/@angular/core/fesm2022/core.mjs:13948:5) at detectChangesInChildComponents (node_modules/@angular/core/fesm2022/core.mjs:14012:9) at refreshView (node_modules/@angular/core/fesm2022/core.mjs:13837:13) at detectChangesInView (node_modules/@angular/core/fesm2022/core.mjs:13999:9) at detectChangesInViewIfAttached (node_modules/@angular/core/fesm2022/core.mjs:13959:5) at detectChangesInEmbeddedViews (node_modules/@angular/core/fesm2022/core.mjs:13918:13) at refreshView (node_modules/@angular/core/fesm2022/core.mjs:13811:9) at detectChangesInView (node_modules/@angular/core/fesm2022/core.mjs:13999:9) at detectChangesInViewIfAttached (node_modules/@angular/core/fesm2022/core.mjs:13959:5) at detectChangesInComponent (node_modules/@angular/core/fesm2022/core.mjs:13948:5) at detectChangesInChildComponents (node_modules/@angular/core/fesm2022/core.mjs:14012:9) at refreshView (node_modules/@angular/core/fesm2022/core.mjs:13837:13) at detectChangesInView (node_modules/@angular/core/fesm2022/core.mjs:13999:9) at detectChangesInViewIfAttached (node_modules/@angular/core/fesm2022/core.mjs:13959:5) at detectChangesInComponent (node_modules/@angular/core/fesm2022/core.mjs:13948:5) at detectChangesInChildComponents (node_modules/@angular/core/fesm2022/core.mjs:14012:9) at refreshView (node_modules/@angular/core/fesm2022/core.mjs:13837:13) at detectChangesInView (node_modules/@angular/core/fesm2022/core.mjs:13999:9) at detectChangesInViewWhileDirty (node_modules/@angular/core/fesm2022/core.mjs:13694:9) at detectChangesInternal (node_modules/@angular/core/fesm2022/core.mjs:13673:9) at ViewRef$1.detectChanges (node_modules/@angular/core/fesm2022/core.mjs:14303:9) at node_modules/@angular/core/fesm2022/testing.mjs:362:36 at _ZoneDelegate.invoke (node_modules/zone.js/bundles/zone.umd.js:416:32) at Object.onInvoke (node_modules/@angular/core/fesm2022/core.mjs:7248:33) at _ZoneDelegate.invoke (node_modules/zone.js/bundles/zone.umd.js:415:38) at ZoneImpl.run (node_modules/zone.js/bundles/zone.umd.js:147:47) at NgZone.run (node_modules/@angular/core/fesm2022/core.mjs:7094:28) at PseudoApplicationComponentFixture.detectChanges (node_modules/@angular/core/fesm2022/testing.mjs:361:22)

Expected Behaviour

Tests should not be failing