mirror of
https://github.com/Redocly/redoc.git
synced 2025-03-03 17:35:46 +03:00
chore: fix tests
This commit is contained in:
parent
8e8d9d8995
commit
5cc1208bb1
|
@ -15,7 +15,7 @@ describe('Common components', () => {
|
||||||
});
|
});
|
||||||
describe('StickySidebar Component', () => {
|
describe('StickySidebar Component', () => {
|
||||||
let builder;
|
let builder;
|
||||||
let component;
|
let component: StickySidebar;
|
||||||
let fixture;
|
let fixture;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@ -31,6 +31,7 @@ describe('Common components', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should start unsticked', () => {
|
it('should start unsticked', () => {
|
||||||
|
component.disable = true;
|
||||||
spyOn(component, 'stick').and.callThrough();
|
spyOn(component, 'stick').and.callThrough();
|
||||||
spyOn(component, 'stickBottom').and.callThrough();
|
spyOn(component, 'stickBottom').and.callThrough();
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
@ -41,7 +42,9 @@ describe('Common components', () => {
|
||||||
it('should stick to the top on the next animation frame', (done) => {
|
it('should stick to the top on the next animation frame', (done) => {
|
||||||
spyOn(component, 'stick').and.callThrough();
|
spyOn(component, 'stick').and.callThrough();
|
||||||
spyOn(component, 'stickBottom').and.callThrough();
|
spyOn(component, 'stickBottom').and.callThrough();
|
||||||
|
component.disable = true;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
component.disable = false;
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
expect(component.stick).toHaveBeenCalled();
|
expect(component.stick).toHaveBeenCalled();
|
||||||
expect(component.stickBottom).toHaveBeenCalled();
|
expect(component.stickBottom).toHaveBeenCalled();
|
||||||
|
|
|
@ -90,7 +90,7 @@ export class StickySidebar implements OnInit, OnDestroy, OnChanges {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges() {
|
ngOnChanges() {
|
||||||
if (this.disable) return;
|
if (!this.$redocEl || this.disable) return;
|
||||||
this.updatePosition();
|
this.updatePosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user