Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular: Support v19 #29659

Merged
merged 4 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 11 additions & 11 deletions code/frameworks/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,17 @@
"zone.js": "^0.14.2"
},
"peerDependencies": {
"@angular-devkit/architect": ">=0.1500.0 < 0.1900.0",
"@angular-devkit/build-angular": ">=15.0.0 < 19.0.0",
"@angular-devkit/core": ">=15.0.0 < 19.0.0",
"@angular/cli": ">=15.0.0 < 19.0.0",
"@angular/common": ">=15.0.0 < 19.0.0",
"@angular/compiler": ">=15.0.0 < 19.0.0",
"@angular/compiler-cli": ">=15.0.0 < 19.0.0",
"@angular/core": ">=15.0.0 < 19.0.0",
"@angular/forms": ">=15.0.0 < 19.0.0",
"@angular/platform-browser": ">=15.0.0 < 19.0.0",
"@angular/platform-browser-dynamic": ">=15.0.0 < 19.0.0",
"@angular-devkit/architect": ">=0.1500.0 < 0.2000.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Version range for architect package is inconsistent with others - using 0.2000.0 vs 20.0.0 pattern

"@angular-devkit/build-angular": ">=15.0.0 < 20.0.0",
"@angular-devkit/core": ">=15.0.0 < 20.0.0",
"@angular/cli": ">=15.0.0 < 20.0.0",
"@angular/common": ">=15.0.0 < 20.0.0",
"@angular/compiler": ">=15.0.0 < 20.0.0",
"@angular/compiler-cli": ">=15.0.0 < 20.0.0",
"@angular/core": ">=15.0.0 < 20.0.0",
"@angular/forms": ">=15.0.0 < 20.0.0",
"@angular/platform-browser": ">=15.0.0 < 20.0.0",
"@angular/platform-browser-dynamic": ">=15.0.0 < 20.0.0",
"rxjs": "^6.0.0 || ^7.4.0",
"storybook": "workspace:^",
"typescript": "^4.0.0 || ^5.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, Input, Output, EventEmitter } from '@angular/core';

@Component({
standalone: false,
// Needs to be a different name to the CLI template button
selector: 'storybook-framework-button',
template: ` <button
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, Output, EventEmitter } from '@angular/core';

@Component({
standalone: false,
selector: 'storybook-form',
template: `
<form id="interaction-test-form" (submit)="handleSubmit($event)">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Component, Input } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';

@Component({
standalone: false,
selector: 'storybook-html',
template: `<div [innerHTML]="safeContent"></div>`,
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, Input } from '@angular/core';

@Component({
standalone: false,
selector: 'storybook-pre',
template: `<pre data-testid="pre" [ngStyle]="style">{{ finalText }}</pre>`,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export enum ButtonAccent {
* @html <span class="badge">aaa</span>
*/
@Component({
standalone: false,
selector: 'my-button',
templateUrl: './doc-button.component.html',
styleUrls: ['./doc-button.component.scss'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ElementRef, AfterViewInit, Directive, Input } from '@angular/core';

/** This is an Angular Directive example that has a Prop Table. */
@Directive({
standalone: false,
selector: '[docDirective]',
})
export class DocDirective implements AfterViewInit {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { PipeTransform, Pipe } from '@angular/core';

/** This is an Angular Pipe example that has a Prop Table. */
@Pipe({
standalone: false,
name: 'docPipe',
})
export class DocPipe implements PipeTransform {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
const NOOP = () => {};

@Component({
standalone: false,
selector: 'storybook-custom-cva-component',
template: ` <div>{{ value }}</div>
<input type="text" [(ngModel)]="value" /> `,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ComponentFactoryResolver, ElementRef, Component } from '@angular/core';

@Component({
standalone: false,
selector: 'storybook-attribute-selector[foo=bar]',
template: `<h3>Attribute selector</h3>
Selector: {{ selectors }} <br />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ComponentFactoryResolver, ElementRef, Component } from '@angular/core';

@Component({
standalone: false,
selector: 'storybook-class-selector.foo, storybook-class-selector.bar',
template: `<h3>Class selector</h3>
Selector: {{ selectors }} <br />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ComponentFactoryResolver, ElementRef, Component } from '@angular/core';

@Component({
standalone: false,
selector: 'storybook-multiple-selector, storybook-multiple-selector2',
template: `<h3>Multiple selector</h3>
Selector: {{ selectors }} <br />
Expand All @@ -22,6 +23,7 @@ export class MultipleSelectorComponent {
}

@Component({
standalone: false,
selector: 'storybook-button, button[foo], .button[foo], button[baz]',
template: `<h3>Multiple selector</h3>
Selector: {{ selectors }} <br />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Component, Input } from '@angular/core';

/** This component is used for testing the various forms of enum types */
@Component({
standalone: false,
selector: 'app-enums',
templateUrl: './enums.component.html',
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, Input } from '@angular/core';

@Component({
standalone: false,
selector: `storybook-base-button`,
template: ` <button>{{ label }}</button> `,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Component, Input } from '@angular/core';
import { BaseButtonComponent } from './base-button.component';

@Component({
standalone: false,
selector: `storybook-icon-button`,
template: ` <button>{{ label }} - {{ icon }}</button> `,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Component, Input } from '@angular/core';
import { componentWrapperDecorator, Meta, StoryObj } from '@storybook/angular';

@Component({
standalone: false,
selector: 'sb-button',
template: `<button [style.background-color]="color"><ng-content></ng-content></button>`,
styles: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Component } from '@angular/core';
import { Meta, StoryObj } from '@storybook/angular';

@Component({
standalone: false,
selector: 'storybook-with-ng-content',
template: `Content value:
<div style="color: #1e88e5"><ng-content></ng-content></div>`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { OnDestroy, OnInit, Component } from '@angular/core';
import { Meta, StoryObj } from '@storybook/angular';

@Component({
standalone: false,
selector: 'on-destroy',
template: `Current time: {{ time }} <br />
📝 The current time in console should no longer display after a change of story`,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, Input, ChangeDetectionStrategy, HostBinding } from '@angular/core';

@Component({
standalone: false,
selector: 'storybook-on-push-box',
template: ` Word of the day: {{ word }} `,
styles: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ const meta: Meta<WithPipeComponent> = {
declarations: [CustomPipePipe],
}),
],
tags: ['!test', '!vitest'],
parameters: { chromatic: { disable: true } },
};

export default meta;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { PipeTransform, Pipe } from '@angular/core';

@Pipe({
standalone: false,
name: 'customPipe',
})
export class CustomPipePipe implements PipeTransform {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, Input } from '@angular/core';

@Component({
standalone: false,
selector: 'storybook-with-pipe',
template: ` <h1>{{ field | customPipe }}</h1> `,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { stringify } from 'telejson';
export const TEST_TOKEN = new InjectionToken<string>('test');

@Component({
standalone: false,
selector: 'storybook-di-component',
templateUrl: './di.component.html',
providers: [{ provide: TEST_TOKEN, useValue: 123 }],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component } from '@angular/core';

@Component({
standalone: false,
selector: 'storybook-styled-component',
templateUrl: './styled.component.html',
styleUrls: ['./styled.component.css', './styled.component.scss'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type Story = StoryObj<WithoutSelectorComponent>;
// Advanced example with custom *ngComponentOutlet

@Component({
standalone: false,
selector: 'ng-component-outlet-wrapper',
template: `<ng-container
*ngComponentOutlet="componentOutlet; injector: componentInjector; content: componentContent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const WITHOUT_SELECTOR_DATA = new InjectionToken<{ color: string; name: s
);

@Component({
standalone: false,
template: `My name in color :
<div [style.color]="color">{{ name }}</div>
<ng-content></ng-content> <ng-content></ng-content>`,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { PipeTransform, Pipe } from '@angular/core';

@Pipe({
standalone: false,
name: 'chipText',
})
export class ChipTextPipe implements PipeTransform {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Component, Input, Output, EventEmitter, Inject, HostBinding } from '@an
import { CHIP_COLOR } from './chip-color.token';

@Component({
standalone: false,
selector: 'storybook-chip',
template: `
<span class="text">{{ displayText | chipText }}</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, Input, Output, EventEmitter } from '@angular/core';

@Component({
standalone: false,
selector: 'storybook-chips-group',
template: `
<storybook-chip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ const meta: Meta<ChipComponent> = {
imports: [ChipsModule],
}),
],
tags: ['!test', '!vitest'],
parameters: { chromatic: { disable: true } },
};

export default meta;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ const meta: Meta<ChipsGroupComponent> = {
removeChipClick: { action: 'Remove chip' },
removeAllChipsClick: { action: 'Remove all chips clicked' },
},
tags: ['!test', '!vitest'],
parameters: { chromatic: { disable: true } },
};

export default meta;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ const meta: Meta<ChipsGroupComponent> = {
imports: [ChipsModule],
}),
],
tags: ['!test', '!vitest'],
parameters: { chromatic: { disable: true } },
};

export default meta;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, Input, Output, EventEmitter } from '@angular/core';

@Component({
standalone: false,
selector: 'storybook-button-component',
template: ` <button (click)="onClick.emit($event)">{{ text }}</button> `,
styles: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, Input, Output, EventEmitter } from '@angular/core';

@Component({
standalone: false,
selector: 'child-component',
template: `
Child<br />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, Input, Output, EventEmitter } from '@angular/core';

@Component({
standalone: false,
selector: 'parent-component',
template: `
Parent<br />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { PipeTransform, Pipe } from '@angular/core';

@Pipe({
standalone: false,
name: 'customPipe',
})
export class CustomPipePipe implements PipeTransform {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Component } from '@angular/core';
import { trigger, state, style, transition, animate } from '@angular/animations';

@Component({
standalone: false,
selector: 'app-open-close',
animations: [
trigger('openClose', [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { OnInit, Component, Input } from '@angular/core';
import { DummyService } from './dummy.service';

@Component({
standalone: false,
selector: 'storybook-simple-service-component',
template: `<p>{{ name }}:</p>
<ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const ITEMS = new InjectionToken<string[]>('TokenComponent.Items');
export const DEFAULT_NAME = new InjectionToken<string>('TokenComponent.DefaultName');

@Component({
standalone: false,
selector: 'storybook-simple-token-component',
template: `
<h3>{{ name }}</h3>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Meta, StoryObj } from '@storybook/angular';
import { Component } from '@angular/core';

@Component({
standalone: false,
selector: 'component-with-whitespace',
preserveWhitespaces: true,
template: ` <div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, Input, input, output } from '@angular/core';

@Component({
standalone: false,
// Needs to be a different name to the CLI template button
selector: 'storybook-signal-button',
template: ` <button
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, Input, input, output } from '@angular/core';

@Component({
standalone: false,
// Needs to be a different name to the CLI template button
selector: 'storybook-signal-button',
template: ` <button
Expand Down
3 changes: 2 additions & 1 deletion code/lib/test/template/stories/before-each.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export const BeforeEachOrder = {
async play({ canvasElement }: any) {
await userEvent.click(getByRole(canvasElement, 'button'));

await expect(mocked(console.log).mock.calls).toEqual([
const allLogs = mocked(console.log).mock.calls.filter(([message]) => /^\d+ - /.test(message));
await expect(allLogs).toEqual([
['1 - [from loaders]'],
['2 - [from meta beforeEach]'],
['3 - [from story beforeEach]'],
Expand Down
3 changes: 2 additions & 1 deletion code/lib/test/template/stories/mount-in-play.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export const MountInPlay = {
await mount();
console.log('6 - [after mount]');
await userEvent.click(getByRole(canvasElement, 'button'));
await expect(mocked(console.log).mock.calls).toEqual([
const allLogs = mocked(console.log).mock.calls.filter(([message]) => /^\d+ - /.test(message));
await expect(allLogs).toEqual([
['1 - [from loaders]'],
['2 - [from meta beforeEach]'],
['3 - [from story beforeEach]'],
Expand Down
Loading
Loading