-
Notifications
You must be signed in to change notification settings - Fork 103
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
Add inherited properties test #2263
base: main
Are you sure you want to change the base?
Conversation
Preview this PR: https://custom-elements-everywhere.com/preview/preview/preview/2263/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found a problem with angularjs, making my way through the rest.
@@ -81,6 +81,34 @@ const ComponentWithProps = { | |||
} | |||
}; | |||
|
|||
const ComponentWithInheritance = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know much about angularjs but looking at what's already here, i think the component needs to be added here:
custom-elements-everywhere/libraries/angularjs/src/app.module.js
Lines 1 to 21 in c5c71ed
import 'angular'; | |
import { | |
ComponentWithoutChildren, | |
ComponentWithChildren, | |
ComponentWithChildrenRerender, | |
ComponentWithDifferentViews, | |
ComponentWithProps, | |
ComponentWithImperativeEvent, | |
ComponentWithDeclarativeEvent | |
} from './components'; | |
export default angular.module('ce-tests', []) | |
.component('compNoChildren', ComponentWithoutChildren) | |
.component('compWithChildren', ComponentWithChildren) | |
.component('compWithChildrenRerender', ComponentWithChildrenRerender) | |
.component('compWithDifferentViews', ComponentWithDifferentViews) | |
.component('compWithProps', ComponentWithProps) | |
.component('compWithImperativeEvent', ComponentWithImperativeEvent) | |
.component('compWithDeclarativeEvent', ComponentWithDeclarativeEvent) | |
.name; |
needs to import ComponentWithInheritance
declared here, and needs
.component('compWithInheritance', ComponentWithInheritance)
and the top of this file also has import lines, which probably needs this added
import 'ce-with-inheritance';
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm.... it's working w/o that, but I'm not sure what that means.
let fixture = TestBed.createComponent(ComponentWithInheritance); | ||
fixture.detectChanges(); | ||
let root = fixture.debugElement.nativeElement; | ||
let wc = root.querySelector("#wc"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we check bools, nums, and strings? Or do you want to do that in a basic test? Follow up PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
follow up PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More missing import 'ce-with-inheritance';
Thanks @augustjk ! With the imports fixed, I don't think this shows any interesting failures. I think the new ones are from camelCase properties, so I'm going to remove that check to isolate only inheritance. I was thrown off with a report of a different bug near this Svelte code: https://github.com/sveltejs/svelte/blob/6f508a011bc8051ab9f82cafa97c5292a4453b92/packages/svelte/src/runtime/internal/dom.js#L437 That looks like it's only looking at own properties before making an attribute/property decision, but it turns out there's a switch before that on elements with a I still think this is a decent test to have, since it's conceivable a library could have faulty logic here. At worst it bumps most libraries scores a bit with another passing test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call on isolating out the camelCase props for the inheritance test.
This adds a test of setting inherited properties - properties that are defined by accessors on a super class of the element class. Libraries can fail this check if the use a heuristic to decide when to set properties and that heuristic is only checking for own properties of the direct prototype of the element instance.
In reviewing this it's important to check that the each new test is correct:
<ce-with-inheritance>
element<ce-with-inheritance>
defining module is imported