Skip to content

Commit

Permalink
fix(@angular/pwa): Set manifest name if no title is provided
Browse files Browse the repository at this point in the history
Partially addresses #775
  • Loading branch information
Brocco authored and hansl committed Apr 25, 2018
1 parent fb78b20 commit 0b0cf63
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/angular/pwa/pwa/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export default function (options: PwaOptions): Rule {

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

options.title = options.title || options.project;

const tempalteSource = apply(url('./files/assets'), [
template({
...options,
Expand Down
9 changes: 9 additions & 0 deletions packages/angular/pwa/pwa/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,13 @@ describe('PWA Schematic', () => {
expect(manifest.name).toEqual(defaultOptions.title);
expect(manifest.short_name).toEqual(defaultOptions.title);
});

it('should set the name & short_name in the manifest file when no title provided', () => {
const options = {...defaultOptions, title: undefined};
const tree = schematicRunner.runSchematic('ng-add', options, appTree);
const manifestText = tree.readContent('/projects/bar/src/assets/manifest.json');
const manifest = JSON.parse(manifestText);
expect(manifest.name).toEqual(defaultOptions.project);
expect(manifest.short_name).toEqual(defaultOptions.project);
});
});

0 comments on commit 0b0cf63

Please sign in to comment.