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": "**/*",
|
"glob": "**/*",
|
||||||
"input": "public"
|
"input": "public"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"glob": "**/*",
|
||||||
|
"input": "src/assets",
|
||||||
|
"output": "/assets"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"styles": [
|
"styles": [
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { Component, provideZonelessChangeDetection } from '@angular/core';
|
import { Component, provideZonelessChangeDetection } from '@angular/core';
|
||||||
import { MatCardModule } from '@angular/material/card';
|
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 { provideRouter } from '@angular/router';
|
||||||
import { provideTranslateService } from '@ngx-translate/core';
|
import { provideTranslateService } from '@ngx-translate/core';
|
||||||
import { AboutComponent } from './about.component';
|
import { AboutComponent } from './about.component';
|
||||||
@@ -26,10 +27,26 @@ describe('AboutComponent', () => {
|
|||||||
],
|
],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
|
|
||||||
|
registerStubIcons();
|
||||||
|
|
||||||
fixture = TestBed.createComponent(AboutComponent);
|
fixture = TestBed.createComponent(AboutComponent);
|
||||||
fixture.detectChanges();
|
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[] {
|
function textOf(selector: string): string[] {
|
||||||
return fixture.debugElement
|
return fixture.debugElement
|
||||||
.queryAll(By.css(selector))
|
.queryAll(By.css(selector))
|
||||||
@@ -163,7 +180,7 @@ describe('AboutComponent', () => {
|
|||||||
const mailButton = fixture.debugElement.query(By.css('[data-testid="contact-mail"]')).nativeElement;
|
const mailButton = fixture.debugElement.query(By.css('[data-testid="contact-mail"]')).nativeElement;
|
||||||
const siblingLink = fixture.debugElement
|
const siblingLink = fixture.debugElement
|
||||||
.queryAll(By.css('a'))
|
.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 buttonStyle = getComputedStyle(mailButton);
|
||||||
const linkStyle = getComputedStyle(siblingLink);
|
const linkStyle = getComputedStyle(siblingLink);
|
||||||
|
|||||||
Reference in new issue
Block a user