mirror of https://github.com/abpframework/abp.git
Browse Source
Angular UI: Added a utility function to clear page after each test with Karmapull/6891/head
committed by
GitHub
3 changed files with 12 additions and 0 deletions
@ -0,0 +1,10 @@ |
|||
import { ComponentFixture } from '@angular/core/testing'; |
|||
|
|||
export function clearPage<T extends any>(_fixture: ComponentFixture<T>) { |
|||
if (!document) return; |
|||
|
|||
const elements = document.querySelectorAll('body > *'); |
|||
elements.forEach(element => { |
|||
if (/^(abp|ngb)-/i.test(element.tagName)) document.body.removeChild(element); |
|||
}); |
|||
} |
|||
@ -0,0 +1 @@ |
|||
export * from './clear-page.util'; |
|||
@ -1,2 +1,3 @@ |
|||
export * from './lib/core-testing.module'; |
|||
export * from './lib/services'; |
|||
export * from './lib/utils'; |
|||
|
|||
Loading…
Reference in new issue