-
Notifications
You must be signed in to change notification settings - Fork 466
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(block-editor): fix some unit tests #29672
- Loading branch information
Showing
10 changed files
with
149 additions
and
180 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
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
22 changes: 7 additions & 15 deletions
22
core-web/libs/block-editor/src/lib/extensions/asset-form/asset-form.component.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 |
---|---|---|
@@ -1,22 +1,14 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { createComponentFactory, Spectator } from '@ngneat/spectator/jest'; | ||
|
||
import { ImageTabviewFormComponent } from './image-tabview-form.component'; | ||
import { AssetFormComponent } from './asset-form.component'; | ||
|
||
describe('ImageTabviewFormComponent', () => { | ||
let component: ImageTabviewFormComponent; | ||
let fixture: ComponentFixture<ImageTabviewFormComponent>; | ||
describe('AssetFormComponent', () => { | ||
let spectator: Spectator<AssetFormComponent>; | ||
const createComponent = createComponentFactory(AssetFormComponent); | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ImageTabviewFormComponent] | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(ImageTabviewFormComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
beforeEach(() => (spectator = createComponent())); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
expect(spectator.component).toBeTruthy(); | ||
}); | ||
}); |
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
25 changes: 0 additions & 25 deletions
25
.../libs/block-editor/src/lib/extensions/bubble-link-form/bubble-link-form.component.spec.ts
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,13 +1,11 @@ | ||
// Configure Jest for Angular [https://medium.com/@kyjungok/setup-jest-in-angular-application-22b22609cbcd] | ||
import 'jest-preset-angular/setup-jest'; | ||
|
||
import { NgModule } from '@angular/core'; | ||
|
||
// This is needed to mock the PrimeNG SplitButton component to avoid errors while running tests. | ||
// https://github.com/primefaces/primeng/issues/12945 | ||
@NgModule() | ||
export class SplitButtonMockModule {} | ||
|
||
jest.mock('primeng/splitbutton', () => ({ | ||
SplitButtonModule: SplitButtonMockModule | ||
})); | ||
// Workaround for the following issue: | ||
// https://github.com/jsdom/jsdom/issues/2177#issuecomment-1724971596 | ||
const originalConsoleError = console.error; | ||
const jsDomCssError = 'Error: Could not parse CSS stylesheet'; | ||
console.error = (...params) => { | ||
if (!params.find((p) => p.toString().includes(jsDomCssError))) { | ||
originalConsoleError(...params); | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.