Skip to content

Commit a67955e

Browse files
Release Beta
2 parents 41d674f + e10d04f commit a67955e

40 files changed

+4720
-1932
lines changed

.circleci/config.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
key: *cache_key
4242
- run:
4343
name: test
44-
command: yarn test
44+
command: yarn test --maxWorkers=1 --ci
4545

4646
build-lib:
4747
<<: *job_defaults
@@ -67,7 +67,7 @@ jobs:
6767
key: *dist_key
6868
- run:
6969
name: test
70-
command: yarn test:app
70+
command: yarn test:app --maxWorkers=1 --ci
7171

7272
release:
7373
<<: *job_defaults
@@ -81,7 +81,7 @@ jobs:
8181
name: release
8282
command: yarn semantic-release || true
8383

84-
release-next:
84+
release-beta:
8585
<<: *job_defaults
8686
steps:
8787
- checkout
@@ -91,7 +91,7 @@ jobs:
9191
key: *dist_key
9292
- run:
9393
name: release
94-
command: yarn semantic-release --branch next || true
94+
command: yarn semantic-release || true
9595

9696
workflows:
9797
version: 2
@@ -118,10 +118,10 @@ workflows:
118118
branches:
119119
only:
120120
- master
121-
- release-next:
121+
- release-beta:
122122
requires:
123123
- test-app
124124
filters:
125125
branches:
126126
only:
127-
- next
127+
- beta

