diff --git a/aio/content/examples/service-worker-getstart/src/app/app.component.css b/aio/content/examples/service-worker-getstart/src/app/app.component.css deleted file mode 100755 index e69de29bb2..0000000000 diff --git a/aio/content/examples/service-worker-getstart/src/app/app.component.ts b/aio/content/examples/service-worker-getstart/src/app/app.component.ts deleted file mode 100755 index 6b80f360d2..0000000000 --- a/aio/content/examples/service-worker-getstart/src/app/app.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-root', - templateUrl: './app.component.html', - styleUrls: ['./app.component.css'] -}) -export class AppComponent { - title = 'Service Workers'; -} diff --git a/aio/content/examples/service-worker-getstart/e2e/app.e2e-spec.ts b/aio/content/examples/service-worker-getting-started/e2e/app.e2e-spec.ts similarity index 66% rename from aio/content/examples/service-worker-getstart/e2e/app.e2e-spec.ts rename to aio/content/examples/service-worker-getting-started/e2e/app.e2e-spec.ts index 02b2f1dcff..6d77937689 100755 --- a/aio/content/examples/service-worker-getstart/e2e/app.e2e-spec.ts +++ b/aio/content/examples/service-worker-getting-started/e2e/app.e2e-spec.ts @@ -1,9 +1,9 @@ import { AppPage } from './app.po'; import { browser, element, by } from 'protractor'; + describe('sw-example App', () => { let page: AppPage; - let logo = element(by.css('img')); beforeEach(() => { page = new AppPage(); @@ -15,17 +15,18 @@ describe('sw-example App', () => { }); it('should display the Angular logo', () => { + let logo = element(by.css('img')); page.navigateTo(); expect(logo.isPresent()).toBe(true); }); - it('should show a header for the list of links', function () { + it('should show a header for the list of links', () => { const listHeader = element(by.css('app-root > h2')); expect(listHeader.getText()).toEqual('Here are some links to help you start:'); }); it('should show a list of links', function () { - element.all(by.css('ul > li > h2 > a')).then(function(items) { + element.all(by.css('ul > li > h2 > a')).then((items) => { expect(items.length).toBe(4); expect(items[0].getText()).toBe('Angular Service Worker Intro'); expect(items[1].getText()).toBe('Tour of Heroes'); @@ -33,5 +34,11 @@ describe('sw-example App', () => { expect(items[3].getText()).toBe('Angular blog'); }); }); - + // Check for a rejected promise as the service worker is not enabled + it('SwUpdate.checkForUpdate() should return a rejected promise', () => { + const button = element(by.css('button')); + const rejectMessage = element(by.css('p')); + button.click(); + expect(rejectMessage.getText()).toContain('rejected: '); + }); }); diff --git a/aio/content/examples/service-worker-getstart/example-config.json b/aio/content/examples/service-worker-getting-started/example-config.json similarity index 100% rename from aio/content/examples/service-worker-getstart/example-config.json rename to aio/content/examples/service-worker-getting-started/example-config.json diff --git a/aio/content/examples/service-worker-getting-started/package.json b/aio/content/examples/service-worker-getting-started/package.json new file mode 100644 index 0000000000..6886be13b7 --- /dev/null +++ b/aio/content/examples/service-worker-getting-started/package.json @@ -0,0 +1,50 @@ +{ + "name": "angular.io-example", + "version": "0.0.0", + "license": "MIT", + "scripts": { + "ng": "ng", + "start": "ng serve", + "build": "ng build", + "test": "ng test", + "lint": "ng lint", + "e2e": "ng e2e" + }, + "private": true, + "dependencies": { + "@angular/animations": "^5.0.0", + "@angular/common": "^5.0.0", + "@angular/compiler": "^5.0.0", + "@angular/core": "^5.0.0", + "@angular/forms": "^5.0.0", + "@angular/http": "^5.0.0", + "@angular/service-worker": "^5.0.0", + "@angular/platform-browser": "^5.0.0", + "@angular/platform-browser-dynamic": "^5.0.0", + "@angular/router": "^5.0.0", + "core-js": "^2.4.1", + "rxjs": "^5.5.2", + "zone.js": "^0.8.14" + }, + "devDependencies": { + "@angular/cli": "1.5.4", + "@angular/compiler-cli": "^5.0.0", + "@angular/language-service": "^5.0.0", + "@types/jasmine": "~2.5.53", + "@types/jasminewd2": "~2.0.2", + "@types/node": "~6.0.60", + "codelyzer": "^4.0.1", + "jasmine-core": "~2.6.2", + "jasmine-spec-reporter": "~4.1.0", + "karma": "~1.7.0", + "karma-chrome-launcher": "~2.1.1", + "karma-cli": "~1.0.1", + "karma-coverage-istanbul-reporter": "^1.2.1", + "karma-jasmine": "~1.1.0", + "karma-jasmine-html-reporter": "^0.2.2", + "protractor": "~5.1.2", + "ts-node": "~3.2.0", + "tslint": "~5.7.0", + "typescript": "~2.4.2" + } +} diff --git a/aio/content/examples/service-worker-getting-started/plnkr.json b/aio/content/examples/service-worker-getting-started/plnkr.json new file mode 100644 index 0000000000..661824d258 --- /dev/null +++ b/aio/content/examples/service-worker-getting-started/plnkr.json @@ -0,0 +1,5 @@ +{ + "description": "Service Worker", + "basePath": "src/", + "tags": ["service worker"] + } \ No newline at end of file diff --git a/aio/content/examples/service-worker-getstart/src/app/app.component.html b/aio/content/examples/service-worker-getting-started/src/app/app.component.html similarity index 91% rename from aio/content/examples/service-worker-getstart/src/app/app.component.html rename to aio/content/examples/service-worker-getting-started/src/app/app.component.html index 6d21987a20..59cd86bcb5 100755 --- a/aio/content/examples/service-worker-getstart/src/app/app.component.html +++ b/aio/content/examples/service-worker-getting-started/src/app/app.component.html @@ -5,6 +5,10 @@ Angular Logo + + +

{{updateCheckText}}

+

Here are some links to help you start: