Commit Graph

302 Commits

Author SHA1 Message Date
vsavkin c43dd5a655 refactor(router): renamed RouterAppModule into RouterModule 2016-07-07 14:28:01 -07:00
Tobias Bosch 8d746e3f67 feat(testing): add implicit test module
Every test now has an implicit module. It can be configured via `configureModule` (from @angular/core/testing)
to add providers, directives, pipes, ...

The compiler now has to be configured separately via `configureCompiler` (from @angular/core/testing)
to add providers or define whether to use jit.

BREAKING CHANGE:
- Application providers can no longer inject compiler internals (i.e. everything
  from `@angular/compiler). Inject `Compiler` instead. This reflects the
  changes to `bootstrap` for module support (3f55aa609f).
- Compiler providers can no longer be added via `addProviders` / `withProviders`.
  Use the new method `configureCompiler` instead.
- Platform directives / pipes need to be provided via
  `configureModule` and can no longer be provided via the
  `PLATFORM_PIPES` / `PLATFORM_DIRECTIVES` tokens.
- `setBaseTestProviders()` was renamed into `initTestEnvironment` and 
  now takes a `PlatformRef` and a factory for a
  `Compiler`.
- E.g. for the browser platform:
  
  BEFORE:
  ```
  import {setBaseTestProviders} from ‘@angular/core/testing’;
  import {TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
      TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS} from ‘@angular/platform-browser-dynamic/testing’;
  
  setBaseTestProviders(TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
      TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS);   
  ```

  AFTER:
  ```
  import {setBaseTestProviders} from ‘@angular/core/testing’;
  import {browserTestCompiler, browserDynamicTestPlatform,
      BrowserDynamicTestModule} from ‘@angular/platform-browser-dynamic/testing’;
  
  initTestEnvironment(
      browserTestCompiler,
      browserDynamicTestPlatform(),
      BrowserDynamicTestModule);

  ```
- E.g. for the server platform:
  
  BEFORE:
  ```
  import {setBaseTestProviders} from ‘@angular/core/testing’;
  import {TEST_SERVER_PLATFORM_PROVIDERS,
      TEST_SERVER_APPLICATION_PROVIDERS} from ‘@angular/platform-server/testing/server’;
  
  setBaseTestProviders(TEST_SERVER_PLATFORM_PROVIDERS,
      TEST_SERVER_APPLICATION_PROVIDERS);   
  ```

  AFTER:
  ```
  import {setBaseTestProviders} from ‘@angular/core/testing’;
  import {serverTestCompiler, serverTestPlatform,
      ServerTestModule} from ‘@angular/platform-browser-dynamic/testing’;
  
  initTestEnvironment(
      serverTestCompiler,
      serverTestPlatform(),
      ServerTestModule);

  ```

Related to #9726
Closes #9846
2016-07-06 18:04:19 -07:00
vsavkin 37e6da6dfb refactor(router): clean up naming 2016-07-06 16:19:52 -07:00
vsavkin 8aa2a0c1b2 feat(router): add RouterAppModule 2016-07-06 16:00:40 -07:00
vsavkin 6bfd514caf fix(router): remove a circular dep 2016-07-06 14:38:05 -07:00
vsavkin 8ebb8e44c8 feat(router): add support for lazily loaded modules 2016-07-06 14:38:05 -07:00
vsavkin 0c65d5cf2b fix(router): handle router outlets in ngIf 2016-06-30 22:14:42 -07:00
vsavkin f65ebec3ed fix(router): update links when query params change 2016-06-30 22:14:42 -07:00
vsavkin 81bf3f66ca docs(router): rename global redirects into absolute redirects 2016-06-30 22:14:42 -07:00
PatrickJS 137fff9632 fix(router): remove private and internal annotations (#9753) 2016-06-30 19:39:13 -07:00
vsavkin 01de58d650 chore(router): bump up version number 2016-06-30 14:58:59 -07:00
Rob Wormald dabf214f17 fix(router): remove private and internal annotations (#9745) 2016-06-30 14:47:55 -07:00
vsavkin fb2539e1d5 fix(router): remove the precompile warning 2016-06-30 14:33:04 -07:00
Alex Eagle 73f017bad9 fix(typescript): make router compile with typescript@next
fixes #9731
2016-06-30 11:51:52 -07:00
vsavkin 055282f156 chore(router): bump up version number 2016-06-30 11:45:31 -07:00
vsavkin fe7de53b89 chore(router): update router change log 2016-06-30 11:45:31 -07:00
vsavkin a3b90411aa fix(router): fix RouterLinkActive to handle the case when the link has extra paths 2016-06-30 09:26:57 -07:00
vsavkin 5781b96490 fix(router): redirect should not add unnecessary brackets 2016-06-30 09:26:57 -07:00
vsavkin f208ee0d57 fix(router): reexport router directives 2016-06-30 09:26:57 -07:00
vsavkin 3784696b9e fix(router): make the contstructor of the router service public 2016-06-28 18:39:37 -07:00
vsavkin 8c45aebc18 fix(router): make router links work on non-a tags 2016-06-28 18:39:37 -07:00
vsavkin 296a447e3c docs(router): add api docs 2016-06-28 14:49:29 -07:00
Igor Minar 24eb8389d2 fix: public api surface fixes + stability markers
- ts-api-guardian will now error if a new public symbol is added with a stability marker (`@stable`, `@experimental`, `@deprecated`)
- DomEventsPlugin and KeyEventsPlugin were removed from public api surface - these classes is an implementation detail
- deprecated BROWSER_PROVIDERS was removed completely
- `@angular/compiler` was removed from the ts-api-guardian check since this package shouldn't contain anything that users need to directly import
- the rest of the api surface was conservatively marked as stable or experimental

BREAKING CHANGES: DomEventsPlugin and KeyEventsPlugin previously exported from core are no longer public - these classes are implementation detail.

Previously deprecated BROWSER_PROVIDERS was completely removed from platform-browser.

Closes #9236
Closes #9235
Ref #9234
2016-06-28 07:39:40 -07:00
vsavkin fcfddbf79c feat(router): add pathMatch property to replace terminal 2016-06-27 20:21:30 -07:00
vsavkin dc64e90ab9 feat(router): use componentFactoryResolver 2016-06-27 20:21:30 -07:00
vsavkin f2f1ec0117 feat(router): implement data and resolve 2016-06-27 14:25:56 -07:00
Alex Eagle e913d9954d chore(typings): restrict Angular to es5+collections+promise 2016-06-27 13:58:59 -07:00
vsavkin d20488752b fix(router): top-levels do not work in ngIf 2016-06-27 13:34:54 -07:00
vsavkin 855f3afb28 fix(router): canceled navigations should return a promise that is resolved with false 2016-06-27 13:34:54 -07:00
vsavkin 3f44377f2f fix(router): handle empty path with query params 2016-06-27 13:34:54 -07:00
vsavkin 90295e3252 fix(router): preserve fragment on initial load 2016-06-27 13:34:54 -07:00
vsavkin 83208983b3 chore(router): bump up version number 2016-06-24 13:07:42 -07:00
vsavkin 327d04c9c6 chore(router): clang-format 2016-06-24 12:44:32 -07:00
vsavkin 54edce2bab fix(router): wildcard don't get notified on url changes 2016-06-24 12:44:32 -07:00
vsavkin 1a145ac500 fix(router): default exact to false in routerLinkActiveOptions 2016-06-24 12:44:32 -07:00
vsavkin 9f978cf49d test(router): add a test checking that you can use a slash in query params 2016-06-24 12:44:32 -07:00
vsavkin 41b781107b fix(router): doen't throw on canDeactive when route hasn't advanced 2016-06-24 12:44:32 -07:00
Julie Ralph dcf75126bf fix(common/testing): remove internal MockLocationStrategy from common/testing (#9562)
BREAKING CHANGE:

MockLocationStrategy was intended to be internal only and is now removed
from the `@angular/common/testing` public api.

Use `SpyLocation` from `@angular/common/testing` for location testing.
2016-06-24 12:41:57 -07:00
vsavkin fbd2dd9ca2 fix(router): handle path:'' redirects and matches 2016-06-24 11:39:41 -07:00
Julie Ralph 3d8eb8cbca fix(platform-browser/testing): clean up public api for platform-browser/testing (#9519)
Mostly, removing things that were never intended to be exported publicy.

BREAKING CHANGE:

The following are no longer publicly exported APIs. They were intended as internal
utilities and you should use your own util:

```
browserDetection,
dispatchEvent,
el,
normalizeCSS,
stringifyElement,
expect (and custom matchers for Jasmine)
```
2016-06-23 16:42:25 -07:00
Jason Choi 22d8f73bc9 test: add public api golden files
Includes a few style fixes on "* as foo" imports.
2016-06-23 14:26:40 -07:00
ScottSWu ae75e3640a chore(lint): Added license headers to most TypeScript files
Relates to #9380
2016-06-23 09:47:54 -07:00
vsavkin 758ee95880 fix(router): fix tsconfig to use es2015 modules 2016-06-21 23:19:26 -07:00
vsavkin 40e1112a8e chore(router): test karma config to rerun tests on change 2016-06-21 23:19:26 -07:00
vsavkin 15911367a2 refactor(router): removes a circualr dep 2016-06-21 12:17:30 -07:00
vsavkin 8dd3f59c81 chore(router): changes the router setup to align with other modules 2016-06-21 12:17:30 -07:00
vsavkin c9d28492b7 chore(router): remove lint and format tasks from router 2016-06-21 12:17:30 -07:00
vsavkin d1f93072a8 chore(router): clang-format 2016-06-21 12:17:30 -07:00
vsavkin 92d8bf9619 feat(router): add support for componentless routes 2016-06-21 12:17:30 -07:00
vsavkin bd2281e32d fix(resolve): change resolve not to resolve root activate route 2016-06-21 12:17:30 -07:00
vsavkin 0c50bc6449 fix(router): url serializer should handle segments without primary children 2016-06-21 12:17:30 -07:00
vsavkin f164715678 chore(README): fix a typo 2016-06-21 12:17:30 -07:00
vsavkin 2aa615b4ae chore(router): bump up version 2016-06-21 12:17:30 -07:00
vsavkin 42c89b1b9b docs(router): add a README to include a link to the guide 2016-06-21 12:17:30 -07:00
Dimitrios Loukadakis f6b75f56ad fix(router): typo in starts with slash validation error 2016-06-21 12:17:30 -07:00
vsavkin 280540e4a2 fix(router): change serialize not to require parenthesis in query string to be encoded 2016-06-21 12:17:30 -07:00
vsavkin fea216db12 fix(router): fixes a type issue in a test 2016-06-21 12:17:30 -07:00
vsavkin b260eb06f6 fix(router): change postinstall hook to devsetup to not require having 'typings' installed 2016-06-21 12:17:30 -07:00
vsavkin 1c937a10f9 chore(router): add changelog 2016-06-21 12:17:30 -07:00
vsavkin ca23b4c55f feat(router): add route config validation 2016-06-21 12:17:30 -07:00
vsavkin 7e12208ca6 feat(router): do not support paths starting with / 2016-06-21 12:17:30 -07:00
vsavkin 2773281338 feat(router): drop index property
Use path: '/' instead of 'index: true'
2016-06-21 12:17:30 -07:00
vsavkin f8e8d22e4e fix(router): stringify positional parameters when using routerLink 2016-06-21 12:17:30 -07:00
vsavkin cf4a9236b9 chore(router): bump up version number 2016-06-21 12:17:30 -07:00
vsavkin 4450e7b246 cleanup(router): enable noImplicitAny and noImplicntReturns 2016-06-21 12:17:30 -07:00
vsavkin cdbf67ee05 test(router): add a test checking that guards work for child routes 2016-06-21 12:17:30 -07:00
Dimitrios Loukadakis 9a67f38728 fix(router): port fixes done on angular current router to the new one
The bugs were fixed on current angular router in the following commits:
angular/angular@b2a7fd05cb
angular/angular@fa2ce8100b
angular/angular@595bcdd1ac

Closes #12
2016-06-21 12:17:30 -07:00
vsavkin 25560ed048 feat(router): implement RouterLinkActive 2016-06-21 12:17:30 -07:00
vsavkin 2aa19fd078 feat(router): support navigating by url tree 2016-06-21 12:17:30 -07:00
vsavkin cca9a58ded chore(router): bump up version number 2016-06-21 12:17:30 -07:00
Rob Wormald d6a25325c7 chore(package): unpin version 2016-06-21 12:17:30 -07:00
vsavkin a717da2d3e chore(router): bump up version number 2016-06-21 12:17:30 -07:00
vsavkin b3e801ed9e feat(router): make it work with TypeScript 1.8 2016-06-21 12:17:30 -07:00
vsavkin 3683fb6886 refactor(router): minor refactoring 2016-06-21 12:17:30 -07:00
vsavkin 3bd0ce291e feat(router): mark the index property as deprecated
Use {path: '', component: A} instead of {index: true, component: A}

}#
2016-06-21 12:17:30 -07:00
vsavkin 523fc5536c fix(router): fix Params type to allow passing any value types when calling router.navigate 2016-06-21 12:17:30 -07:00
vsavkin f5efccfb44 test(router): test update location when route does not change 2016-06-21 12:17:30 -07:00
vsavkin b6ec22de6b test(router): test empty url with global redirect 2016-06-21 12:17:30 -07:00
Rob Wormald 15f27b5455 fix(providers): make providers static analysis friendly 2016-06-21 12:17:30 -07:00
vsavkin 127401598b feat(router): implement terminal 2016-06-21 12:17:30 -07:00
vsavkin 503b07f698 docs(router): add a README 2016-06-21 12:17:30 -07:00
vsavkin f0a6329005 fix(router): fixes a typo 2016-06-21 12:17:30 -07:00
vsavkin 2982892acc cleanup(router): clang-format 2016-06-21 12:17:30 -07:00
vsavkin 9de56481f1 feat(router): add enableTracing option 2016-06-21 12:17:30 -07:00
vsavkin 777eb2f159 feat(router): emit an event when routes are recognized 2016-06-21 12:17:30 -07:00
vsavkin 05eebe0fed feat(router): provide meaningful toString impls 2016-06-21 12:17:30 -07:00
vsavkin fdfbbd5bac chore(router): bump up version number 2016-06-21 12:17:30 -07:00
vsavkin 1f3f8ef6c8 fix(router): fix nested deactivation 2016-06-21 12:17:30 -07:00
vsavkin 820eeb49d1 chore(router): bump up version number 2016-06-21 12:17:30 -07:00
vsavkin 2d4be1c9eb fix(router): init is not triggered in certain scenarios 2016-06-21 12:17:30 -07:00
vsavkin 2fef30f619 fix(router): make stringify handle nulls 2016-06-21 12:17:30 -07:00
vsavkin 10113b63b5 chore(router): bump up version number 2016-06-21 12:17:30 -07:00
vsavkin 545caab433 fix(router): use bootstrap listener to trigger initial navigation 2016-06-21 12:17:30 -07:00
vsavkin 3f90659cc1 fix(router): supports index routes with path 2016-06-21 12:17:30 -07:00
vsavkin 131914ac94 fix(router): fix lazy loading issues 2016-06-21 12:17:30 -07:00
vsavkin 29a7c4538c Revert "fix(provider): fix a circular dependency & remove common providers"
This reverts commit 6375fdd4f2928d5ddeccaf11a8589a7668bc9049.
2016-06-21 12:17:30 -07:00
vsavkin f195bb608c chore(router): update config before publishing to npm 2016-06-21 12:17:30 -07:00
vsavkin 66caabca0c feat(router): implement redirectTo 2016-06-21 12:17:30 -07:00
Victor Berchet 25c6a3715d fix(provider): fix a circular dependency & remove common providers 2016-06-21 12:17:30 -07:00
Mike Ryan 97cf0e40d5 fix(guards): Cancel in-flight guards if one returns false 2016-06-21 12:17:30 -07:00
vsavkin 6988a550ea cleanup(router): fix tslint errors 2016-06-21 12:17:30 -07:00
Victor Berchet 8a1cdc2dd5 chore: install typings with npm i 2016-06-21 12:17:30 -07:00
Victor Berchet dadd5ddded chore: add lint and clang-format 2016-06-21 12:17:30 -07:00
vsavkin 56f8c95ee9 tests(router): add tests verifying that updating secondary segments using router link works 2016-06-21 12:17:30 -07:00
vsavkin ed50e17e5b refactor(router): rename queryParameters into queryParams 2016-06-21 12:17:30 -07:00
vsavkin 33b518ad21 feat(router): update RouterLink to support query params and fragment 2016-06-21 12:17:30 -07:00
vsavkin b0e7c14545 fix(router): add an app initializer to trigger initial navigation
Closes #10
2016-06-21 12:17:30 -07:00
vsavkin 5742d4720a fix(router): fix router to handle guards that return observable
Closes #19
2016-06-21 12:17:30 -07:00
vsavkin 9b356d9b86 fix(router): traverse route config in depth-first order
Closes #17
2016-06-21 12:17:30 -07:00
Brandon Roberts 793ac3f6b4 Configure router with provided routes
Closes #9
2016-06-21 12:17:30 -07:00
vsavkin 9b094e42a3 chore(router): update the npm dist 2016-06-21 12:17:30 -07:00
vsavkin 6ce7a5a1ea docs(router): add docs 2016-06-21 12:17:30 -07:00
vsavkin 88920bfee1 feat(router): add support for basic events 2016-06-21 12:17:30 -07:00
vsavkin 2717bcc3af feat(router): implement cancelation 2016-06-21 12:17:30 -07:00
vsavkin 5d386dc426 chore(router): update build dir 2016-06-21 12:17:30 -07:00
vsavkin f34af4f249 feat(router): add support for using classes as guard 2016-06-21 12:17:30 -07:00
vsavkin f04b6978fb cleanup(router): add @internal to constructors where needed 2016-06-21 12:17:30 -07:00
vsavkin ab958598d7 feat(router): implement CandDeactivate 2016-06-21 12:17:30 -07:00
vsavkin 1914847e72 cleanup(router): make strictNullChecks happy 2016-06-21 12:17:30 -07:00
vsavkin d95f0fd83d fix(router): fix index routes 2016-06-21 12:17:30 -07:00
vsavkin 243612e36d refactor(router): rename candidate into snapshot 2016-06-21 12:17:30 -07:00
vsavkin c5cca8e098 feat(router): add support for CanActivate guard 2016-06-21 12:17:30 -07:00
vsavkin 99f7404d8b refactor(router): remove rootNode function 2016-06-21 12:17:30 -07:00
vsavkin 9ff6b0828f feat(router): make activation sync 2016-06-21 12:17:30 -07:00
vsavkin 6f052d1daf feat(router): add a function to resolve components 2016-06-21 12:17:30 -07:00
vsavkin 63c194b71f feat(router): change recognize to return a router state candidate 2016-06-21 12:17:30 -07:00
vsavkin 46911117f1 feat(router): implement a function create router state out of a candidate 2016-06-21 12:17:30 -07:00
vsavkin 2de1030413 feat(router): add RouterStateCandidate 2016-06-21 12:17:30 -07:00
vsavkin 1f6ade894e cleanup(router): fix a typo 2016-06-21 12:17:30 -07:00
vsavkin 8407cfeac7 fix(router): fix router to take root component type instead of instance 2016-06-21 12:17:30 -07:00
vsavkin 91d64a2855 feat(router): export provideRouter via index 2016-06-21 12:17:30 -07:00
vsavkin 40a06af79b feat(router): add provideRouter to configure the router when bootstrapping an app 2016-06-21 12:17:30 -07:00
vsavkin 8aef86f4a0 feat(router): export all public api tokens via index 2016-06-21 12:17:30 -07:00
vsavkin 5bdc6ecec8 chore: adds the build dir to use with 'npm install' 2016-06-21 12:17:30 -07:00
vsavkin c179b5033b feat(router): implement relative navigation 2016-06-21 12:17:30 -07:00
vsavkin 86f47273bc feat(router): changes router config not to use names 2016-06-21 12:17:30 -07:00
vsavkin 2e1bd46bb1 feat(router): add createUrlTree 2016-06-21 12:17:30 -07:00
vsavkin a9e773b47b feat(router): serialize outlet names into the url 2016-06-21 12:17:30 -07:00
vsavkin 10d38cbb72 chore(router): change karma reporter 2016-06-21 12:17:30 -07:00
vsavkin a5371bfb8a cleanup: cleanup tsconfig files 2016-06-21 12:17:30 -07:00
vsavkin 4b2740f270 refactor: move index.ts into src 2016-06-21 12:17:30 -07:00
vsavkin 5b371736b2 feat: add RouterLink 2016-06-21 12:17:30 -07:00
vsavkin c9b4bcf689 refactor: move all utility functions into the utils dir 2016-06-21 12:17:30 -07:00
vsavkin 013f9a2bbc feat: add tree.siblings 2016-06-21 12:17:30 -07:00
vsavkin 5bf1c93ead docs: adds missing api docs 2016-06-21 12:17:30 -07:00
vsavkin 4f6ec01932 feat: implement a simple version of the router service 2016-06-21 12:17:30 -07:00
vsavkin 0f79e504c9 test: set up karma to support fakeAsync 2016-06-21 12:17:30 -07:00
vsavkin 1a4e911b8b cleanup: fix type errors when compiling with strictNullChecks enabled 2016-06-21 12:17:30 -07:00
vsavkin 1f98519380 feat: implement RouterOutletMap 2016-06-21 12:17:30 -07:00
vsavkin aad7010952 feat: add RouterOutlet 2016-06-21 12:17:30 -07:00