Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
82b2d3b
Add a failing guard for the changelog going unwritten
gpbsumido Aug 17, 2026
0c2f13d
Write the 1.3.7 entry the guard is asking for
gpbsumido Aug 17, 2026
3b07017
Backfill the shortcut remap into 1.3.4
gpbsumido Aug 17, 2026
bd6660f
Merge pull request #31 from gpbsumido/ps/changelog-guard
gpbsumido Aug 17, 2026
a312a4d
Add a failing architecture spec for shell-to-feature imports
gpbsumido Nov 21, 2026
60202e7
Move app-wide settings state from apps/ into shared/
gpbsumido Nov 21, 2026
d636f76
Annotate the bootstrap files for the structure lesson
gpbsumido Nov 21, 2026
6686384
Add failing specs for an interactive lesson page in Thoughts
gpbsumido Nov 21, 2026
0e12fb8
Write lesson 01 with a live import checker
gpbsumido Nov 21, 2026
80da41e
Load a thought's interactive lesson page lazily under its prose
gpbsumido Nov 21, 2026
1ead886
Bump to 1.4.0 with the lesson 01 changelog entry
gpbsumido Nov 21, 2026
8d29817
Add failing specs for lesson building blocks and lesson 02
gpbsumido Nov 21, 2026
228ba10
Extract lesson building blocks and a copy button for code samples
gpbsumido Nov 21, 2026
4d585d1
Rebuild lesson 01 on the shared lesson blocks
gpbsumido Nov 21, 2026
3ac6ed3
Write lesson 02 with a live input/output/model demo
gpbsumido Nov 21, 2026
1baa3e4
Bump to 1.4.1 with the lesson 02 changelog entry
gpbsumido Nov 21, 2026
375d607
Add failing specs for the double keydown, thought dates and lesson 03
gpbsumido Nov 21, 2026
3d5d569
Add a failing spec for formatted dates on thought cards
gpbsumido Nov 21, 2026
447f9c4
Handle each desktop keydown once and stop swallowing Cmd+Space
gpbsumido Nov 21, 2026
46a5bd5
Format thought dates in UTC and show reading time
gpbsumido Nov 21, 2026
42043eb
Write lesson 03 with property-vs-attribute and control-flow demos
gpbsumido Nov 21, 2026
7df9d10
Bump to 1.4.2 with the lesson 03 changelog entry
gpbsumido Nov 21, 2026
c1801f8
Add failing specs for series nav, reactive slugs, dock state and less…
gpbsumido Nov 21, 2026
cd5d5fd
Add a failing spec for scrolling to the top between lessons
gpbsumido Nov 21, 2026
6174aac
Make dock state read-only and give minimize one home
gpbsumido Nov 21, 2026
aea96eb
Drive the reader from a slug signal and add series navigation
gpbsumido Nov 21, 2026
3125c52
Write lesson 04 with effect-batching and linkedSignal demos
gpbsumido Nov 21, 2026
bba79c7
Bump to 1.4.3 with the lesson 04 changelog entry
gpbsumido Nov 21, 2026
636d01d
Add failing specs for a storage token, reading progress and lesson 05
gpbsumido Nov 21, 2026
ea17c3c
Inject browser storage through a token
gpbsumido Nov 21, 2026
3b8e11c
Save reading progress and show it in the reader and list
gpbsumido Nov 21, 2026
ef7e2f8
Write lesson 05 with a live injector-tree demo
gpbsumido Nov 21, 2026
e8de6e6
Bump to 1.4.4 with the lesson 05 changelog entry
gpbsumido Nov 21, 2026
41ed7a9
Add failing specs for retrying transient errors and lesson 06
gpbsumido Nov 21, 2026
84e2bc2
Retry transient GET failures with backoff
gpbsumido Nov 21, 2026
48edf3c
Write lesson 06 with a switchMap vs mergeMap race
gpbsumido Nov 21, 2026
f2aa529
Bump to 1.4.5 with the lesson 06 changelog entry
gpbsumido Nov 21, 2026
cdb634e
Add failing specs for tag pages, a wildcard route and lesson 07
gpbsumido Nov 21, 2026
86068a6
Bind the reader's slug as a route input
gpbsumido Nov 21, 2026
a1447f6
Add prerendered tag pages and a wildcard route
gpbsumido Nov 21, 2026
5a4f67d
Write lesson 07 with a route-matching playground
gpbsumido Nov 21, 2026
3a9c36a
Bump to 1.4.6 with the lesson 07 changelog entry
gpbsumido Nov 21, 2026
919907d
Add failing specs for contact form validation and lesson 08
gpbsumido Nov 21, 2026
80d43d3
Explain contact form errors instead of disabling Send
gpbsumido Nov 21, 2026
08ae613
Write lesson 08 with a group validator and FormArray demo
gpbsumido Nov 21, 2026
6aa6f07
Bump to 1.4.7 with the lesson 08 changelog entry
gpbsumido Nov 21, 2026
c7ea17f
Add a failing fitness spec for OnPush everywhere and lesson 09
gpbsumido Nov 21, 2026
cc4515d
Find components with the TypeScript parser in the OnPush fitness test
gpbsumido Nov 21, 2026
e30bbba
Switch every component to OnPush
gpbsumido Nov 21, 2026
4c5737d
Write lesson 09 with an Eager vs OnPush demo
gpbsumido Nov 21, 2026
a3965b4
Bump to 1.4.8 with the lesson 09 changelog entry
gpbsumido Nov 21, 2026
0d958cb
Add failing specs for a lesson scroll-spy nav and lesson 10
gpbsumido Nov 21, 2026
0707817
Add an On this page nav to every lesson
gpbsumido Nov 21, 2026
57bfabb
Write lesson 10 with structural and host directive demos
gpbsumido Nov 21, 2026
9e16af4
Bump to 1.4.9 with the lesson 10 changelog entry
gpbsumido Nov 21, 2026
f09601d
Add failing specs for CI gaps, lesson 11 and the lesson nav e2e
gpbsumido Nov 21, 2026
f0c43ca
Correct the contact form reset comment, with a test
gpbsumido Nov 21, 2026
cefed5c
Make CI typecheck real files, build, and time out
gpbsumido Nov 21, 2026
93f2602
Write lesson 11 with a run-the-tests demo
gpbsumido Nov 21, 2026
7bf6fde
Bump to 1.4.10 with the lesson 11 changelog entry
gpbsumido Nov 21, 2026
990b64d
Add failing specs for a hydratable menu bar and lesson 12
gpbsumido Nov 21, 2026
436d76f
Start the menu bar clock after render so the bar can hydrate
gpbsumido Nov 21, 2026
969fab3
Write lesson 12 with a where-was-this-rendered demo
gpbsumido Nov 21, 2026
41c5d76
Format lesson 12's render time with Intl to keep DatePipe out of the …
gpbsumido Nov 21, 2026
4935add
Bump to 1.4.11 with the lesson 12 changelog entry
gpbsumido Nov 21, 2026
ab39e2d
Add failing specs for an interview question bank, practice deck and l…
gpbsumido Nov 21, 2026
a597659
Move every lesson's interview questions into one bank
gpbsumido Nov 21, 2026
4fda835
Add an interview practice deck
gpbsumido Nov 21, 2026
e4062f2
Write lesson 13 with practice over every question in the guide
gpbsumido Nov 21, 2026
671eaf5
Find NgModules with the parser so lesson code samples don't count
gpbsumido Nov 21, 2026
a0417d3
Bump to 1.4.12 with the lesson 13 changelog entry
gpbsumido Nov 21, 2026
c5e1a9a
Remove the repo search nothing sets
gpbsumido Nov 21, 2026
29d3d6d
Add a failing test for related thoughts being rebuilt per call
gpbsumido Nov 21, 2026
da991fe
Group related thoughts once instead of per change detection pass
gpbsumido Nov 21, 2026
530c68f
Merge pull request #42 from gpbsumido/ps/ng-11-testing
gpbsumido Nov 21, 2026
a9b1a9a
Merge pull request #44 from gpbsumido/ps/ng-13-interview
gpbsumido Nov 21, 2026
c8920f1
Merge pull request #45 from gpbsumido/ps/projects-search
gpbsumido Nov 21, 2026
add0823
Add release PR screenshots
gpbsumido Nov 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ jobs:
quality:
name: Lint, Typecheck & Test
runs-on: ubuntu-latest
# A builder that finishes its work and never exits would otherwise hold
# the runner for GitHub's six-hour default.
timeout-minutes: 15

