Просмотр исходного кода

chore(admin-ui): Fix broken tests

Michael Bromley 2 лет назад
Родитель
Сommit
b0d8907bbf

+ 2 - 1
packages/admin-ui/angular.json

@@ -131,7 +131,8 @@
             ],
             "stylePreprocessorOptions": {
               "includePaths": [
-                "./src/lib/static/styles"
+                "./src/lib/static/styles",
+                "./src/lib/static/fonts"
               ]
             }
           }

+ 6 - 6
packages/admin-ui/src/lib/core/src/components/breadcrumb/breadcrumb.component.spec.ts

@@ -329,6 +329,7 @@ describe('BeadcrumbsComponent', () => {
         getFixtureForRoute(['', 'pair-function-child', 'string-grandchild'], fixture => {
             const labels = getBreadcrumbLabels(fixture);
             const links = getBreadcrumbLinks(fixture);
+            console.log(`labels: ${labels}`);
             expect(labels).toEqual(['Root', 'PairA', 'PairB', 'Grandchild']);
             expect(links).toEqual(['/', '/foo/bar', '/baz/quux']);
         }),
@@ -423,11 +424,12 @@ function getBreadcrumbsElement(fixture: ComponentFixture<TestComponent>): DebugE
 }
 
 function getBreadcrumbListItems(fixture: ComponentFixture<TestComponent>): HTMLLIElement[] {
-    return fixture.debugElement.queryAll(By.css('.breadcrumbs li')).map(de => de.nativeElement);
+    return fixture.debugElement.queryAll(By.css('.breadcrumbs:not(.mobile) li')).map(de => de.nativeElement);
 }
 
 function getBreadcrumbLabels(fixture: ComponentFixture<TestComponent>): string[] {
-    return getBreadcrumbListItems(fixture).map(item => item.innerText.trim());
+    const labels = getBreadcrumbListItems(fixture).map(item => item.innerText.trim());
+    return labels;
 }
 
 function getBreadcrumbLinks(fixture: ComponentFixture<TestComponent>): string[] {
@@ -451,15 +453,13 @@ class TestParentComponent {}
 @Component({
     // eslint-disable-next-line @angular-eslint/component-selector
     selector: 'test-child-component',
-    template: `
-        <vdr-breadcrumb></vdr-breadcrumb>
-    `,
+    template: ` <vdr-breadcrumb></vdr-breadcrumb> `,
 })
 class TestChildComponent {}
 
 type TestComponent = TestParentComponent | TestChildComponent;
 
-class FooResolver  {
+class FooResolver {
     resolve(): Observable<string> {
         return observableOf('Foo');
     }

+ 1 - 11
packages/admin-ui/src/lib/core/src/providers/notification/notification.service.spec.ts

@@ -1,6 +1,5 @@
 import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
 import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
-import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
 
 import { TestingCommonModule } from '../../../../../testing/testing-common.module';
 import { NotificationComponent } from '../../components/notification/notification.component';
@@ -23,13 +22,6 @@ describe('NotificationService:', () => {
             ],
             schemas: [CUSTOM_ELEMENTS_SCHEMA],
         });
-        // TODO: it looks like there will be an easier way to declare the entryComponents,
-        // see https://github.com/angular/angular/issues/12079
-        TestBed.overrideModule(BrowserDynamicTestingModule, {
-            set: {
-                entryComponents: [NotificationComponent],
-            },
-        });
     });
 
     describe('notification():', () => {
@@ -90,9 +82,7 @@ describe('NotificationService:', () => {
 });
 
 @Component({
-    template: `
-        <vdr-overlay-host></vdr-overlay-host>
-    `,
+    template: ` <vdr-overlay-host></vdr-overlay-host> `,
 })
 class TestComponent {
     constructor(public notificationService: NotificationService) {}

+ 1 - 4
packages/admin-ui/src/lib/core/src/shared/components/page-detail-layout/page-detail-sidebar.component.ts

@@ -2,10 +2,7 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
 
 @Component({
     selector: 'vdr-page-detail-sidebar',
-    template: `
-        <ng-content></ng-content>
-    `,
-    styles: [``],
+    template: ` <ng-content></ng-content> `,
     changeDetection: ChangeDetectionStrategy.OnPush,
 })
 export class PageDetailSidebarComponent {}