Skip to content

Commit

Permalink
feat: support Angular 15 (#352)
Browse files Browse the repository at this point in the history
Closes #350
  • Loading branch information
TrustNoOneElse authored Jan 13, 2023
1 parent 2b46507 commit 072e79f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test('is possible to fill in a form and verify error messages (with the help of

const nameControl = screen.getByLabelText(/name/i);
const scoreControl = screen.getByRole('spinbutton', { name: /score/i });
const colorControl = screen.getByRole('combobox', { name: /color/i });
const colorControl = screen.getByPlaceholderText(/color/i);
const dateControl = screen.getByRole('textbox', { name: /Choose a date/i });

const errors = screen.getByRole('alert');
Expand Down Expand Up @@ -69,7 +69,7 @@ test('set and show pre-set form values', async () => {

const nameControl = screen.getByLabelText(/name/i);
const scoreControl = screen.getByRole('spinbutton', { name: /score/i });
const colorControl = screen.getByRole('combobox', { name: /color/i });
const colorControl = screen.getByPlaceholderText(/color/i);

expect(nameControl).toHaveValue('Max');
expect(scoreControl).toHaveValue(4);
Expand Down
42 changes: 21 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,34 +28,34 @@
"prepare": "git config core.hookspath .githooks"
},
"dependencies": {
"@angular/animations": "15.0.0",
"@angular/cdk": "15.0.0",
"@angular/common": "15.0.0",
"@angular/compiler": "15.0.0",
"@angular/core": "15.0.0",
"@angular/material": "15.0.0",
"@angular/platform-browser": "15.0.0",
"@angular/platform-browser-dynamic": "15.0.0",
"@angular/router": "15.0.0",
"@ngrx/store": "15.0.0",
"@angular/animations": "15.1.0",
"@angular/cdk": "15.1.0",
"@angular/common": "15.1.0",
"@angular/compiler": "15.1.0",
"@angular/core": "15.1.0",
"@angular/material": "15.1.0",
"@angular/platform-browser": "15.1.0",
"@angular/platform-browser-dynamic": "15.1.0",
"@angular/router": "15.1.0",
"@ngrx/store": "15.1.0",
"@nrwl/angular": "15.4.5",
"@nrwl/nx-cloud": "15.0.2",
"@testing-library/dom": "^8.11.1",
"@testing-library/dom": "^8.19.1",
"rxjs": "7.5.6",
"tslib": "~2.3.1",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "15.0.0",
"@angular-eslint/builder": "15.0.0",
"@angular-eslint/eslint-plugin": "15.0.0",
"@angular-eslint/eslint-plugin-template": "15.0.0",
"@angular-eslint/schematics": "15.0.0",
"@angular-eslint/template-parser": "15.0.0",
"@angular-devkit/build-angular": "15.1.0",
"@angular-eslint/builder": "15.1.0",
"@angular-eslint/eslint-plugin": "15.1.0",
"@angular-eslint/eslint-plugin-template": "15.1.0",
"@angular-eslint/schematics": "15.1.0",
"@angular-eslint/template-parser": "15.1.0",
"@angular/cli": "~15.0.0",
"@angular/compiler-cli": "15.0.0",
"@angular/forms": "15.0.0",
"@angular/language-service": "15.0.0",
"@angular/compiler-cli": "15.1.0",
"@angular/forms": "15.1.0",
"@angular/language-service": "15.1.0",
"@nrwl/cli": "15.4.5",
"@nrwl/eslint-plugin-nx": "15.4.5",
"@nrwl/jest": "15.4.5",
Expand All @@ -66,7 +66,7 @@
"@swc-node/register": "^1.4.2",
"@swc/core": "^1.2.173",
"@testing-library/jasmine-dom": "^1.2.0",
"@testing-library/jest-dom": "^5.15.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/user-event": "^13.5.0",
"@types/jasmine": "4.0.3",
"@types/jest": "28.1.8",
Expand Down
8 changes: 4 additions & 4 deletions projects/testing-library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
"migrations": "./schematics/migrations/migration.json"
},
"peerDependencies": {
"@angular/common": ">= 15.0.0",
"@angular/platform-browser": ">= 15.0.0",
"@angular/router": ">= 15.0.0",
"@angular/core": ">= 15.0.0"
"@angular/common": ">= 15.1.0",
"@angular/platform-browser": ">= 15.1.0",
"@angular/router": ">= 15.1.0",
"@angular/core": ">= 15.1.0"
},
"dependencies": {
"@testing-library/dom": "^8.0.0",
Expand Down
8 changes: 4 additions & 4 deletions projects/testing-library/src/lib/testing-library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
OnChanges,
SimpleChanges,
ApplicationInitStatus,
ɵisStandalone,
isStandalone,
} from '@angular/core';
import { ComponentFixture, TestBed, tick } from '@angular/core/testing';
import { BrowserAnimationsModule, NoopAnimationsModule } from '@angular/platform-browser/animations';
Expand Down Expand Up @@ -321,7 +321,7 @@ function setComponentInputs<SutType>(

function overrideComponentImports<SutType>(sut: Type<SutType> | string, imports: (Type<any> | any[])[] | undefined) {
if (imports) {
if (typeof sut === 'function' && ɵisStandalone(sut)) {
if (typeof sut === 'function' && isStandalone(sut)) {
TestBed.overrideComponent(sut, { set: { imports } });
} else {
throw new Error(
Expand Down Expand Up @@ -369,7 +369,7 @@ function addAutoDeclarations<SutType>(
return [...declarations, wrapper];
}

const components = () => (excludeComponentDeclaration || ɵisStandalone(sut) ? [] : [sut]);
const components = () => (excludeComponentDeclaration || isStandalone(sut) ? [] : [sut]);
return [...declarations, ...components()];
}

Expand All @@ -384,7 +384,7 @@ function addAutoImports<SutType>(
};

const routing = () => (routes ? [RouterTestingModule.withRoutes(routes)] : []);
const components = () => (typeof sut !== 'string' && ɵisStandalone(sut) ? [sut] : []);
const components = () => (typeof sut !== 'string' && isStandalone(sut) ? [sut] : []);
return [...imports, ...components(), ...animations(), ...routing()];
}

Expand Down

0 comments on commit 072e79f

Please sign in to comment.