steps:
- uses: actions/checkout@v4
Expand All @@ -25,16 +28,25 @@ jobs:
- name: Lint
run: npm run lint

# The root tsconfig has "files": [] and only references, so a bare
# `tsc --noEmit` checks no files at all. Point it at the real configs.
- name: Typecheck
run: npx tsc --noEmit
run: |
npx tsc --noEmit -p tsconfig.app.json
npx tsc --noEmit -p tsconfig.spec.json

- name: Run unit tests (includes axe accessibility scans)
run: npm test

# The only step that prerenders every route and enforces the bundle budget.
- name: Production build
run: npm run build

e2e-accessibility:
name: E2E & Accessibility
runs-on: ubuntu-latest
needs: quality
timeout-minutes: 20

steps:
- uses: actions/checkout@v4
Expand Down
118 changes: 118 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions e2e/lesson-nav.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { expect, test } from '@playwright/test';

// The unit specs drive ScrollSpy with a fake IntersectionObserver, which can
// only prove the wiring. Whether the highlight follows real scrolling needs a
// real browser.
test.describe('lesson "On this page" nav', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/thoughts/angular-10-directives');
await expect(page.getByRole('navigation', { name: 'On this page' })).toBeVisible();
});

test('jumping to a section focuses its heading and marks it current', async ({ page }) => {
const nav = page.getByRole('navigation', { name: 'On this page' });
await nav.getByRole('button', { name: 'Pitfalls' }).click();

await expect(page.locator('h2#pitfalls')).toBeFocused();
await expect(nav.getByRole('button', { name: 'Pitfalls' })).toHaveAttribute('aria-current', 'location');
});

