From e16e6170fa2241bafacf6763d0ddaf02b5314395 Mon Sep 17 00:00:00 2001
From: "allcontributors[bot]"
<46447321+allcontributors[bot]@users.noreply.github.com>
Date: Wed, 14 Dec 2022 13:43:29 +0100
Subject: [PATCH 1/3] docs: add antischematic as a contributor for bug, and
ideas (#344)
* docs: update README.md [skip ci]
* docs: update .all-contributorsrc [skip ci]
Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
---
.all-contributorsrc | 10 ++++++++++
README.md | 1 +
2 files changed, 11 insertions(+)
diff --git a/.all-contributorsrc b/.all-contributorsrc
index e69da64..8f50d57 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -331,6 +331,16 @@
"contributions": [
"maintenance"
]
+ },
+ {
+ "login": "antischematic",
+ "name": "antischematic",
+ "avatar_url": "https://avatars.githubusercontent.com/u/12976684?v=4",
+ "profile": "https://github.com/antischematic",
+ "contributions": [
+ "bug",
+ "ideas"
+ ]
}
],
"contributorsPerLine": 7,
diff --git a/README.md b/README.md
index f9bfa78..e0b7702 100644
--- a/README.md
+++ b/README.md
@@ -227,6 +227,7 @@ Thanks goes to these people ([emoji key][emojis]):
 Mateus Duraes 💻 |
 Josh Joseph 💻 ⚠️ |
 Torsten Knauf 🚧 |
+  antischematic 🐛 🤔 |
From 7119268e6e6ad14f4a752f8565013d2df195fea8 Mon Sep 17 00:00:00 2001
From: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com>
Date: Wed, 14 Dec 2022 21:12:36 +0100
Subject: [PATCH 2/3] ci: add permissions (#345)
---
.github/workflows/ci.yml | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index de3b8ee..34ab0dd 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -8,12 +8,18 @@ on:
pull_request: {}
workflow_dispatch:
+permissions: {}
+
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_test_release:
+ permissions:
+ actions: write
+ contents: write
+
strategy:
matrix:
node-version: ${{ fromJSON((github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta') && '[16]' || '[14,16]') }}
From 586fd836b1c3d017c048e57f529e33a78cbb8ca7 Mon Sep 17 00:00:00 2001
From: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com>
Date: Thu, 15 Dec 2022 20:42:49 +0100
Subject: [PATCH 3/3] fix: regression autoDetectChanges (#347)
Closes #346
---
.../testing-library/src/lib/testing-library.ts | 16 +++++++++++-----
.../tests/issues/issue-346.spec.ts | 17 +++++++++++++++++
2 files changed, 28 insertions(+), 5 deletions(-)
create mode 100644 projects/testing-library/tests/issues/issue-346.spec.ts
diff --git a/projects/testing-library/src/lib/testing-library.ts b/projects/testing-library/src/lib/testing-library.ts
index 1b1428d..387ae10 100644
--- a/projects/testing-library/src/lib/testing-library.ts
+++ b/projects/testing-library/src/lib/testing-library.ts
@@ -66,7 +66,16 @@ export async function render(
defaultImports = [],
} = { ...globalConfig, ...renderOptions };
- dtlConfigure(domConfig);
+ dtlConfigure({
+ eventWrapper: (cb) => {
+ const result = cb();
+ if (autoDetectChanges) {
+ detectChangesForMountedFixtures();
+ }
+ return result;
+ },
+ ...domConfig,
+ });
TestBed.configureTestingModule({
declarations: addAutoDeclarations(sut, {
@@ -183,6 +192,7 @@ export async function render(
result = doNavigate();
}
+ detectChanges();
return result ?? false;
};
@@ -234,10 +244,6 @@ export async function render(
fixture.componentInstance.ngOnChanges(changes);
}
- if (autoDetectChanges) {
- fixture.autoDetectChanges(true);
- }
-
detectChanges = () => {
if (isAlive) {
fixture.detectChanges();
diff --git a/projects/testing-library/tests/issues/issue-346.spec.ts b/projects/testing-library/tests/issues/issue-346.spec.ts
new file mode 100644
index 0000000..ef1b7a3
--- /dev/null
+++ b/projects/testing-library/tests/issues/issue-346.spec.ts
@@ -0,0 +1,17 @@
+import { Component } from '@angular/core';
+import { render } from '../../src/public_api';
+
+test('issue 364 detectChangesOnRender', async () => {
+ @Component({
+ selector: 'atl-fixture',
+ template: `{{ myObj.myProp }}`,
+ })
+ class MyComponent {
+ myObj: any = null;
+ }
+
+ // autoDetectChanges invokes change detection, which makes the test fail
+ await render(MyComponent, {
+ detectChangesOnRender: false,
+ });
+});