Skip to content

Commit

Permalink
refactor: handle standalone by default change
Browse files Browse the repository at this point in the history
In tests, add `standalone: false` where it's missing.

Note: In the future, we should update our integration tests to use a standalone app.
  • Loading branch information
alan-agius4 authored and jkrems committed Oct 17, 2024
1 parent 3db884a commit 3cbbf45
Show file tree
Hide file tree
Showing 22 changed files with 31 additions and 86 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Component } from '@angular/core';

@Component({
selector: 'app-root',
standalone: false,
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {

const goodDirectiveContents = `
import { Directive, Input } from '@angular/core';
@Directive({ selector: 'dir' })
@Directive({ selector: 'dir', standalone: false })
export class Dir {
@Input() foo: number;
}
Expand Down Expand Up @@ -66,6 +66,7 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
import { Component } from '@angular/core'
@Component({
selector: 'app-root',
standalone: false,
template: '<dir [foo]="123">',
})
export class AppComponent { }
Expand All @@ -87,7 +88,7 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
'src/app/dir.ts',
`
import { Directive, Input } from '@angular/core';
@Directive({ selector: 'dir' })
@Directive({ selector: 'dir', standalone: false })
export class Dir {
@Input() foo: string;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
import './file-a';
@Component({
selector: 'app-root',
standalone: false,
template: 'App component',
})
export class AppComponent { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
import { Component } from '@angular/core'
@Component({
selector: 'app-root',
standalone: false,
template: '<h1>Worker Test</h1>',
})
export class AppComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
import { Component } from '@angular/core'
@Component({
selector: 'app-root',
standalone: false,
template: '<h1>Worker Test</h1>',
})
export class AppComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const appShellRouteFiles: Record<string, string> = {
@Component({
selector: 'app-app-shell',
standalone: false,
styles: ['div { color: #fff; }'],
template: '<p>app-shell works!</p>',
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
import { Component } from '@angular/core'
@Component({
selector: 'app-root',
standalone: false,
template: '<h1>Worker Test</h1>',
})
export class AppComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ describe('AppShell Builder', () => {
@Component({
selector: 'app-app-shell',
standalone: false,
templateUrl: './app-shell.component.html',
})
export class AppShellComponent implements OnInit {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ describe('Browser Builder styles', () => {
@Component({
selector: 'app-root',
standalone: false,
templateUrl: './app.component.html',
styleUrls: []
})
Expand All @@ -92,6 +93,7 @@ describe('Browser Builder styles', () => {
@Component({
selector: 'app-root',
standalone: false,
templateUrl: './app.component.html',
styles: ['div { mask-composite: add; }'],
})
Expand All @@ -118,6 +120,7 @@ describe('Browser Builder styles', () => {
@Component({
selector: 'app-root',
standalone: false,
templateUrl: './app.component.html',
styles: ['div { mask-composite: add; }'],
})
Expand Down Expand Up @@ -637,6 +640,7 @@ describe('Browser Builder styles', () => {
@Component({
selector: 'app-root',
standalone: false,
templateUrl: './app.component.html',
styleUrls: ['../styles.css']
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ describe('Browser Builder allow svg', () => {
@Component({
selector: 'app-root',
standalone: false,
templateUrl: './app.component.svg',
styleUrls: []
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {

const goodDirectiveContents = `
import { Directive, Input } from '@angular/core';
@Directive({ selector: 'dir' })
@Directive({ selector: 'dir', standalone: false })
export class Dir {
@Input() foo: number;
}
Expand Down Expand Up @@ -61,6 +61,7 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {
import { Component } from '@angular/core'
@Component({
selector: 'app-root',
standalone: false,
template: '<dir [foo]="123">',
})
export class AppComponent { }
Expand All @@ -82,7 +83,7 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {
'src/app/dir.ts',
`
import { Directive, Input } from '@angular/core';
@Directive({ selector: 'dir' })
@Directive({ selector: 'dir', standalone: false })
export class Dir {
@Input() foo: string;
}
Expand Down Expand Up @@ -162,7 +163,7 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {
'src/app/dir.ts',
`
import { Directive, Input } from '@angular/core';
@Directive({ selector: 'dir' })
@Directive({ selector: 'dir', standalone: false })
export class Dir {
@Input() foo: number;
}
Expand All @@ -172,7 +173,7 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {
// Same selector with a different type on the `foo` property but initially no `@Input`
const goodDirectiveContents = `
import { Directive } from '@angular/core';
@Directive({ selector: 'dir' })
@Directive({ selector: 'dir', standalone: false })
export class Dir2 {
foo: string;
}
Expand Down Expand Up @@ -210,6 +211,7 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {
import { Component } from '@angular/core'
@Component({
selector: 'app-root',
standalone: false,
template: '<dir [foo]="123">',
})
export class AppComponent { }
Expand All @@ -231,7 +233,7 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {
'src/app/dir2.ts',
`
import { Directive, Input } from '@angular/core';
@Directive({ selector: 'dir' })
@Directive({ selector: 'dir', standalone: false })
export class Dir2 {
@Input() foo: string;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ describeKarmaBuilder(execute, KARMA_BUILDER_INFO, (harness, setupTarget) => {
@Component({
selector: 'app-root',
standalone: false,
template: '<button (click)="changeMessage()" class="change">{{ message }}</button>',
})
export class AppComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ describeKarmaBuilder(execute, KARMA_BUILDER_INFO, (harness, setupTarget) => {
@Component({
selector: 'app-root',
standalone: false,
template: '<p *ngFor="let asset of assets">{{ asset.content }}</p>'
})
export class AppComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ describeKarmaBuilder(execute, KARMA_BUILDER_INFO, (harness, setupTarget) => {
@Component({
selector: 'app-root',
standalone: false,
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ describeKarmaBuilder(execute, KARMA_BUILDER_INFO, (harness, setupTarget) => {
@Component({
selector: 'app-root',
standalone: false,
template: '<p>Hello World</p>'
})
export class AppComponent {
Expand Down Expand Up @@ -79,6 +80,7 @@ describeKarmaBuilder(execute, KARMA_BUILDER_INFO, (harness, setupTarget) => {
import { HttpClient } from '@angular/common/http';
@Component({
selector: 'app-root',
standalone: false,
template: '<p *ngFor="let asset of css">{{ asset.content }}</p>'
})
export class AppComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ describeKarmaBuilder(execute, KARMA_BUILDER_INFO, (harness, setupTarget, isAppli
@Component({
selector: 'app-root',
standalone: false,
template: ''
})
export class AppComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ describe('Prerender Builder', () => {
@Component({
selector: 'app-foo',
standalone: false,
template: '<p>foo works!</p>',
})
export class FooComponent {}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@

export * from './lib/lib.service';
export * from './lib/lib.component';
export * from './lib/lib.module';
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Component } from '@angular/core';

@Component({
selector: 'app-root',
standalone: false,
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
Expand Down
58 changes: 0 additions & 58 deletions tests/legacy-cli/e2e/tests/basic/standalone.ts

This file was deleted.

2 changes: 1 addition & 1 deletion tests/legacy-cli/e2e/tests/misc/trusted-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.dev/license
*/

import { appendToFile, prependToFile, replaceInFile, writeFile } from '../../utils/fs';
import { replaceInFile, writeFile } from '../../utils/fs';
import { ng } from '../../utils/process';
import { updateJsonFile } from '../../utils/project';

Expand Down

0 comments on commit 3cbbf45

Please sign in to comment.