Fixed problems
This commit is contained in:
1 parent
5c2b6ed8a2
commit
6121fa553a
2 files changed
+24
-2
No files matched your search
@@ -96,6 +96,11 @@
|
||||
{
|
||||
"glob": "**/*",
|
||||
"input": "public"
|
||||
},
|
||||
{
|
||||
"glob": "**/*",
|
||||
"input": "src/assets",
|
||||
"output": "/assets"
|
||||
}
|
||||
],
|
||||
"styles": [
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { Component, provideZonelessChangeDetection } from '@angular/core';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { By, DomSanitizer } from '@angular/platform-browser';
|
||||
import { MatIconRegistry } from '@angular/material/icon';
|
||||
import { provideRouter } from '@angular/router';
|
||||
import { provideTranslateService } from '@ngx-translate/core';
|
||||
import { AboutComponent } from './about.component';
|
||||
@@ -26,10 +27,26 @@ describe('AboutComponent', () => {
|
||||
],
|
||||
}).compileComponents();
|
||||
|
||||
registerStubIcons();
|
||||
|
||||
fixture = TestBed.createComponent(AboutComponent);
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
/**
|
||||
* The real SVG icons are registered by an app initializer that TestBed never
|
||||
* runs, so mat-icon logs a lookup error for every fixture. Literals keep the
|
||||
* registry satisfied without pulling HttpClient into these tests.
|
||||
*/
|
||||
function registerStubIcons(): void {
|
||||
const iconRegistry = TestBed.inject(MatIconRegistry);
|
||||
const sanitizer = TestBed.inject(DomSanitizer);
|
||||
const emptyIcon = sanitizer.bypassSecurityTrustHtml('<svg></svg>');
|
||||
|
||||
iconRegistry.addSvgIconLiteral('linkedin', emptyIcon);
|
||||
iconRegistry.addSvgIconLiteral('github', emptyIcon);
|
||||
}
|
||||
|
||||
function textOf(selector: string): string[] {
|
||||
return fixture.debugElement
|
||||
.queryAll(By.css(selector))
|
||||
@@ -163,7 +180,7 @@ describe('AboutComponent', () => {
|
||||
const mailButton = fixture.debugElement.query(By.css('[data-testid="contact-mail"]')).nativeElement;
|
||||
const siblingLink = fixture.debugElement
|
||||
.queryAll(By.css('a'))
|
||||
.find(anchor => anchor.nativeElement.textContent.trim() === 'Codeberg')!.nativeElement;
|
||||
.find(anchor => anchor.nativeElement.textContent.trim() === 'Gitea')!.nativeElement;
|
||||
|
||||
const buttonStyle = getComputedStyle(mailButton);
|
||||
const linkStyle = getComputedStyle(siblingLink);
|
||||
|
||||
Reference in new issue
Block a user