@jscutlery/playwright-ct-angular 0.6.4 → 0.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jscutlery/playwright-ct-angular",
3
- "version": "0.6.4",
3
+ "version": "0.6.5",
4
4
  "dependencies": {
5
5
  "@babel/core": "7.23.9",
6
6
  "@playwright/experimental-ct-core": "1.43.1",
@@ -37,4 +37,4 @@
37
37
  },
38
38
  "module": "./index.esm.js",
39
39
  "main": "./index.cjs.js"
40
- }
40
+ }
@@ -1,10 +1,9 @@
1
1
  import '@angular/compiler';
2
2
  import 'zone.js';
3
-
4
- import { getTestBed, TestBed, TestComponentRenderer } from '@angular/core/testing';
3
+ import { Component, reflectComponentType } from '@angular/core';
4
+ import { ComponentFixtureAutoDetect, getTestBed, TestBed, TestComponentRenderer } from '@angular/core/testing';
5
5
  import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
6
6
  import { Subscription } from 'rxjs';
7
- import { Component, reflectComponentType } from '@angular/core';
8
7
 
9
8
  /**
10
9
  * @typedef {{type: string} & import('./index').MountTemplateOptions} TemplateInfo
@@ -22,9 +21,6 @@ window.playwrightMount = async (component, rootElement, hooksConfig) => {
22
21
 
23
22
  const fixture = await __pwRenderComponent(component, rootElement);
24
23
 
25
- fixture.autoDetectChanges();
26
- await fixture.whenStable();
27
-
28
24
  for (const hook of window.__pw_hooks_after_mount || [])
29
25
  await hook({ hooksConfig });
30
26
 
@@ -56,7 +52,6 @@ window.playwrightUpdate = async (rootElement, component) => {
56
52
  __pwUpdateProps(fixture, component);
57
53
  __pwUpdateEvents(fixture, component.on);
58
54
 
59
- fixture.autoDetectChanges();
60
55
  await fixture.whenStable();
61
56
  };
62
57
 
@@ -94,6 +89,7 @@ async function __pwRenderComponent(component, rootElement) {
94
89
  TestBed.configureTestingModule({
95
90
  imports: [componentClass],
96
91
  providers: [
92
+ { provide: ComponentFixtureAutoDetect, useValue: true },
97
93
  {
98
94
  provide: TestComponentRenderer,
99
95
  useValue: new PlaywrightTestComponentRenderer(rootElement)
@@ -106,6 +102,8 @@ async function __pwRenderComponent(component, rootElement) {
106
102
  __pwUpdateProps(fixture, component);
107
103
  __pwUpdateEvents(fixture, component.on);
108
104
 
105
+ await fixture.whenStable();
106
+
109
107
  return fixture;
110
108
  }
111
109
 
@@ -119,6 +117,7 @@ function __pwUpdateProps(fixture, componentInfo) {
119
117
 
120
118
  if (__pwIsTemplate(componentInfo)) {
121
119
  Object.assign(fixture.componentInstance, componentInfo.props);
120
+ fixture.detectChanges();
122
121
  } else {
123
122
  for (const [name, value] of Object.entries(componentInfo.props))
124
123
  fixture.componentRef.setInput(name, value);