Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Commit 3717ecb

Browse files
committed
fix(@schematics/angular): e2e should use the prefix
Now that the CLI repects the prefix specified, the generated e2e test should also use it.
1 parent 113f054 commit 3717ecb

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

packages/schematics/angular/application/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ export default function (options: ApplicationOptions): Rule {
336336
name: `${options.name}-e2e`,
337337
relatedAppName: options.name,
338338
rootSelector: appRootSelector,
339+
prefix: options.prefix || 'app',
339340
};
340341
if (options.projectRoot !== undefined) {
341342
e2eOptions.projectRoot = 'e2e';

packages/schematics/angular/e2e/files/src/app.e2e-spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ describe('workspace-project App', () => {
99

1010
it('should display welcome message', () => {
1111
page.navigateTo();
12-
expect(page.getParagraphText()).toEqual('Welcome to app!');
12+
expect(page.getParagraphText()).toEqual('Welcome to <%= prefix %>!');
1313
});
1414
});

packages/schematics/angular/e2e/schema.d.ts

+4
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,8 @@ export interface Schema {
2323
* The name of the app being tested.
2424
*/
2525
relatedAppName: string;
26+
/**
27+
* The prefix to apply.
28+
*/
29+
prefix?: string;
2630
}

packages/schematics/angular/e2e/schema.json

+7
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626
"relatedAppName": {
2727
"description": "The name of the app being tested.",
2828
"type": "string"
29+
},
30+
"prefix": {
31+
"type": "string",
32+
"format": "html-selector",
33+
"description": "The prefix to apply to generated selectors.",
34+
"default": "app",
35+
"alias": "p"
2936
}
3037
},
3138
"required": [

0 commit comments

Comments
 (0)