Skip to content

Commit

Permalink
chore: simplify (#1387)
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode authored Sep 16, 2024
1 parent e9f69eb commit 5835f56
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 24 deletions.
5 changes: 0 additions & 5 deletions projects/demo-playwright/utils/goto.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type {Page} from '@playwright/test';
import {expect} from '@playwright/test';

import {tuiMockDate} from './mock-date';
import {tuiMockImages} from './mock-images';
Expand Down Expand Up @@ -40,8 +39,6 @@ export async function tuiGoto(

const response = await page.goto(url, playwrightGotoOptions);

await expect(page.locator('app')).toHaveClass(/_loaded/, {timeout: 15_000});

if (hideHeader) {
for (const locator of await page.locator('[tuidocheader]').all()) {
if (await locator.isVisible()) {
Expand All @@ -58,7 +55,5 @@ export async function tuiGoto(
}
}

await page.waitForTimeout(1000);

return response;
}
25 changes: 6 additions & 19 deletions projects/demo/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@ import type {OnInit} from '@angular/core';
import {ChangeDetectionStrategy, Component, inject} from '@angular/core';
import {Router, RouterLink} from '@angular/router';
import {LOCAL_STORAGE} from '@ng-web-apis/common';
import {
TUI_DOC_ICONS,
TUI_DOC_PAGE_LOADED,
TuiAddonDoc,
TuiDocHeader,
} from '@taiga-ui/addon-doc';
import {TUI_DOC_ICONS, TuiAddonDoc, TuiDocHeader} from '@taiga-ui/addon-doc';
import {TUI_DARK_MODE, TuiButton, TuiIcon, TuiLink, TuiRoot} from '@taiga-ui/core';
// eslint-disable-next-line @taiga-ui/experience/no-deep-imports
import pkg from '@taiga-ui/editor/package.json';
Expand All @@ -19,40 +14,32 @@ import {TuiPreview} from '@taiga-ui/kit';
imports: [
RouterLink,
TuiAddonDoc,
TuiButton,
TuiDocHeader,
TuiIcon,
TuiLink,
TuiPreview,
TuiRoot,
TuiButton,
],
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
'[class._loaded]': 'pageLoadedInit',
'[$.class._loaded]': 'pageLoaded',
},
})
export class AppComponent implements OnInit {
private readonly pageLoaded$ = inject(TUI_DOC_PAGE_LOADED);
private readonly icons = inject(TUI_DOC_ICONS);
protected readonly pageLoadedInit = '0';
protected readonly pageLoaded = this.pageLoaded$;

protected readonly darkMode = inject(TUI_DARK_MODE);
protected readonly router = inject(Router);
protected readonly storage = inject(LOCAL_STORAGE);
protected version = pkg.version;

protected get icon(): string {
return this.darkMode() ? this.icons.light : this.icons.dark;
}

public ngOnInit(): void {
void this.replaceEnvInURI();
}

protected get icon(): string {
return this.darkMode() ? this.icons.light : this.icons.dark;
}

protected async replaceEnvInURI(): Promise<void> {
const env = this.storage.getItem('env');

Expand Down

0 comments on commit 5835f56

Please sign in to comment.