Skip to content

Commit

Permalink
test zoneless
Browse files Browse the repository at this point in the history
  • Loading branch information
AtofStryker committed Jun 20, 2024
1 parent 3f93d59 commit ab8f852
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions npm/angular-signals/src/mount.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import 'zone.js'
// import 'zone.js'

/**
* @hack fixes "Mocha has already been patched with Zone" error.
*/
// @ts-ignore
window.Mocha['__zone_patch__'] = false
import 'zone.js/testing'
// import 'zone.js/testing'

import { CommonModule } from '@angular/common'
import { Component, ErrorHandler, EventEmitter, Injectable, SimpleChange, SimpleChanges, Type, OnChanges, Injector, InputSignal, WritableSignal, signal } from '@angular/core'
import { Component, ErrorHandler, EventEmitter, Injectable, SimpleChange, SimpleChanges, Type, OnChanges, Injector, InputSignal, WritableSignal, signal, ɵprovideZonelessChangeDetection } from '@angular/core'
import { toObservable } from '@angular/core/rxjs-interop'
import {
ComponentFixture,
Expand Down Expand Up @@ -160,6 +160,9 @@ function bootstrapModule<T> (
useClass: CypressAngularErrorHandler,
})

// test zoneless
testModuleMetaData.providers.push(ɵprovideZonelessChangeDetection())

// check if the component is a standalone component
if ((component as any).ɵcmp?.standalone) {
testModuleMetaData.imports.push(component)
Expand Down Expand Up @@ -251,7 +254,7 @@ function setupFixture<T> (
setupComponent(config, fixture)

fixture.whenStable().then(() => {
fixture.autoDetectChanges(config.autoDetectChanges ?? true)
// fixture.autoDetectChanges(config.autoDetectChanges ?? true)
})

return fixture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ it('errors on required props missing', (done) => {
cy.mount(SignalsRequiredComponent)
})

it('can handle input signal as primitive value (title prop)', () => {
it.only('can handle input signal as primitive value (title prop)', () => {
cy.mount(SignalsRequiredComponent, {
componentProperties: {
title: 'Signals Component as Primitive',
Expand Down

0 comments on commit ab8f852

Please sign in to comment.