From 8b6f2c06c5032fd7cfa441bbc6e0e61f7d458a4a Mon Sep 17 00:00:00 2001 From: Mike Brocchi Date: Wed, 25 Apr 2018 11:59:45 -0700 Subject: [PATCH] fix(@angular/pwa): Set manifest name if no title is provided Partially addresses #775 --- packages/angular/pwa/pwa/index.ts | 2 ++ packages/angular/pwa/pwa/index_spec.ts | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/packages/angular/pwa/pwa/index.ts b/packages/angular/pwa/pwa/index.ts index eecb75c466cf..4558eb42b596 100644 --- a/packages/angular/pwa/pwa/index.ts +++ b/packages/angular/pwa/pwa/index.ts @@ -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, diff --git a/packages/angular/pwa/pwa/index_spec.ts b/packages/angular/pwa/pwa/index_spec.ts index 13a995f9f77c..97d5fb6ac166 100644 --- a/packages/angular/pwa/pwa/index_spec.ts +++ b/packages/angular/pwa/pwa/index_spec.ts @@ -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); + }); });