Skip to content

Commit 0b0cf63

Browse files
Broccohansl
authored andcommitted
fix(@angular/pwa): Set manifest name if no title is provided
Partially addresses #775
1 parent fb78b20 commit 0b0cf63

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

packages/angular/pwa/pwa/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ export default function (options: PwaOptions): Rule {
3939

4040
const assetPath = join(project.root as Path, 'src', 'assets');
4141

42+
options.title = options.title || options.project;
43+
4244
const tempalteSource = apply(url('./files/assets'), [
4345
template({
4446
...options,

packages/angular/pwa/pwa/index_spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,13 @@ describe('PWA Schematic', () => {
7777
expect(manifest.name).toEqual(defaultOptions.title);
7878
expect(manifest.short_name).toEqual(defaultOptions.title);
7979
});
80+
81+
it('should set the name & short_name in the manifest file when no title provided', () => {
82+
const options = {...defaultOptions, title: undefined};
83+
const tree = schematicRunner.runSchematic('ng-add', options, appTree);
84+
const manifestText = tree.readContent('/projects/bar/src/assets/manifest.json');
85+
const manifest = JSON.parse(manifestText);
86+
expect(manifest.name).toEqual(defaultOptions.project);
87+
expect(manifest.short_name).toEqual(defaultOptions.project);
88+
});
8089
});

0 commit comments

Comments
 (0)