test('the highlight follows the reader while scrolling', async ({ page }) => {
await page.locator('h2#expert').evaluate((heading) => heading.scrollIntoView({ block: 'start' }));

const nav = page.getByRole('navigation', { name: 'On this page' });
await expect(nav.getByRole('button', { name: 'Expert' })).toHaveAttribute('aria-current', 'location');
await expect(nav.locator('[aria-current]')).toHaveCount(1);
});
});
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-paul",
"version": "1.3.6",
"version": "1.4.12",
"scripts": {
"ng": "ng",
"start": "ng serve",
Expand Down
4 changes: 4 additions & 0 deletions src/app/app.config.server.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// [ng-01 structure] Server-only providers, merged over the browser config.
// mergeApplicationConfig keeps one source of truth (app.config.ts) and layers
// the server bits on top, so the two configs can't drift apart.
// main.server.ts bootstraps with this; main.ts bootstraps with appConfig.
import { mergeApplicationConfig, ApplicationConfig } from '@angular/core';
import { provideServerRendering, withRoutes } from '@angular/ssr';
import { appConfig } from './app.config';
Expand Down
33 changes: 29 additions & 4 deletions src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
// [ng-01 structure] Application-wide providers. This file replaces what an
// AppModule's `imports: [...]` and `providers: [...]` used to do.
//
// Simple: every `provideX()` registers a feature for the whole app.
// Intermediate: the order mostly doesn't matter, but each provider is
// app-scoped (root injector). Anything you add here is created once and
// shared — put per-feature providers on routes or components instead.
// Expert: `provideX(withY(), withZ())` is the "feature function" pattern.
// The with* functions are tree-shakable options: if you never call
// withIncrementalHydration(), that code never ships. Prefer this shape when
// you design your own library's providers too.
import {
ApplicationConfig,
provideBrowserGlobalErrorListeners,
provideZonelessChangeDetection,
} from '@angular/core';
import { provideHttpClient, withFetch } from '@angular/common/http';
import { provideRouter } from '@angular/router';
import { provideHttpClient, withFetch, withInterceptors } from '@angular/common/http';
import { provideRouter, withComponentInputBinding } from '@angular/router';

import { routes } from './app.routes';
import { retryTransientErrors } from './shared/retry-transient-errors.interceptor';
import {
provideClientHydration,
withEventReplay,
Expand All @@ -15,10 +27,23 @@ import {

export const appConfig: ApplicationConfig = {
providers: [
// Routes uncaught errors and unhandled rejections to Angular's ErrorHandler.
provideBrowserGlobalErrorListeners(),
// No Zone.js: change detection runs off signals and template events.
// Covered properly in lesson 09.
provideZonelessChangeDetection(),
provideHttpClient(withFetch()),
provideRouter(routes),
// HttpClient backed by fetch() instead of XHR — required for good SSR.
// [ng-06 rxjs] Interceptors run in array order on the way out and reverse
// order on the way back. withInterceptors() takes plain functions; the
// class-based HTTP_INTERCEPTORS multi-provider is the legacy form.
provideHttpClient(withFetch(), withInterceptors([retryTransientErrors])),
// [ng-07 routing] withComponentInputBinding(): route params, query params
// and route data arrive as component inputs, so a routed component can
// declare `slug = input.required<string>()` instead of injecting
// ActivatedRoute and bridging an Observable.
provideRouter(routes, withComponentInputBinding()),
// SSR hydration: reuse server-rendered DOM instead of re-creating it.
// Lesson 12.
provideClientHydration(withEventReplay(), withIncrementalHydration()),
],
};
12 changes: 12 additions & 0 deletions src/app/app.routes.server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ describe('serverRoutes', () => {
expect(slugs).toEqual(expected);
});

it('prerenders a page for every tag', async () => {
const route = serverRoutes.find((r) => r.path === 'thoughts/tag/:tag');
expect(route?.renderMode).toBe(RenderMode.Prerender);

const params = await (
route as unknown as { getPrerenderParams: () => Promise<{ tag: string }[]> }
).getPrerenderParams();
const expected = [...new Set(THOUGHTS.flatMap((t) => t.tags))].sort();

expect(params.map((p) => p.tag).sort()).toEqual(expected);
});

it('keeps the catch-all route client-rendered', () => {
const route = serverRoutes.find((r) => r.path === '**');
expect(route?.renderMode).toBe(RenderMode.Client);
Expand Down
6 changes: 6 additions & 0 deletions src/app/app.routes.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ export const serverRoutes: ServerRoute[] = [
renderMode: RenderMode.Prerender,
getPrerenderParams: async () => THOUGHTS.map((thought) => ({ slug: thought.slug })),
},
{
path: 'thoughts/tag/:tag',
renderMode: RenderMode.Prerender,
getPrerenderParams: async () =>
[...new Set(THOUGHTS.flatMap((thought) => thought.tags))].map((tag) => ({ tag })),
},
// The interactive desktop shell is client-rendered — hybrid rendering by route.
{
path: '**',
Expand Down
45 changes: 45 additions & 0 deletions src/app/app.routes.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { TestBed } from '@angular/core/testing';
import { Router } from '@angular/router';
import { RouterTestingHarness } from '@angular/router/testing';
import { appConfig } from './app.config';
import { ThoughtDetailComponent } from './thoughts-content/thought-detail';
import { ThoughtsListComponent } from './thoughts-content/thoughts-list';

/**
* The real route table with the real router features from appConfig, so
* these catch a route that's missing, in the wrong order, or relying on a
* router feature that isn't switched on.
*/
async function navigate(url: string) {
TestBed.configureTestingModule({ providers: appConfig.providers });
const harness = await RouterTestingHarness.create();
await harness.navigateByUrl(url);
await harness.fixture.whenStable();
return { harness, router: TestBed.inject(Router) };
}

describe('app routes', () => {
it('sends an unknown URL to the desktop instead of failing the navigation', async () => {
const { router } = await navigate('/no-such-page');
expect(router.url).toBe('/');
});

it('binds :slug straight to the reader input', async () => {
const { harness } = await navigate('/thoughts/angular-02-components');
const reader = harness.routeDebugElement?.componentInstance;

expect(reader).toBeInstanceOf(ThoughtDetailComponent);
expect(harness.routeNativeElement?.textContent).toContain('Angular 02: Components');
});

it('serves a tag page that lists only that tag', async () => {
const { harness } = await navigate('/thoughts/tag/angular-guide');
const titles = [...harness.routeNativeElement!.querySelectorAll('.thought-card-title')].map(
(title) => title.textContent ?? '',
);

expect(harness.routeDebugElement?.componentInstance).toBeInstanceOf(ThoughtsListComponent);
expect(titles.length).toBeGreaterThan(0);
expect(titles.every((title) => /Angular \d{2}:/.test(title))).toBe(true);
});
});
12 changes: 12 additions & 0 deletions src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,21 @@ export const routes: Routes = [
loadComponent: () =>
import('./thoughts-content/thoughts-list').then((m) => m.ThoughtsListComponent),
},
// [ng-07 routing] Same component as /thoughts; withComponentInputBinding()
// hands it :tag as its `tag` input. A path param rather than ?tag= so every
// tag page can be prerendered to its own static HTML file.
{
path: 'thoughts/tag/:tag',
loadComponent: () =>
import('./thoughts-content/thoughts-list').then((m) => m.ThoughtsListComponent),
},
{
path: 'thoughts/:slug',
loadComponent: () =>
import('./thoughts-content/thought-detail').then((m) => m.ThoughtDetailComponent),
},
// [ng-07 routing] The wildcard goes last: the router takes the first route
// that matches, in array order, and ** matches everything. Without it, a
// mistyped URL failed the initial navigation with NG04002.
{ path: '**', redirectTo: '' },
];
46 changes: 46 additions & 0 deletions src/app/app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Component } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { provideRouter, Router } from '@angular/router';
import { App } from './app';
import { KeyboardShortcutService } from './shared/keyboard-shortcut.service';

@Component({ template: '' })
class StubThought {}
Expand All @@ -26,6 +27,24 @@ describe('App', () => {
expect(app).toBeTruthy();
});

describe('related thoughts', () => {
// The template calls this for every open window on every change detection
// pass. A new array each time would be a new input value each time.
it('hands a window the same array on every call', () => {
const app = TestBed.createComponent(App).componentInstance;

expect(app.getRelatedThoughts('projects')).toBe(app.getRelatedThoughts('projects'));
expect(app.getRelatedThoughts('no-such-app')).toBe(app.getRelatedThoughts('no-such-app'));
});

it('still lists the thoughts tied to an app, and none for an unknown one', () => {
const app = TestBed.createComponent(App).componentInstance;

expect(app.getRelatedThoughts('projects').length).toBeGreaterThan(0);
expect(app.getRelatedThoughts('no-such-app')).toEqual([]);
});
});

describe('thoughts reader overlay', () => {
let fixture: ComponentFixture<App>;
let router: Router;
Expand Down Expand Up @@ -65,4 +84,31 @@ describe('App', () => {
expect(reader.classList.contains('thoughts-reader--open')).toBe(false);
});
});

describe('global keyboard shortcuts', () => {
const press = (init: KeyboardEventInit) => {
const event = new KeyboardEvent('keydown', { bubbles: true, cancelable: true, ...init });
document.dispatchEvent(event);
return event;
};

it('opens Spotlight on one ⌃⌥Space (each keydown is handled exactly once)', () => {
const fixture = TestBed.createComponent(App);
fixture.detectChanges();
const shortcuts = TestBed.inject(KeyboardShortcutService);

press({ code: 'Space', key: ' ', ctrlKey: true, altKey: true });

expect(shortcuts.spotlightOpen()).toBe(true);
});

it('leaves ⌘Space to the browser and macOS', () => {
const fixture = TestBed.createComponent(App);
fixture.detectChanges();

const event = press({ code: 'Space', key: ' ', metaKey: true });

expect(event.defaultPrevented).toBe(false);
});
});
});
Loading
Loading