@jscutlery/playwright-ct-angular 0.8.0 → 0.8.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/register-source.mjs +12 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jscutlery/playwright-ct-angular",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "dependencies": {
5
5
  "@babel/core": "7.23.9",
6
6
  "@playwright/experimental-ct-core": "1.47.1",
@@ -1,7 +1,6 @@
1
1
  import { Component, reflectComponentType } from '@angular/core';
2
- import { ComponentFixtureAutoDetect, getTestBed, TestBed, TestComponentRenderer } from '@angular/core/testing';
2
+ import { getTestBed, TestBed, TestComponentRenderer } from '@angular/core/testing';
3
3
  import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
4
- import { Subscription } from 'rxjs';
5
4
 
6
5
  /**
7
6
  * @typedef {{type: string} & import('./index').MountTemplateOptions} TemplateInfo
@@ -68,16 +67,17 @@ async function __pwRenderComponent(component, rootElement) {
68
67
  let componentClass;
69
68
 
70
69
  if (__pwIsTemplate(component)) {
71
- const templateInfo = /** @type {TemplateInfo} */(component);
70
+ const templateInfo = /** @type {TemplateInfo} */ (component);
72
71
  componentClass = Component({
73
72
  standalone: true,
74
73
  selector: 'pw-template-component',
75
74
  imports: templateInfo.imports,
76
- template: templateInfo.type
77
- })(class {
78
- });
75
+ template: templateInfo.type,
76
+ })(class {});
79
77
  } else {
80
- componentClass = /** @type {import('@angular/core').Type<unknown>} */(component.type);
78
+ componentClass = /** @type {import('@angular/core').Type<unknown>} */ (
79
+ component.type
80
+ );
81
81
  }
82
82
 
83
83
  const componentMetadata = reflectComponentType(componentClass);
@@ -87,18 +87,19 @@ async function __pwRenderComponent(component, rootElement) {
87
87
  TestBed.configureTestingModule({
88
88
  imports: [componentClass],
89
89
  providers: [
90
- { provide: ComponentFixtureAutoDetect, useValue: true },
91
90
  {
92
91
  provide: TestComponentRenderer,
93
- useValue: new PlaywrightTestComponentRenderer(rootElement)
92
+ useValue: new PlaywrightTestComponentRenderer(rootElement),
94
93
  },
95
- ...component.providers ?? []
96
- ]
94
+ ...(component.providers ?? []),
95
+ ],
97
96
  });
98
97
 
99
98
  const fixture = TestBed.createComponent(componentClass);
100
99
  __pwUpdateProps(fixture, component);
101
100
  __pwUpdateEvents(fixture, component.on);
101
+ /* TODO: switch back to ComponentFixtureAutoDetect once this is fixed https://github.com/angular/angular/issues/57856 */
102
+ fixture.autoDetectChanges();
102
103
 
103
104
  await fixture.whenStable();
104
105