-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(design): remove overflow style on destroy of sidebar-viewport (#2779
- Loading branch information
Showing
2 changed files
with
69 additions
and
1 deletion.
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
59 changes: 59 additions & 0 deletions
59
libs/design/sidebar/src/sidebar-viewport/specs/destroy.spec.ts
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,59 @@ | ||
import { A11yModule } from '@angular/cdk/a11y'; | ||
import { DOCUMENT } from '@angular/common'; | ||
import { Component } from '@angular/core'; | ||
import { | ||
waitForAsync, | ||
ComponentFixture, | ||
TestBed, | ||
} from '@angular/core/testing'; | ||
import { NoopAnimationsModule } from '@angular/platform-browser/animations'; | ||
|
||
import { DaffSidebarViewportComponent } from './../sidebar-viewport.component'; | ||
import { DaffSidebarComponent } from '../../sidebar/sidebar.component'; | ||
|
||
@Component({ | ||
template: ` | ||
<daff-sidebar-viewport> | ||
<daff-sidebar side="left" mode="over" [open]="true"></daff-sidebar> | ||
</daff-sidebar-viewport> | ||
`, | ||
}) | ||
|
||
class WrapperOneComponent {} | ||
|
||
describe('@daffodil/design/sidebar | DaffSidebarViewportComponent | On Destroy', () => { | ||
let fixture: ComponentFixture<WrapperOneComponent>; | ||
let component: WrapperOneComponent; | ||
|
||
beforeEach(waitForAsync(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ | ||
NoopAnimationsModule, | ||
A11yModule, | ||
], | ||
declarations: [ | ||
DaffSidebarViewportComponent, | ||
DaffSidebarComponent, | ||
WrapperOneComponent, | ||
], | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(WrapperOneComponent); | ||
component = fixture.componentInstance; | ||
|
||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('should not have `overflow: hidden` on the body when destroyed', () => { | ||
fixture.destroy(); | ||
|
||
expect((TestBed.inject(DOCUMENT)).body.style.overflow).not.toEqual('hidden'); | ||
}); | ||
}); |