From 4598af23c0c24ecfc3276a8e6882363cadd9c436 Mon Sep 17 00:00:00 2001 From: Jesus Rodriguez Date: Thu, 20 Apr 2017 13:33:31 +0200 Subject: [PATCH] docs(aio): adjust zips/plunker paths --- aio/content/guide/cli-quickstart.md | 2 +- aio/content/guide/ts-to-js.md | 4 ++-- aio/content/guide/webpack.md | 4 ++-- .../embedded/live-example/live-example.component.spec.ts | 9 +++++++++ .../app/embedded/live-example/live-example.component.ts | 4 +++- aio/tools/example-zipper/exampleZipper.js | 2 +- 6 files changed, 18 insertions(+), 7 deletions(-) diff --git a/aio/content/guide/cli-quickstart.md b/aio/content/guide/cli-quickstart.md index 9a3ab351d3..b239758177 100644 --- a/aio/content/guide/cli-quickstart.md +++ b/aio/content/guide/cli-quickstart.md @@ -26,7 +26,7 @@ You'll pursue these ends in the following high-level steps: 3. [Serve](guide/cli-quickstart#serve) the application. 4. [Edit](guide/cli-quickstart#first-component) the application. -And you can also download the example. +And you can also download the example. diff --git a/aio/content/guide/ts-to-js.md b/aio/content/guide/ts-to-js.md index 4fca3ef0de..e27b07e77c 100644 --- a/aio/content/guide/ts-to-js.md +++ b/aio/content/guide/ts-to-js.md @@ -34,7 +34,7 @@ can read and write Angular apps in their preferred dialect. * [View and Child Decorators](guide/ts-to-js#view-child-decorators)
* [AOT compilation in _TypeScript_ Only](guide/ts-to-js#aot)
-**Run and compare the live TypeScript and JavaScript +**Run and compare the live TypeScript and JavaScript code shown in this cookbook.** @@ -901,4 +901,4 @@ Angular offers two modes of template compilation, JIT (_Just-in-Time_) and [AOT (_Ahead-of-Time_)](guide/aot-compiler). Currently the AOT compiler only works with _TypeScript_ applications because, in part, it generates _TypeScript_ files as an intermediate result. -**AOT is not an option for pure JavaScript applications** at this time. \ No newline at end of file +**AOT is not an option for pure JavaScript applications** at this time. diff --git a/aio/content/guide/webpack.md b/aio/content/guide/webpack.md index 2e4ade3c9d..c3dc236581 100644 --- a/aio/content/guide/webpack.md +++ b/aio/content/guide/webpack.md @@ -57,7 +57,7 @@ This guide offers a taste of Webpack and explains how to use it with Angular app * [Highlights](guide/webpack#highlights) * [Conclusion](guide/webpack#conclusion) -You can also download the final result. +You can also download the final result. {@a what-is-webpack} @@ -832,4 +832,4 @@ for a small Angular application. _You could always do more_. Search the web for expert advice and expand your Webpack knowledge. -[Back to top](guide/webpack#top) \ No newline at end of file +[Back to top](guide/webpack#top) diff --git a/aio/src/app/embedded/live-example/live-example.component.spec.ts b/aio/src/app/embedded/live-example/live-example.component.spec.ts index 4405e6bc9a..374ed75f2f 100644 --- a/aio/src/app/embedded/live-example/live-example.component.spec.ts +++ b/aio/src/app/embedded/live-example/live-example.component.spec.ts @@ -200,6 +200,15 @@ describe('LiveExampleComponent', () => { expect(anchor.getAttribute('title')).toBe(liveExampleContent, 'title'); }); })); + + it('should not duplicate the exampleDir on a zip when there is a / on the name', async(() => { + setHostTemplate(''); + testComponent(() => { + const hrefs = getHrefs(); + expect(hrefs[0]).toContain('/testing/ts/eplnkr.html'); + expect(hrefs[1]).toContain('/testing/ts/testing.zip'); + }); + })); }); describe('when embedded', () => { diff --git a/aio/src/app/embedded/live-example/live-example.component.ts b/aio/src/app/embedded/live-example/live-example.component.ts index 4660fc5eb3..5d4a9b9918 100644 --- a/aio/src/app/embedded/live-example/live-example.component.ts +++ b/aio/src/app/embedded/live-example/live-example.component.ts @@ -80,6 +80,7 @@ export class LiveExampleComponent implements OnInit { showEmbedded = false; title: string; zip: string; + zipName: string; constructor( private elementRef: ElementRef, @@ -92,8 +93,9 @@ export class LiveExampleComponent implements OnInit { exampleDir = location.path(false).match(/[^\/?\#]+(?=\/?(?:$|\#|\?))/)[0]; } this.exampleDir = exampleDir.trim(); + this.zipName = exampleDir.indexOf('/') === -1 ? this.exampleDir : exampleDir.split('/')[0]; this.plnkrName = attrs.plnkr ? attrs.plnkr.trim() + '.' : ''; - this.zip = `${zipBase}${exampleDir}/${this.plnkrName}${exampleDir}.zip`; + this.zip = `${zipBase}${exampleDir}/${this.plnkrName}${this.zipName}.zip`; const noDownload = this.getAttrValue(['noDownload', 'nodownload']); // noDownload aliases this.enableDownload = !boolFromAtty(noDownload); diff --git a/aio/tools/example-zipper/exampleZipper.js b/aio/tools/example-zipper/exampleZipper.js index 8c5951e2d7..f4f1cbcc8a 100644 --- a/aio/tools/example-zipper/exampleZipper.js +++ b/aio/tools/example-zipper/exampleZipper.js @@ -56,7 +56,7 @@ class ExampleZipper { let exampleZipName; if (relativeDirName.indexOf('/') !== -1) { // Special example - [relativeDirName, exampleZipName] = relativeDirName.split('/'); + exampleZipName = relativeDirName.split('/')[0]; } else { exampleZipName = jsonFileName.replace(/(plnkr|zipper).json/, relativeDirName); }