mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
docs(docs-infra): prevent the host class from being replaced (#59460)
When removing the binding, the class defined on the host element is being replaced fixes #59442 PR Close #59460
This commit is contained in:
@@ -112,6 +112,13 @@ describe('DocViewer', () => {
|
||||
|
||||
expect(exampleViewer).not.toBeNull();
|
||||
expect(exampleViewer.componentInstance.view()).toBe(CodeExampleViewMode.SNIPPET);
|
||||
|
||||
const checkIcon = fixture.debugElement.query(By.directive(IconComponent));
|
||||
expect((checkIcon.nativeElement as HTMLElement).classList).toContain(
|
||||
`material-symbols-outlined`,
|
||||
);
|
||||
expect((checkIcon.nativeElement as HTMLElement).classList).toContain(`docs-check`);
|
||||
expect(checkIcon.nativeElement.innerHTML).toBe('check');
|
||||
});
|
||||
|
||||
it('should display example viewer in multi file mode when user clicks expand', async () => {
|
||||
|
||||
@@ -265,9 +265,12 @@ export class DocViewer implements OnChanges {
|
||||
}
|
||||
|
||||
private loadIcons(element: HTMLElement): void {
|
||||
element.querySelectorAll('docs-icon').forEach((iconsPlaceholder) => {
|
||||
this.renderComponent(IconComponent, iconsPlaceholder as HTMLElement);
|
||||
});
|
||||
// We need to make sure that we don't reload the icons in loadCopySourceCodeButtons
|
||||
element
|
||||
.querySelectorAll('docs-icon:not([docs-copy-source-code] docs-icon)')
|
||||
.forEach((iconsPlaceholder) => {
|
||||
this.renderComponent(IconComponent, iconsPlaceholder as HTMLElement);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user