-
Notifications
You must be signed in to change notification settings - Fork 672
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(abc:pdf): fix
container
must be absolutely positioned error (#1448
- Loading branch information
Showing
3 changed files
with
80 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { Component, ViewChild } from '@angular/core'; | ||
import { ComponentFixture, discardPeriodicTasks, fakeAsync, flush, TestBed, tick } from '@angular/core/testing'; | ||
|
||
import { createTestContext } from '@delon/testing'; | ||
import { LazyService } from '@delon/util/other'; | ||
import { NzSafeAny } from 'ng-zorro-antd/core/types/any'; | ||
|
||
import { PdfComponent } from './pdf.component'; | ||
import { PdfModule } from './pdf.module'; | ||
|
||
describe('abc: pdf', () => { | ||
let fixture: ComponentFixture<TestComponent>; | ||
let page: PageObject; | ||
let lazySrv: LazyService; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [PdfModule], | ||
declarations: [TestComponent] | ||
}); | ||
({ fixture } = createTestContext(TestComponent)); | ||
page = new PageObject(); | ||
lazySrv = TestBed.inject(LazyService); | ||
spyOn(lazySrv, 'load').and.returnValue(Promise.resolve([])); | ||
}); | ||
|
||
it('should be throw error when not found pdfjsViewer in window', fakeAsync(() => { | ||
expect(() => page.cd().end()).toThrow(); | ||
})); | ||
|
||
class PageObject { | ||
cd(time: number = 0): this { | ||
fixture.detectChanges(); | ||
tick(time); | ||
fixture.detectChanges(); | ||
return this; | ||
} | ||
|
||
end(): void { | ||
discardPeriodicTasks(); | ||
flush(); | ||
} | ||
} | ||
}); | ||
|
||
@Component({ | ||
template: ` <pdf #comp [src]="src" [options]="options" [delay]="delay" (change)="change()"></pdf> ` | ||
}) | ||
class TestComponent { | ||
@ViewChild('comp') comp!: PdfComponent; | ||
options: NzSafeAny; | ||
src = ''; | ||
delay = 0; | ||
change(): void {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters