test(ivy): test case-insensitive selectors (#32548)

Adds two acceptance tests to show a current difference in behavior between Ivy and VE.
A directive with a selector `.Titledir` matches an element with `class="titleDir"` in VE but not in Ivy.
Same thing for an attribute value.

PR Close #32548
This commit is contained in:
cexbrayat 2019-09-04 18:40:44 +02:00 committed by Matias Niemelä
parent a1beba4b6e
commit 8a6e54a06d
1 changed files with 34 additions and 0 deletions

View File

@ -172,6 +172,23 @@ describe('directives', () => {
expect(nodesWithDirective.length).toBe(1);
});
it('should match classes to directive selectors without case sensitivity', () => {
@Directive({selector: '.Titledir'})
class TitleClassDirective {
}
TestBed.configureTestingModule({declarations: [TestComponent, TitleClassDirective]});
TestBed.overrideTemplate(TestComponent, `
<div class="titleDir" [id]="someId"></div>
`);
const fixture = TestBed.createComponent(TestComponent);
const nodesWithDirective =
fixture.debugElement.queryAllNodes(By.directive(TitleClassDirective));
expect(nodesWithDirective.length).toBe(1);
});
it('should NOT match classes to directive selectors', () => {
TestBed.configureTestingModule({declarations: [TestComponent, TitleDirective]});
TestBed.overrideTemplate(TestComponent, `
@ -184,6 +201,23 @@ describe('directives', () => {
expect(nodesWithDirective.length).toBe(0);
});
it('should match attributes to directive selectors without case sensitivity', () => {
@Directive({selector: '[title=Titledir]'})
class TitleAttributeDirective {
}
TestBed.configureTestingModule({declarations: [TestComponent, TitleAttributeDirective]});
TestBed.overrideTemplate(TestComponent, `
<div title="titleDir" [id]="someId"></div>
`);
const fixture = TestBed.createComponent(TestComponent);
const nodesWithDirective =
fixture.debugElement.queryAllNodes(By.directive(TitleAttributeDirective));
expect(nodesWithDirective.length).toBe(1);
});
it('should match directives with attribute selectors on outputs', () => {
@Directive({selector: '[out]'})
class TestDir {