Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(elements-angular): directives matching multiple components #1215

Merged
merged 2 commits into from
Feb 1, 2024

Conversation

janivo
Copy link
Collaborator

@janivo janivo commented Jan 31, 2024

Closes #1213

  • We reworked our directives in elements-angular: Angular v15 support #865
  • This lead to directives matching for multiple components, e.g. the example below was matched by our NumericValueAccessorDirective as well as TextValueAccessorDirective which led to runtime errors.
<ino-input [formControl]="myFormControl" type="number"></ino-input>

@janivo janivo requested a review from BenPag January 31, 2024 15:14
@janivo janivo changed the title fix(elements-angular): directives matching on multiple components fix(elements-angular): directives matching multiple components Jan 31, 2024
Copy link
Collaborator

@BenPag BenPag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you format this file (numeric-value-accessor.directive.ts) according the others. The selector value contains a whitespace.

Beside this the issue requires some test to prevent this issue in future. But I can´t see any 😄

@@ -5,7 +5,7 @@ import { ValueAccessorDirective } from './value-accessor.directive';

@Directive({
selector:
'ino-autocomplete,ino-currency-input,ino-input,ino-markdown-editor,ino-textarea,ino-range,ino-select,ino-datepicker,ino-segment-group',
'ino-autocomplete,ino-currency-input,ino-input:not([type=number]):not([type=file]),ino-markdown-editor,ino-textarea,ino-select,ino-datepicker,ino-segment-group',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For using multiply :not() selectors I suggest writing it like here:
https://developer.mozilla.org/en-US/blog/css-not-pseudo-multiple-selectors/#negating_multiple_selectors

Copy link
Collaborator Author

@janivo janivo Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just tried to add some simple jest test to the package but I think as long as we've got these conflicts with stencils outdated Jest version, I don't see us adding any new tests soon. I'll write that down in ticket #1224.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like your suggestion about the selectors but that's currently not supported in angular:
image

@janivo janivo requested a review from BenPag February 1, 2024 14:33
Copy link
Collaborator

@BenPag BenPag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, then we should keep in mind that we write some tests later on.

@janivo janivo merged commit 530e210 into master Feb 1, 2024
4 checks passed
@janivo janivo deleted the elements-#1213-fix-angular-directives branch February 1, 2024 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

elements-angular: Directives registering twice
2 participants