README.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -117,20 +117,20 @@ export class CounterComponent {
117117
counter.component.spec.ts
118118

119119
```typescript
120-
import { render } from '@testing-library/angular';
120+
import { render, screen } from '@testing-library/angular';
121121
import CounterComponent from './counter.component.ts';
122122

123123
describe('Counter', () => {
124124
test('should render counter', async () => {
125-
const { getByText } = await render(CounterComponent, { componentProperties: { counter: 5 } });
125+
await render(CounterComponent, { componentProperties: { counter: 5 } });
126126

127-
expect(getByText('Current Count: 5'));
127+
expect(screen.getByText('Current Count: 5'));
128128
});
129129

130130
test('should increment the counter on click', async () => {
131-
const { getByText, click } = await render(CounterComponent, { componentProperties: { counter: 5 } });
131+
const { click } = await render(CounterComponent, { componentProperties: { counter: 5 } });
132132

133-
click(getByText('+'));
133+
click(screen.getByText('+'));
134134

135135
expect(getByText('Current Count: 6'));
136136
});
@@ -194,6 +194,7 @@ Thanks goes to these people ([emoji key][emojis]):
194194

195195
<!-- markdownlint-enable -->
196196
<!-- prettier-ignore-end -->
197+
197198
<!-- ALL-CONTRIBUTORS-LIST:END -->
198199

199200
This project follows the [all-contributors][all-contributors] specification.

angular.json

+11-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"build": {
1414
"builder": "@angular-devkit/build-angular:browser",
1515
"options": {
16+
"aot": true,
1617
"outputPath": "dist/testing-library-app",
1718
"index": "src/index.html",
1819
"main": "src/main.ts",
@@ -24,6 +25,12 @@
2425
},
2526
"configurations": {
2627
"production": {
28+
"budgets": [
29+
{
30+
"type": "anyComponentStyle",
31+
"maximumWarning": "6kb"
32+
}
33+
],
2734
"fileReplacements": [
2835
{
2936
"replace": "src/environments/environment.ts",
@@ -82,7 +89,8 @@
8289
},
8390
"configurations": {
8491
"production": {
85-
"project": "projects/testing-library/ng-package.prod.json"
92+
"project": "projects/testing-library/ng-package.prod.json",
93+
"tsConfig": "projects/testing-library/tsconfig.lib.prod.json"
8694
}
8795
}
8896
},
@@ -109,7 +117,8 @@
109117
},
110118
"configurations": {
111119
"production": {
112-
"project": "projects/jest-utils/ng-package.prod.json"
120+
"project": "projects/jest-utils/ng-package.prod.json",
121+
"tsConfig": "projects/jest-utils/tsconfig.lib.prod.json"
113122
}
114123
}
115124
},

package.json

+26-29
Original file line numberDiff line numberDiff line change
@@ -22,49 +22,46 @@
2222
"git add"
2323
]
2424
},
25-
"release": {
26-
"pkgRoot": "dist/@testing-library/angular"
27-
},
2825
"dependencies": {
29-
"@angular/animations": "^8.0.0",
30-
"@angular/cdk": "^8.1.4",
31-
"@angular/common": "^8.0.0",
32-
"@angular/compiler": "^8.0.0",
33-
"@angular/core": "^8.0.0",
34-
"@angular/forms": "^8.0.0",
35-
"@angular/material": "^8.1.4",
36-
"@angular/platform-browser": "^8.0.0",
37-
"@angular/platform-browser-dynamic": "^8.0.0",
38-
"@angular/router": "^8.0.0",
39-
"@ngrx/store": "^8.0.0-rc.0",
26+
"@angular/animations": "^9.0.3",
27+
"@angular/cdk": "^9.1.0",
28+
"@angular/common": "^9.0.3",
29+
"@angular/compiler": "^9.0.3",
30+
"@angular/core": "^9.0.3",
31+
"@angular/forms": "^9.0.3",
32+
"@angular/material": "^9.1.0",
33+
"@angular/platform-browser": "^9.0.3",
34+
"@angular/platform-browser-dynamic": "^9.0.3",
35+
"@angular/router": "^9.0.3",
36+
"@ngrx/store": "^9.0.0-rc.0",
4037
"@phenomnomnominal/tsquery": "^3.0.0",
41-
"@testing-library/dom": "^5.0.1",
38+
"@testing-library/dom": "^7.1.1",
39+
"@testing-library/user-event": "^8.1.0",
4240
"core-js": "^3.1.3",
43-
"rxjs": "^6.5.2",
41+
"rxjs": "^6.5.4",
42+
"tslib": "^1.10.0",
4443
"tslint": "^5.16.0",
45-
"zone.js": "~0.9.1"
44+
"zone.js": "~0.10.2"
4645
},
4746
"devDependencies": {
48-
"@angular-devkit/build-angular": "~0.800.0",
49-
"@angular-devkit/build-ng-packagr": "~0.800.0",
50-
"@angular/cli": "~8.0.0",
51-
"@angular/compiler-cli": "^8.0.0",
52-
"@angular/language-service": "^8.0.0",
47+
"@angular-devkit/build-angular": "~0.900.3",
48+
"@angular-devkit/build-ng-packagr": "~0.900.3",
49+
"@angular/cli": "~9.0.3",
50+
"@angular/compiler-cli": "^9.0.3",
51+
"@angular/language-service": "^9.0.3",
5352
"@testing-library/jest-dom": "^4.1.0",
5453
"@types/jest": "~24.0.11",
55-
"@types/node": "~12.0.3",
56-
"codelyzer": "^5.0.1",
54+
"@types/node": "^13.7.6",
55+
"codelyzer": "^5.1.2",
5756
"husky": "^2.3.0",
5857
"jest": "^24.1.0",
5958
"jest-preset-angular": "^7.1.1",
6059
"lint-staged": "^8.1.7",
61-
"ng-packagr": "^5.2.0",
60+
"ng-packagr": "^9.0.0",
6261
"prettier": "^1.17.1",
6362
"rimraf": "^2.6.3",
64-
"semantic-release": "^15.13.12",
63+
"semantic-release": "^17.0.2",
6564
"ts-node": "~8.2.0",
66-
"tsickle": "0.35.0",
67-
"tslib": "^1.9.0",
68-
"typescript": "~3.4.5"
65+
"typescript": "~3.7.5"
6966
}
7067
}

projects/jest-utils/src/lib/configure-test-suite.ts

-26
This file was deleted.

projects/jest-utils/src/lib/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
export * from './configure-test-suite';
21
export * from './create-mock';

projects/jest-utils/tests/create-mock.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ it('provides a mock service', async () => {
3535
const { click, getByText } = await render(FixtureComponent, {
3636
providers: [provideMock(FixtureService)],
3737
});
38-
const service = TestBed.get<FixtureService>(FixtureService);
38+
const service = TestBed.inject(FixtureService);
3939

4040
click(getByText('Print'));
4141
expect(service.print).toHaveBeenCalledTimes(1);
@@ -46,7 +46,7 @@ it('is possible to write a mock implementation', async done => {
4646
providers: [provideMock(FixtureService)],
4747
});
4848

49-
const service = TestBed.get<FixtureService>(FixtureService) as Mock<FixtureService>;
49+
const service = TestBed.inject(FixtureService) as Mock<FixtureService>;
5050
service.print.mockImplementation(() => done());
5151

5252
click(getByText('Print'));

projects/jest-utils/tsconfig.lib.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212
"experimentalDecorators": true,
1313
"importHelpers": true,
1414
"allowSyntheticDefaultImports": true,
15-
"types": [],
15+
"types": ["@types/jest"],
1616
"lib": ["dom", "es2015"]
1717
},
1818
"angularCompilerOptions": {
19-
"annotateForClosureCompiler": true,
2019
"skipTemplateCodegen": true,
2120
"strictMetadataEmit": true,
2221
"fullTemplateTypeCheck": true,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "./tsconfig.lib.json",
3+
"angularCompilerOptions": {
4+
"enableIvy": false
5+
}
6+
}

projects/testing-library/ng-package.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,10 @@
55
"lib": {
66
"entryFile": "src/public_api.ts"
77
},
8-
"whitelistedNonPeerDependencies": ["@testing-library/dom", "@phenomnomnominal/tsquery", "tslint"]
8+
"whitelistedNonPeerDependencies": [
9+
"@testing-library/dom",
10+
"@testing-library/user-event",
11+
"@phenomnomnominal/tsquery",
12+
"tslint"
13+
]
914
}

projects/testing-library/ng-package.prod.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,10 @@
55
"lib": {
66
"entryFile": "src/public_api.ts"
77
},
8-
"whitelistedNonPeerDependencies": ["@testing-library/dom", "@phenomnomnominal/tsquery", "tslint"]
8+
"whitelistedNonPeerDependencies": [
9+
"@testing-library/dom",
10+
"@testing-library/user-event",
11+
"@phenomnomnominal/tsquery",
12+
"tslint"
13+
]
914
}

projects/testing-library/package.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@
2222
},
2323
"homepage": "https://github.com/testing-library/angular-testing-library#readme",
2424
"peerDependencies": {
25-
"@angular/common": "^8.0.0",
26-
"@angular/platform-browser": "^8.0.0",
27-
"@angular/animations": "^8.0.0",
28-
"@angular/router": "^8.0.0",
29-
"@angular/core": "^8.0.0"
25+
"@angular/common": "^9.0.0",
26+
"@angular/platform-browser": "^9.0.0",
27+
"@angular/animations": "^9.0.0",
28+
"@angular/router": "^9.0.0",
29+
"@angular/core": "^9.0.0"
3030
},
3131
"dependencies": {
32-
"@testing-library/dom": "^5.1.0",
32+
"@testing-library/dom": "^7.1.0",
33+
"@testing-library/user-event": "^8.1.0",
3334
"@phenomnomnominal/tsquery": "^3.0.0",
3435
"tslint": "^5.16.0"
3536
},

projects/testing-library/src/lib/models.ts

+21-22
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
import { Type, DebugElement } from '@angular/core';
22
import { ComponentFixture } from '@angular/core/testing';
33
import { Routes } from '@angular/router';
4-
import {
5-
BoundFunction,
6-
FireObject,
7-
Queries,
8-
queries,
9-
waitForElement,
10-
waitForElementToBeRemoved,
11-
waitForDomChange,
12-
} from '@testing-library/dom';
4+
import { BoundFunction, FireObject, Queries, queries, waitFor, waitForElementToBeRemoved } from '@testing-library/dom';
135
import { UserEvents } from './user-events';
146

157
export type RenderResultQueries<Q extends Queries = typeof queries> = { [P in keyof Q]: BoundFunction<Q[P]> };
@@ -68,25 +60,18 @@ export interface RenderResult<ComponentType, WrapperType = ComponentType>
6860
rerender: (componentProperties: Partial<ComponentType>) => void;
6961
/**
7062
* @description
71-
* Wait for the DOM to change.
72-
*
73-
* For more info see https://testing-library.com/docs/dom-testing-library/api-async#waitfordomchange
74-
*/
75-
waitForDomChange: typeof waitForDomChange;
76-
/**
77-
* @description
78-
* Wait for DOM elements to appear, disappear, or change.
63+
* Wait for the removal of element(s) from the DOM.
7964
*
80-
* For more info see https://testing-library.com/docs/dom-testing-library/api-async#waitforelement
65+
* For more info see https://testing-library.com/docs/dom-testing-library/api-async#waitforelementtoberemoved
8166
*/
82-
waitForElement: typeof waitForElement;
67+
waitForElementToBeRemoved: typeof waitForElementToBeRemoved;
8368
/**
8469
* @description
85-
* Wait for the removal of element(s) from the DOM.
70+
* When in need to wait for any period of time you can use waitFor, to wait for your expectations to pass.
8671
*
87-
* For more info see https://testing-library.com/docs/dom-testing-library/api-async#waitforelementtoberemoved
72+
* For more info see https://testing-library.com/docs/dom-testing-library/api-async#waitFor
8873
*/
89-
waitForElementToBeRemoved: typeof waitForElementToBeRemoved;
74+
waitFor: typeof waitFor;
9075
}
9176

9277
export interface RenderComponentOptions<ComponentType, Q extends Queries = typeof queries> {
@@ -263,6 +248,20 @@ export interface RenderComponentOptions<ComponentType, Q extends Queries = typeo
263248
* })
264249
*/
265250
routes?: Routes;
251+
252+
/**
253+
* @description
254+
* Removes the Angular attributes (ng-version, and root-id) from the fixture.
255+
*
256+
* @default
257+
* `false`
258+
*
259+
* @example
260+
* const component = await render(AppComponent, {
261+
* removeAngularAttributes: true
262+
* })
263+
*/
264+
removeAngularAttributes?: boolean;
266265
}
267266

268267
export interface RenderDirectiveOptions<DirectiveType, WrapperType, Q extends Queries = typeof queries>

0 commit comments

Comments
 (0)