-
Notifications
You must be signed in to change notification settings - Fork 25.7k
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(Compiler): allow "." in attribute selectors #13653
Conversation
templateBindingsSource = attr.value; | ||
} else if (attr.name.startsWith(TEMPLATE_ATTR_PREFIX)) { | ||
} else if (normalizedName.startsWith(TEMPLATE_ATTR_PREFIX)) { |
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.
Add a 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.
done
@@ -623,6 +623,23 @@ Binding to attribute 'onEvent' is disallowed for security reasons ("<my-componen | |||
]); | |||
}); | |||
|
|||
it('should parse directive dotted properties', () => { |
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.
Add a full integration tests as well that also tests that we write the value into the property.
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.
done
classes?: string} = {}): CssSelector { | ||
const classAttr: [string, string] = ['class', classes]; | ||
attrs.push(classAttr); | ||
return createElementCssSelector(tag, attrs); |
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.
Copy simplified version of createElementCssSelector
into this spec (e.g. without namespace handling, ...)
const template = `<div [dot.name]="'foo'"></div>`; | ||
fixture = createTestComponent(template); | ||
fixture.detectChanges(); | ||
const myDir = fixture.debugElement.query(By.directive(MyDir)).injector.get(MyDir); |
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 did not know you could do this! Cool technique.
import {expect} from '@angular/platform-browser/testing/matchers'; | ||
|
||
export function main() { | ||
describe('integration tests', () => { |
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.
Really glad to see this test. Makes it very clear. Thx.
expect(humanizeTplAst(parse('<div [dot.name]="expr"></div>', [dirA]))).toEqual([ | ||
[ElementAst, 'div'], | ||
[DirectiveAst, dirA], | ||
[BoundDirectivePropertyAst, 'localName', 'expr'], |
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.
Nice.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
fixes #13645