From 7ba26b140baa735c1e6195aaacaac3b651400734 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Tue, 1 May 2018 23:54:03 +0300 Subject: [PATCH] fix(aio): correctly route embedded live-example URLs from SW (#23637) Partially addresses #23626. PR Close #23637 --- aio/ngsw-manifest.json | 2 +- aio/tests/deployment/unit/testServiceWorkerRoutes.spec.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/aio/ngsw-manifest.json b/aio/ngsw-manifest.json index 538b0ce425..343fe4f675 100644 --- a/aio/ngsw-manifest.json +++ b/aio/ngsw-manifest.json @@ -18,7 +18,7 @@ "routing": { "index": "/index.html", "routes": { - "^(?!/styleguide|/docs/.|(?:/guide/(?:cli-quickstart|metadata|ngmodule|service-worker-(?:getstart|comm|configref)|learning-angular)|/news)(?:\\.html|/)?$|/testing|/api/(?:.+/[^/]+-|platform-browser/AnimationDriver|testing/|api/|animate/|(?:common/(?:NgModel|Control|MaxLengthValidator))|(?:[^/]+/)?(?:NgFor(?:$|-)|AnimationStateDeclarationMetadata|CORE_DIRECTIVES|PLATFORM_PIPES|DirectiveMetadata|HTTP_PROVIDERS))|.*/stackblitz(?:\\.html)?$|.*\\.[^\/.]+$)": { + "^(?!/styleguide|/docs/.|(?:/guide/(?:cli-quickstart|metadata|ngmodule|service-worker-(?:getstart|comm|configref)|learning-angular)|/news)(?:\\.html|/)?$|/testing|/api/(?:.+/[^/]+-|platform-browser/AnimationDriver|testing/|api/|animate/|(?:common/(?:NgModel|Control|MaxLengthValidator))|(?:[^/]+/)?(?:NgFor(?:$|-)|AnimationStateDeclarationMetadata|CORE_DIRECTIVES|PLATFORM_PIPES|DirectiveMetadata|HTTP_PROVIDERS))|.*/stackblitz(?:\\.html)?(?:\\?.*)?$|.*\\.[^\/.]+$)": { "match": "regex" } } diff --git a/aio/tests/deployment/unit/testServiceWorkerRoutes.spec.ts b/aio/tests/deployment/unit/testServiceWorkerRoutes.spec.ts index 95cec6143d..005353ee72 100644 --- a/aio/tests/deployment/unit/testServiceWorkerRoutes.spec.ts +++ b/aio/tests/deployment/unit/testServiceWorkerRoutes.spec.ts @@ -19,8 +19,14 @@ describe('service-worker routes', () => { it('should ignore stackblitz URLs', () => { const routes = loadSWRoutes(); + + // Normal StackBlitz URLs. expect(routes.some(test => test('/generated/live-examples/toh-pt6/stackblitz.html'))).toBeFalsy(); expect(routes.some(test => test('/generated/live-examples/toh-pt6/stackblitz'))).toBeFalsy(); + + // Embedded StackBlitz URLs. + expect(routes.some(test => test('/generated/live-examples/toh-pt6/stackblitz.html?ctl=1'))).toBeFalsy(); + expect(routes.some(test => test('/generated/live-examples/toh-pt6/stackblitz?ctl=1'))).toBeFalsy(); }); it('should ignore URLs to files with extensions', () => {