This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ComponentHarness, HarnessEnvironment, TestElement, ComponentHarnessConstructor, ElementDimensions, TestKey, ModifierKeys} from "@angular/cdk/testing" | |
import { Locator, Page, test, expect as baseExpect } from "@playwright/test" | |
/** | |
* An Angular framework stabilizer function that takes a callback and calls it when the application | |
* is stable, passing a boolean indicating if any work was done. | |
*/ | |
declare interface FrameworkStabilizer { | |
(callback: (didWork: boolean) => void): void; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { defineConfig } from "cypress" | |
import { setupPollyTasks } from "./src/support/polly-tasks" | |
export default defineConfig({ | |
e2e: { | |
supportFile: "**/support/e2e.{js,jsx,ts,tsx}", | |
specPattern: "**/app.cy.ts", | |
testIsolation: false, | |
setupNodeEvents(on) { | |
setupPollyTasks(on) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User { | |
constructor(public name: string) {} | |
toString() { | |
return this.name | |
} | |
} | |
/// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/antischematic/angular-state-library | |
function loadTodos(userId, reload) { | |
return inject(HttpClient).get(endpoint, { params: { userId }}).pipe( | |
retry({ delay: () => reload }) | |
) | |
} | |
@Component({ | |
template: ` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface ActionConfig { | |
// enables or disables default proxy-based dependency tracking on `this` | |
// default: false | |
track?: boolean | |
// whether the action should be executed on init | |
// this option is ignored if function.length > 0 | |
// default: false | |
immediate?: boolean | |
// run action during ngDoCheck when dependencies change |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// noinspection BadExpressionStatementJS | |
import { | |
use, | |
inject, | |
listen, | |
subscribe, provide, ValueToken, ViewDef, | |
} from "@mmuscat/angular-composition-api" | |
import { EMPTY } from "rxjs" | |
import { Component, ViewChild } from "@angular/core" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component({ | |
template: ` | |
<div> | |
<show-results *ngIf="results$ | async as results else loading" [results]="results"></show-results> | |
<ng-template #loading> | |
<spinner></spinner> | |
</ng-template> | |
</div> | |
<pagination [page]="page" [pageSize]="10" [total]="(results$ | async)?.length""></pagination> |