goetzrobin / spartan

Cutting-edge tools powering Angular full-stack development.
https://spartan.ng
MIT License
1.09k stars 120 forks source link

fix: select form control status dirtied on initial value and patchValue #278

Closed thatsamsonkid closed 1 month ago

thatsamsonkid commented 2 months ago

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

Currently just adds more test related to select's form control

Which package are you modifying?

What is the current behavior?

Closes #224

What is the new behavior?

Does this PR introduce a breaking change?

Other information

thatsamsonkid commented 1 month ago

Alright finally hopefully resolving this, keep me honest here i'm pretty sure this make sense. I've been spending some time in the material repo and playing around with mat-select component. I have below stackblitz for the material one if in case you guys find it helpful

https://stackblitz.com/edit/iwefen?file=src%2Fexample%2Fselect-error-state-matcher-example.ts

Apart from the fix also open to suggestions for how we can better organize the tests for select if anyone has any ideas especially since I added a bunch here for each scenario (single mode, multi-mode and required and initial value variants). But I also question if we need them all because we apply the statuses directly from ng control so its not really our logic per say. The root issue here was related more to when we triggered the form change. But yea let me know what you guys think

@goetzrobin @elite-benni

thatsamsonkid commented 1 month ago

Need to rebase once #293 goes in