migrate angular 21 tests

This commit is contained in:
2026-03-09 23:25:11 +01:00
parent bb08e46b0c
commit 0d0873730a
24 changed files with 924 additions and 109 deletions

View File

@@ -1,4 +1,4 @@
import {Component, Input, inject} from '@angular/core';
import {Component, EnvironmentInjector, Input, inject, runInInjectionContext} from '@angular/core';
import {File} from '../../services/file';
import {getDownloadURL, ref, Storage} from '@angular/fire/storage';
import {from, Observable} from 'rxjs';
@@ -12,13 +12,14 @@ import {AsyncPipe} from '@angular/common';
})
export class FileComponent {
private storage = inject(Storage);
private environmentInjector = inject(EnvironmentInjector);
public url$: Observable<string> | null = null;
public name = '';
@Input()
public set file(file: File) {
this.url$ = from(getDownloadURL(ref(this.storage, file.path + '/' + file.name)));
this.url$ = from(runInInjectionContext(this.environmentInjector, () => getDownloadURL(ref(this.storage, file.path + '/' + file.name))));
this.name = file.name;
}
}