Skip to content

Commit

Permalink
fix: fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal authored and klxq committed Apr 5, 2020
1 parent 0b0896d commit cfcf73d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
ViewChild,
} from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ToolsetOption } from '@ledge-framework/render';
import { Slugger } from 'marked/lib/marked';
import { MarkdownService } from 'ngx-markdown';
import Tocify, { TocItem } from './tocify';
Expand Down
10 changes: 7 additions & 3 deletions src/app/presentation/case-study/case-study.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import { MatDrawerContent } from '@angular/material/sidenav';
styleUrls: ['./case-study.component.scss'],
})
export class CaseStudyComponent implements OnInit {
@ViewChild('drawerContent', {}) drawerContent: MatDrawerContent;
@ViewChild('drawerContent', { static: false })
drawerContent: MatDrawerContent;

cases = [
{ displayName: '美团', source: 'meituan' },
Expand Down Expand Up @@ -98,8 +99,11 @@ export class CaseStudyComponent implements OnInit {
}

private resetScrollbar() {
if (this.drawerContent && this.drawerContent.getElementRef()) {
this.drawerContent.getElementRef().nativeElement.scrollTop = 0;
if (!!this.drawerContent) {
// on test drawerContent is different
if (!this.drawerContent.hasOwnProperty('nativeElement')) {
this.drawerContent.getElementRef().nativeElement.scrollTop = 0;
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/app/presentation/solution/solution.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ describe('SolutionComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [SharedModule, RouterTestingModule],
declarations: [SolutionComponent]
})
.compileComponents();
declarations: [SolutionComponent],
}).compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(SolutionComponent);
component = fixture.componentInstance;
component.src = '';
fixture.detectChanges();
});

Expand Down
10 changes: 7 additions & 3 deletions src/app/presentation/solution/solution.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import { MatDrawerContent } from '@angular/material/sidenav';
styleUrls: ['./solution.component.scss'],
})
export class SolutionComponent implements OnInit {
@ViewChild('drawerContent', {}) drawerContent: MatDrawerContent;
@ViewChild('drawerContent', { static: false })
drawerContent: MatDrawerContent;

solutions = [{ displayName: 'Coding', source: 'coding' }];
currentSource: string;
Expand Down Expand Up @@ -78,8 +79,11 @@ export class SolutionComponent implements OnInit {
}

private resetScrollbar() {
if (this.drawerContent && this.drawerContent.getElementRef()) {
this.drawerContent.getElementRef().nativeElement.scrollTop = 0;
if (!!this.drawerContent) {
// on test drawerContent is different
if (!this.drawerContent.hasOwnProperty('nativeElement')) {
this.drawerContent.getElementRef().nativeElement.scrollTop = 0;
}
}
}

Expand Down

0 comments on commit cfcf73d

Please sign in to comment.