Commit Graph

408 Commits

Author SHA1 Message Date
George Kalpakas f9bc84cd99 build(docs-infra): remove obsolete properties from `zipper.json` files (#36018)
The `removeSystemJsConfig` and `type` properties (present in some
`zipper.json` files) are now obsolete and are not taken into account by
the example zipper:
- `removeSystemJsConfig` is no longer relevant since most examples have
  been migrated to use the CLI.
- `type` is no longer relevant, because the project type is determined
  based on the `projectType` property in `example-config.json` files.

This commit removes these properties from `zipper.json` files and
updates the `example-zipper` docs to not mention them.

PR Close #36018
2020-03-27 10:48:30 -07:00
Sonu Kapoor 9d415f9c3f fix(docs-infra): change `app-list-item` to `app-item-list` (#35601)
The `app-list-item` component sounds like it is used for a single
item, however it renders a list of items. There were also
several changes in the documentation, where it was becoming
confusing if the `app-list-item` is using a single item or multiple
items. This commit fixes this issue. It renames the component and its
respective properties to make sure that the intention is very clear.

Closes #35598

PR Close #35601
2020-03-23 11:40:15 -07:00
Sonu Kapoor 912692137a fix(docs-infra): fix image name in example (#36127)
Closes #35618

PR Close #36127
2020-03-20 10:20:36 -07:00
George Kalpakas 5007b97db6 build(docs-infra): clean up dependencies and npm scripts in `systemjs` docs examples (#36015)
Previously, the `package.json` files added as boilerplate to docs
example projects of type `systemjs` were incorrect/outdated. They
contained unused dependencies and npm scripts and omitted used
dependencies.

This is not a big issue, because these examples are not offered as live
StackBlitz examples or downloadable ZIP archives, but having incorrect
`package.json` files is confusing and makes it more complicated to
update these examples.

This commit updates the `package.json` templates for the `systemjs` docs
examples and other configuration files to include used dependencies (and
remove unused ones). It also removes unused npm scripts.

PR Close #36015
2020-03-18 10:00:02 -07:00
George Kalpakas f6adc0c3f9 build(docs-infra): update project structure to cli@9 10/12 (`tsconfig.json`) (#36015)
Update `tsconfig[.*].json`.
Also, all make necessary changes to ensure the example apps can be
successfully built with the new, stricter type-checking options.

PR Close #36015
2020-03-18 10:00:01 -07:00
George Kalpakas c9fd8e39f3 build(docs-infra): update project structure to cli@9 6/12 (`index.html`) (#36015)
Update `index.html` (mostly remove empty line).

PR Close #36015
2020-03-18 10:00:01 -07:00
George Kalpakas fc325c49ec build(docs-infra): update project structure to cli@9 3/12 (`title in a h1 tag`) (#36015)
Make test description less implementation specific.

PR Close #36015
2020-03-18 10:00:01 -07:00
George Kalpakas a8e936791b build(docs-infra): update project structure to cli@9 2/12 (`fixture.debugElement.componentInstance`) (#36015)
`fixture.debugElement.componentInstance` --> `fixture.componentInstance`

PR Close #36015
2020-03-18 10:00:01 -07:00
George Kalpakas 5a7ac8c3b9 build(docs-infra): avoid Karma error when loading scripts from code.angularjs.org (#36015)
In the example apps used in the `ngUpgrade` guide, the AngularJS files
are loaded in `index.html` from `https://code.angularjs.org/`. Latest
browsers prevent loading the scripts from a page running on localhost
due to CORS:

```
Access to script at 'https://code.angularjs.org/1.5.5/angular.js' from origin
'http://localhost:9876' has been blocked by CORS policy: No 'Access-Control-Allow-Origin'
header is present on the requested resource.
```

NOTE:
Loading the files from `code.angularjs.org` is not mentioned in the
guide, therefore it is not needed to mention this config change there.

PR Close #36015
2020-03-18 10:00:01 -07:00
George Kalpakas 21b8d6956a build(docs-infra): remove obsolete content from `example-config.json` files (#36015)
The `build` and `run` properties in `example-config.json` are only used
in example projects of type `systemjs`. In CLI-type projects, `build`
and `run` are ignored.

PR Close #36015
2020-03-18 10:00:01 -07:00
George Kalpakas cc238e6377 build(docs-infra): remove obsolete content from `example-config.json` in `setup` example (#36015)
The `unittesting` property in `example-config.json` is a remnant of the
setup (before `aio/` was moved into the `angular/angular` repo) and has
no effect any more.

PR Close #36015
2020-03-18 10:00:01 -07:00
George Kalpakas df7504ade1 build(docs-infra): remove unused `ngmodule-faq` and `visual-studio-2015` examples (#36015)
PR Close #36015
2020-03-18 10:00:01 -07:00
George Kalpakas fbed0a1471 build(docs-infra): remove unused `test.html` file from `testing` example (#36015)
This file was from back when the `testing` example was not based on the
Angular CLI and is not used any more.

PR Close #36015
2020-03-18 10:00:01 -07:00
Sonu Kapoor 6b4c5289b3 fix(docs-infra): remove `routerLink` from `top-bar` (#35951)
Closes #35947

PR Close #35951
2020-03-13 08:25:39 -07:00
Yvonne Allen 5af0e7523c fix(docs-infra): add boilerplate path and project type for elements example project (#33484)
Fixes #31332

PR Close #33484
2020-03-11 14:52:59 -04:00
tresor616 99ce015f42 refactor: export silentLogger not SilentLoggerFn (#34079)
Export SilentLogger object instead of the SilentLoggerFn and capitalise silentLoggerFn instead of the SilentLoggerFn
PR Close #34079
2020-03-06 17:37:12 -05:00
George Kalpakas bf42807aa6 docs(common): switch HTTP guide examples to `TestBed.inject()` (#35777)
`TestBed.get()` has been [deprecated in v9][1], in favor of
`TestBed.inject()`. In ##32382, the HTTP guide wording has been updated
to mention `TestBed.inject()` instead of `TestBed.get()`, but the
associated code snippets (extracted from the `http` example) were not.

This commit updates the HTTP guide examples to also use
`TestBed.inject()`.

[1]: https://v9.angular.io/guide/deprecations#testing

Fixes #35609

PR Close #35777
2020-03-03 08:57:18 -08:00
George Kalpakas 8eb4a9d395 docs: fix docs and associated code snippets for enabling more macro tasks in `fakeAsync()` (#35778)
In the `testing` guide, there is a section discussing configuring
`fakeAsync()` to handle more macro tasks (e.g.
`HTMLCanvasElement#toBlob()`).

Previously, the corresponding code snippets (some of which were
hard-coded in the guide) were incorrect/incomplete and the associated
tests were broken. This was discovered while enabling docs examples unit
tests in #34374.

This commit fixes the code snippets and associated tests and ensures the
examples used in the guide come from an example app (i.e. are not
hard-coded).

Note: The docs examples unit tests are currently not run on CI. This
will be fixed in #34374.

PR Close #35778
2020-03-02 13:30:25 -08:00
Sonu Kapoor a7d5c55926 docs: fix routing code to use `navigate` (#35176)
Previously, the example in the `router` guide was not
preserving the query params after logging in.

This commit fixes this by using `navigate` instead of
using `navigateByUrl`, which ignores any properties in
the `NavigationExtras` that would change the provided URL.

Fixes 34917

PR Close #35176
2020-02-24 09:00:03 -08:00
JiaLiPassion 17b862cf82 feat: add an tickOptions parameter with property processNewMacroTasksSynchronously. (#33838)
This option will control whether to invoke the new macro tasks when ticking.

Close #33799

PR Close #33838
2020-02-20 15:14:59 -08:00
George Kalpakas bdfe71ae93 build(docs-infra): use `puppeteer` to get a browser for docs examples tests (#35381)
In #35049, integration and AIO tests were changed to use the browser
provided by `puppeteer` in tests. This commit switches the docs examples
tests to use the same setup.

IMPLEMENTATION NOTE:
The examples are used to create ZIP archives that docs users can
download to experiment with. Since we want the downloaded projects to
resemble an `@angular/cli` generated project, we do not want to affect
the project's Protractor configuration in order to use `puppeteer`.

To achieve this, a second Protractor configuration is created (which is
ignored when creating the ZIP archives) that extends the original one
and passes the approperiate arguments to use the browser provided by
`puppeteer`. This new configuration (`protractor-puppeteer.conf.js`) is
used when running the docs examples tests (on CI or locally during
development).

PR Close #35381
2020-02-18 12:42:47 -08:00
Aristeidis Bampakos 9ca1faf865 docs: Fix minor typos and coding styles (#35325)
- Fix minor typos in the Getting Started, Forms and AOT Compiler guide.
- Fix minor typo in the Tour of Heroes app.
- Fix coding styles in the Getting Started guide and the Tour of Heroes app

PR Close #35325
2020-02-13 13:31:30 -08:00
ajitsinghkaler e8ea3be843 docs: remove service from region where it was added before it was created (#35354)
The message service was added in a section create message service but was impoted much before it removed those imports because they can be confusing

Fixes #35259

PR Close #35354
2020-02-12 16:46:22 -08:00
Oleg Teterin 79742a397f fix(docs-infra): fix parameters with @Optional() decorator do not match declared, optional type (#35150)
PR Close #35150
2020-02-07 09:58:31 -08:00
Kara Erickson 7526ef77b7 docs(ivy): add docs for styling priority order (#35066)
PR Close #35066
2020-02-06 09:33:28 -08:00
Kara Erickson 4e9d62ff81 docs(ivy): update style binding docs to v9 behavior (#35066)
PR Close #35066
2020-02-06 09:33:28 -08:00
Kara Erickson a08f6d9795 docs(ivy): clean up class binding docs and update to v9 behavior (#35066)
PR Close #35066
2020-02-06 09:33:28 -08:00
Joey Perrott 960e5e25e5 docs(animations): increase wait time for status-slider animation (#35089)
Because the animation completes in 2000ms, and browser.wait checks
every 100ms, there can be a race condition of if the final state has
actually been reached to read the color. By moving to 2101ms, we ensure
that we cheack after the 2000ms of the animation has completed.

PR Close #35089
2020-02-04 15:57:37 -08:00
Kapunahele Wong 7369dd6f24 docs: fix animations example/remove 1st person (#35046)
Fixes #34940 and removes first person from transitions-triggers.md

PR Close #35046
2020-02-04 08:58:04 -08:00
Sonu Kapoor f49b45832c build(docs-infra): always specify a landing file for StackBlitz projects (#34553)
The StackBlitz API (which we use to generate StackBlitz projects on the
fly, when a user clicks on a live example link in the docs) allows
specifying the file to open in the editor by passing a query param. If
no file is specified, StackBlitz opens a default one. In the past, it
used to be `main.ts` and nowadays it seems to be `app.component.ts`.

StackBlitz builder, the tool that we use to generate the StackBlitz
projects, allows specifying the primary file by setting the `file`
property in the corresponding `stackblitz.json`.

Previously, if the `file` property was not set, StackBlitz builder would
not specify a file, thus falling back on StackBlitz's default behavior.
This was not great, because the default behavior may change unexpectedly
is the future to something that is less useful for our users.

This commit change StackBlitz builder to always specify a primary file.
If no file is specified in `stackblitz.json`, the builder will look
for the first file that exists in the example from a list of predefined
files.

Partially addresses #22357.

PR Close #34553
2020-01-22 13:45:23 -08:00
ajitsinghkaler 61ad50d40a docs: add message on click of hero in toh-4 (#34496)
First we used a messages array to display messages toh-4 but it dsplayed only one message added additional messages on click of a hero

Fixes #28739

PR Close #34496
2020-01-22 14:42:55 -05:00
Sonu Kapoor def4127bf1 fix(docs-infra): convert hard-coded `comparing-observables` examples into a proper mini-app (#34327)
Previously, the examples in the `comparing-observables` guide were hard-coded.
This made it impossible to test them and verify they are correct.

This commit fixes this by converting them into a proper mini-app. In a
subsequent commit, tests will be added to verify that the source code
works as expected (and guard against regressions).

Fixes #31024

PR Close #34327
2020-01-21 13:14:46 -05:00
Sonu Kapoor 15ae924035 fix(docs-infra): convert hard-coded `cli-builder` examples into a proper mini-app (#34362)
Previously, the examples in the `cli-builder` guide were hard-coded.
This made it impossible to test them and verify they are correct.

This commit fixes this by converting them into a proper mini-app. In a
subsequent commit, tests will be added to verify that the source code
works as expected (and guard against regressions).

Fixes #34314

PR Close #34362
2020-01-21 13:12:18 -05:00
Kristina Gocheva b04c3cce09 docs: fix logging upon search in example tutorial (#34806)
When no errors are thrown but empty array is returned we should log different message.

PR Close #34806
2020-01-21 13:08:15 -05:00
Filipe Silva f5a4de7428 test(docs-infra): compile only app for examples with no e2e (#33717)
With TS 3.7, these examples were running into the error below (e.g. on https://circleci.com/gh/angular/angular/574906#tests/containers/0):

```
============== AIO example output for: /home/circleci/ng/aio/content/examples/observables/
running: yarn tsc --project ./
$ /home/circleci/ng/aio/content/examples/observables/node_modules/.bin/tsc --project ./
../../../tools/examples/shared/node_modules/protractor/built/index.d.ts(5,10): error TS2440: Import declaration conflicts with local declaration of 'PluginConfig'.
../../../tools/examples/shared/node_modules/protractor/built/index.d.ts(5,24): error TS2440: Import declaration conflicts with local declaration of 'ProtractorPlugin'.
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
completed: yarn tsc --project ./
```

This happened because of https://github.com/angular/protractor/issues/5348.

It's unclear why this typings problem does not affect `ng e2e` runs, and only affects `tsc` runs.

For now it seems sensible to alter the tests to compile only the app and not the e2e, since the intent of 2cc954d5a5 was never to verify the correctness of the e2e in the first place.

We still need a release of protractor that supports TS 3.7 though, but at least it doesn't seem to block our update proper.

PR Close #33717
2020-01-14 16:42:22 -08:00
ajitsinghkaler ebcd59ae4f docs: replace from class hero to interface with accordance with # 344022 (#34294)
Fixes #21186

PR Close #34294
2020-01-13 07:25:19 -08:00
arturovt 99cc7cdc15 docs: fix non-working example in the `Observables` section (#34705)
PR Close #34705
2020-01-09 13:27:15 -08:00
Alan Agius 8f389361ec docs: replace lazy loading import syntax parameter name (#34599)
We replace `mod` with `m` to be in line with what the CLI generates.

PR Close #34599
2020-01-07 10:44:12 -08:00
George Kalpakas 7cdc118c8e refactor(docs-infra): extract all `lazy-loading-ngmodules` examples from mini-app (#34599)
Previously, some of the examples in the `lazy-loading-ngmodules` guide
were hard-coded.

This commit ensures all examples in the guide are extracted from
docregions in the corresponding example project.

PR Close #34599
2020-01-07 10:44:12 -08:00
Kapunahele Wong 8410278b6d docs: copy edit getting started step 4 (#32839)
PR Close #32839
2020-01-06 10:59:37 -08:00
Sonu Kapoor 5f2897be0b docs(forms): Update catchError to return an `observable` (#34357)
Closes #34323

PR Close #34357
2019-12-11 13:19:57 -08:00
Kapunahele Wong 3805172f9c docs: edit copy of getting started step 3 (#32820)
PR Close #32820
2019-12-06 10:27:00 -08:00
Sonu Kapoor 2cc954d5a5 test(docs-infra): ensure RxJS-related docs examples can compile without errors (#34063)
Previously, some RxJS-related examples (which are not proper Angular apps) were not
tested on CI as part of the `example-e2e` npm script. This meant that the examples
could get out-of-date or contain compile errors without as noticing.

This commit ensures that the `example-e2e` script picks up these examples and checks
that they compile successfully.

Partly addresses #28017.

PR Close #34063
2019-12-02 11:02:13 -08:00
Nikita Potapenko 48a1acab52 docs: fix typo in sample (#33984)
Fixes #33979

PR Close #33984
2019-11-26 16:37:17 -05:00
Kapunahele Wong d655093123 docs: add Animations import in Router doc (#33740)
Fixes #33665

PR Close #33740
2019-11-25 22:37:55 -05:00
Kapunahele Wong 1ab2ebc719 docs: edit EventEmitter name in styleguide (#33923)
Fixes #33890

PR Close #33923
2019-11-25 18:40:51 -05:00
Charles Lyding 56f33bc266 docs: initial Ivy i18n guide updates (#33762)
PR Close #33762
2019-11-25 14:12:18 -05:00
ajitsinghkaler 1217c6b7cc docs: replace class hero to interface wherever class properties not used (#34022)
Fixes #21186

PR Close #34022
2019-11-25 11:37:39 -05:00
George Kalpakas 27562e92db fix(docs-infra): fix StackBlitz and zipped `http` examples (#33941)
Previously, the generated StackBlitz examples as well as the
corresponding downloadable zips for the `http` guide examples were not
correct and thus trying to run the app and/or tests would fail.

This commit fixes the examples:

- Replace `TestBed.inject()` (which was [introduced in v9][1]) with
  `TestBed.get()` (which is available in v8 used in the examples).
  (NOTE: The examples will soon be updated to v9 (as part of
  [FW-1609][2] and switched back to `TestBed.inject()` then.)

- Include `src/app/heroes/hero.ts` in the zip, because it is referenced
  by some of the other files and the compilation fails without it.

- Ensure `src/main-specs.ts` is not included in the zip that does not
  include the tests. Including the file broke the app, because there is
  logic in our zip-builder that renamed `main-*.ts` files to `main.ts`
  and thus `main-specs.ts` ended up overwriting the actual `main.ts`.

[1]: https://next.angular.io/guide/deprecations#angularcoretesting
[2]: https://angular-team.atlassian.net/browse/FW-1609

Fixes #33874
Fixes #33945

PR Close #33941
2019-11-20 14:44:31 -08:00
Santosh Yadav 6fadb7a3a4 docs: updated dynamic forms example (#31510)
Fixes #31446

PR Close #31510
2019-11-15 16:16:45 -08:00