Commit Graph

449 Commits

Author SHA1 Message Date
Stephen Fluin 0d806c84e2 docs: add developer survey 2020 (#35655)
PR Close #35655
2020-03-11 16:10:47 -07:00
Sonu Kapoor 3b0b90527e fix(docs-infra): add top level folders into `topLevelFolders` (#35815)
Closes #35676

PR Close #35815
2020-03-03 08:59:10 -08:00
Sonu Kapoor 0a5a841994 test(docs-infra): add proxy to fake images in tests (#35741)
Previously, when running the unit tests for aio on Windows, many 404s
are logged for images, resulting in progress logs being spread over
multiple lines. This commit fixes this by adding a `proxy` to point
the fake image to a real image within the `src` folder.

Closes #29775

PR Close #35741
2020-03-02 08:16:34 -08:00
Sonu Kapoor de4e17b76e fix(docs-infra): fix redirect in angular version selector (#35632)
Closes #35630

PR Close #35632
2020-02-28 07:11:33 -08:00
ajitsinghkaler 01ab168774 feat(docs-infra): add useful links if landed on 404 page and no search results found (#34978)
Added additional links which can help user find the things they are
looking for when there are no search results (when searching or on a 404
page).

Note:
This commit increases the main bundle's payload size due to the extra
content of the `aio-search-results` component.

Fixes #31532

PR Close #34978
2020-02-27 11:01:59 -08:00
Sonu Kapoor 0b97d07ad6 test(docs-infra): fix tests with new `topics` property (#35539)
PR Close #35539
2020-02-27 10:47:52 -08:00
Sonu Kapoor 7ca2a2a863 feat(docs-infra): add `searchKeywords` preprocessor (#35539)
This commit adds a new preprocessor to use `${@searchKeywords}`, allowing
the docs to use a list of custom search phrases that will be
prioritized over the keywords found in the content.

Closes #35449

PR Close #35539
2020-02-27 10:47:52 -08:00
George Kalpakas 975a11b37f fix(docs-infra): do not break when cookies are disabled in the browser (#35557)
Whenever cookies are disabled in the browser, `window.localStorage` is
not avaialable to the app (i.e. even trying to access
`window.localStorage` throws an error).

To avoid breaking the app, we use a no-op `Storage` implementation if
`window.localStorage` is not available.

(This is similar to #33829, but for `localStorage` instead of
`sessionStorage`.)

Fixes #35555

PR Close #35557
2020-02-26 12:54:54 -08:00
George Kalpakas 2aa940f55c fix(docs-infra): highlight the currently active node in top-bar (#33351)
Related to #33239 and #33255.

PR Close #33351
2020-02-20 10:52:54 -08:00
George Kalpakas 34b84f61e0 fix(docs-infra): use `.tooltip` in `aio-top-menu` items (#33351)
The top-menu items have both a `title` and a `tooltip` property. The
`title` is used as text content, so there is little point in using it as
"tooltip" (via the HTMLElement's `title` property) too.

This commit switches to using the `tooltip` property to populate the
`title`. Note that in many cases, the `tooltip` property is derived from
`title` anyway (so there is no practical change in behavior in these
cases).

PR Close #33351
2020-02-20 10:52:53 -08:00
Sonu Kapoor 2f18e8565e style(docs-infra): properly format files (#35318)
PR Close #35318
2020-02-18 12:45:07 -08:00
Sonu Kapoor a788d585f8 fix(docs-infra): preserves query and hash when switching angular versions (#35318)
Previously, when switching angular versions through the
version selector in the sidenav, the query and hash is lost.
The user has to manually navigate to the original location again.

This commit fixes this issue and preserves the query and hash
when navigating between different versions.

Closes #24495

PR Close #35318
2020-02-18 12:45:07 -08:00
ajitsinghkaler 2d5bb26b02 fix(docs-infra): lighthouse reporting links to cross-origin destinations are unsafe (#35253)
Light house was reporting in best practices that our cross origin links are a unsafe so aded rel=noopener according to light houe suggestion link to the article https://web.dev/external-anchors-use-rel-noopener/\?utm_source\=lighthouse\&utm_medium\=lr

PR Close #35253
2020-02-10 09:23:30 -08:00
ajitsinghkaler aed5c7caad feat(docs-infra): add stable to the list of api statuses (#34981)
Earlier api can be filtered based on security risk and deprecated now added stable as a status for better user experience

Fixes #30396

PR Close #34981
2020-02-04 15:57:14 -08:00
ajitsinghkaler e672b1f2ac feat(docs-infra): change navigation in resources page (#34756)
https://angular.io/resources needs to be sturctured to be able to navigate to all resources with improved user experience. A lone scroll bar in this page will not help the reader a great deal in exploring the resources

Fixes #33526

PR Close #34756
2020-01-31 11:27:09 -08:00
ajitsinghkaler 7431206247 refactor(docs-infra): remove unused functions in resources component page (#34756)
In resources component there were unused functions removed unused funtions

PR Close #34756
2020-01-31 11:27:09 -08:00
Adam 55037d1107 build: bump year (#34651)
PR Close #34651
2020-01-13 07:21:43 -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
Pawel Kozlowski a781800276 refactor(ivy): remove usage of Proxy for IE10/11 compatibility (#34328)
PR Close #34328
2019-12-13 10:53:41 -08:00
George Kalpakas 9e45203679 test(docs-infra): more thoroughly clean up after `ScrollService` tests (#33937)
By clearing `sessionStorage` and unsubscribing from `Location` events,
after each test, we reduce the possibility of potential
[spooky action at a distance][1]-type of failures in the future.

This does not have an impact on the actual app, since `ScrollService` is
currently expected to live throughout the lifetime of the app. Still,
unsubscribing from `Location` events keeps the code consistent with how
other `ScrollService` listeners are handled (e.g. for `window` events).

[1]: https://en.wikipedia.org/wiki/Action_at_a_distance_(computer_programming)

PR Close #33937
2019-11-20 11:04:12 -08:00
George Kalpakas b7fd86ec50 test(docs-infra): destroy all `ScrollService` instances after each test (#33937)
`ScrollService` subscribes to global `window` events and mutates global
state in the listener (e.g. read/write values from/to `sessionStorage`).
Therefore, we need to always call its `ngOnDestroy()` method to
unsubscribe from these events after each test.

In f69c6e204, a new testcase was introduced that was not destroyed. As a
result, random failures started to randomly happen in other, unrelated
tests ([example CI failure][1]).

This commit fixes this by ensuring all `ScrollService` instances are
destroyed after each tests (provided that they are created with the
`createScrollService()` helper).

[1]: https://circleci.com/gh/angular/angular/533298

PR Close #33937
2019-11-20 11:04:12 -08:00
ajitsinghkaler f69c6e204a fix(docs-infra): do not break when cookies are disabled in the browser (#33829)
Whenever cookies are disabled in the browser, `window.sessionStorage` is not avaialable to the app (i.e. even trying to access `window.sessionStorage` throws an error).

To avoid breaking the app, we use a no-op `Storage` implementation if `window.sessionStorage` is not available.

Fixes #33795

PR Close #33829
2019-11-19 11:42:11 -08:00
George Kalpakas 43ac02e566 fix(docs-infra): scroll to top when navigating to new page via address bar (#33344)
Previously, when navigating to a new page via a link, the scroll
position was correctly restored to 0, but navigating to a new page via
typing the URL in the browser address bar keeps the old scroll position.

This commit ensures that the scroll position is restored to 0 whenever
the `ScrollService` is instantiated anew (i.e. new page navigation). The
old behavior of retaining the scroll position on reload is kept by
storing the old URL when leaving a page and only applying the stored
scroll position if the new URL matches the stored one.

Fixes #33260

PR Close #33344
2019-10-23 09:12:02 -07:00
Matias Niemelä f45c43188f fix(ivy): ensure errors are thrown during checkNoChanges for style/class bindings (#33103)
Prior to this fix, all style/class bindings (e.g. `[style]` and
`[class.foo]`) would quietly update a binding value if and when the
current binding value changes during checkNoChanges.

With this patch, all styling instructions will properly check to see
if the value has changed during the second pass of detectChanges()
if checkNoChanges is active.

PR Close #33103
2019-10-17 16:46:49 -04:00
George Kalpakas 6bc016f3fa build(docs-infra): update @angular/* to 9.0.0-next.10 (#33099)
Also, remove work-around for template type-checking issue that was fixed
in #31371.

Fixes #33051

PR Close #33099
2019-10-15 16:48:29 +00:00
JoostK cd7b199219 feat(ivy): check regular attributes that correspond with directive inputs (#33066)
Prior to this change, a static attribute that corresponds with a
directive's input would not be type-checked against the type of the
input. This is unfortunate, as a static value always has type `string`,
whereas the directive's input type might be something different. This
typically occurs when a developer forgets to enclose the attribute name
in brackets to make it a property binding.

This commit lets static attributes be considered as bindings with string
values, so that they will be properly type-checked.

PR Close #33066
2019-10-14 20:25:20 +00:00
JoostK f05999730a build(docs-infra): fix template type check errors (#33066)
In #33066 a limitation of Ivy's template type checker was fixed, where
all directive inputs would incorrectly allow `undefined` to be passed,
even when the input's type did not allow for it. Due to the fix, some
additional type errors were uncovered in AIO, where potential
`undefined` values would be passed to inputs that were not typed to
allow `undefined`.

PR Close #33066
2019-10-14 20:25:20 +00:00
George Kalpakas 3001716a2f test(docs-infra): ensure spy returns new observable every time (#32980)
Previously, some spies in `DovViewerComponent` tests would return the
same `of(undefined)` observable for all invocations of the spy in a
test. While there is usually only one invocation per spy in each test,
this is not always the case. In case of multiple invocations within the
same test, subsequent calls would return an already completed
observable, which deviates from the actual behavior of the spied
function.

This commit fixes it by ensuring a fresh `of(undefined)` observable is
returned on each invocation.

PR Close #32980
2019-10-10 13:56:15 -07:00
George Kalpakas d349cd91b1 refactor(docs-infra): fix some linting warnings (#32980)
PR Close #32980
2019-10-10 13:56:14 -07:00
George Kalpakas a2d2a5d572 build(docs-infra): enable `fullTemplateTypeCheck` (and fix failures) (#32980)
PR Close #32980
2019-10-10 13:56:14 -07:00
George Kalpakas b2666a2857 build(docs-infra): enable more TypeScript strictness flags (#32980)
PR Close #32980
2019-10-10 13:56:14 -07:00
George Kalpakas 4e1f37fc17 refactor(docs-infra): replace `mousewheel` event with `wheel` event (#32980)
This commit replaces the non-standard, depecated [mousewheel][1] event
(which is not supported in Firefox and possibly other browsers too) with
the standard [wheel][2] event, which works on all supported browsers
according to [MDN's compatibility table][3].

I manually tested it in Chrome, Firefox, Edge and IE11.

[1]: https://developer.mozilla.org/en-US/docs/Web/API/Element/mousewheel_event
[2]: https://developer.mozilla.org/en-US/docs/Web/API/Element/wheel_event
[3]: https://developer.mozilla.org/en-US/docs/Web/API/Element/wheel_event#Browser_compatibility

PR Close #32980
2019-10-10 13:56:14 -07:00
Koala 40d87dd801 docs: fix accessibility lint rules (#32661)
Add and fix accessibility rules, bump codelyzer to support pseudo events
for template-click-events-have-key-events rule.

PR Close #32661
2019-10-07 11:22:48 -07:00
George Kalpakas ea9245446f refactor(docs-infra): replace `System.import()` with `import()` (#32923)
`System.import()` has been deprecated in webpack and produces the
following warning when building the app:

```
WARNING in ./src/app/custom-elements/code/pretty-printer.service.ts
System.import() is deprecated and will be removed soon. Use import()
instead.
```

Switching to `import()` to get rid of the warning.

Fixes #30365
Closes #30419

PR Close #32923
2019-10-04 08:27:21 -07:00
George Kalpakas 85990c3213 fix(docs-infra): correctly run on IE11 (#32871)
Since 007282d2b, [TocService][1] uses [forEach()][2] to iterate over a
`NodeList`. This breaks in IE11, which does not support
`NodeList#forEach()`.

This commit wraps the returned `NodeList` in a regular `Array` to have
access to array methods (such as `forEach()`).

Fixes #32832

[1]: https://github.com/angular/angular/blob/fbad4ff65/aio/src/app/shared/toc.service.ts#L68
[2]: https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach

PR Close #32871
2019-09-26 17:05:38 -07:00
Carlos Ortiz García 9166baf709 refactor(core): Migrate TestBed.get to TestBed.inject (#32382)
This is cleanup/followup for PR #32200

PR Close #32382
2019-09-09 19:10:54 -04:00
George Kalpakas d4003452c7 fix(docs-infra): do not include GitHub links in Table of Content (#32418)
The docs template for cli commands ([cli-command.template.html][1])
includes an `h2` element with GitHub links for [long description][2].
Since the content of `h2` elements is replicated in the auto-generated
Table of Contents, the GitHub links were replicated as well (which is
undesirable).

This commit fixes it by explicitly excluding `.github-links` elements,
when extracting the content for the ToC (in
[TocService#extractHeadingSafeHtml()][3]). This is similar to what we do
for the auto-generated `.header-link` anchors.

[1]: https://github.com/angular/angular/blob/1537791f0/aio/tools/transforms/templates/cli/cli-command.template.html
[2]: https://github.com/angular/angular/blob/1537791f0/aio/tools/transforms/templates/cli/cli-command.template.html#L18
[3]: https://github.com/angular/angular/blob/1537791f0/aio/src/app/shared/toc.service.ts#L56

PR Close #32418
2019-09-05 13:33:06 -04:00
George Kalpakas 007282d2bb fix(docs-infra): exclude heading anchor icon text from ToC tooltips (#32418)
The Table of Contents (ToC) is auto-generated based on the content of
heading elements on the page. At the same time, anchor links are
auto-generated and added to each heading element. Note that the Material
Icons used for the anchor icon make use of ligatures, which means that
the icons are specified by using their textual name as text content of
the icon element. As a result, the name of the icon is included in the
parent element's `textContent`.

Previously, the `TocService` used to strip off these anchor elements
when generating the content of ToC items, but not when generating the
content of their tooltips. Thus, tooltips for ToC items would
confusingly include a `link` suffix (`link` is the textual name of the
icon used in heading anchor links).

This commit fixes this by deriving the tooltip content from the
transformed text content (which already has anchor links stripped off),
instead of from the original heading content.

PR Close #32418
2019-09-05 13:33:06 -04:00
Carlos Ortiz García 3aba7ebe6a feat(core): Introduce TestBed.inject to replace TestBed.get (#32200)
TestBed.get is not type safe, fixing it would be a massive breaking
change. The Angular team has proposed replacing it with TestBed.inject
and deprecate TestBed.get.

Deprecation from TestBed.get will come as a separate commit.

Issue #26491
Fixes #29905

BREAKING CHANGE: Injector.get now accepts abstract classes to return
type-safe values. Previous implementation returned `any` through the
deprecated implementation.

PR Close #32200
2019-08-28 21:26:46 -07:00
George Kalpakas dd0be7feb7 fix(docs-infra): always default to no linenums in `<aio-code>` (#31674)
Previously, `linenums` defaulted to true if the content was more than 10
lines long and false otherwise.

Since in most cases linenums add unnecessary visual noise, this commit
changes `linenums` to always default to false (regardless of the size of
the content). It can be still be turned on by explicitly setting to true
or a number.

PR Close #31674
2019-07-24 14:38:54 -07:00
George Kalpakas b66d82e308 build(docs-infra): upgrade jasmine-/karma-related dependencies (#31527)
Note: `jasmine-ts` is intentionally held back at 0.2.1, because of a bug
in 0.3.0: svi3c/jasmine-ts#33

PR Close #31527
2019-07-18 10:17:13 -07:00
George Kalpakas d7ca263cc4 test(docs-infra): run tests in random order (and make them pass) (#31527)
This commit updates the necessary config files to run the angular.io and
docs tooling unit tests in random order (and fixes the tests that were
failing due to their dependence on the previous ordered execution).

Besides being a good idea anyway, running tests in random order is the
new [default behavior in jasmine@3.0.0][1], so this commit is in
preparation of upgrading jasmine to the latest version.

[1]: https://github.com/jasmine/jasmine/blob/v3.0.0/release_notes/3.0.md#breaking-changes

PR Close #31527
2019-07-18 10:17:13 -07:00
Stefanie Fluin 3a09d01c63 fix(docs-infra): fix API list search color and styles (#31272)
- Add more spacing to inputs.
- Correct placeholder colors in inputs.
- Add aria label to input for accessibility.
- Clean up layout styles and mobile view.

Fixes #31265

PR Close #31272
2019-07-12 17:55:02 -04:00
Stefanie Fluin a55c6df07b feat(docs-infra): add prominent archive mode banner styling (#31245)
Fixes #25968

PR Close #31245
2019-07-11 13:00:11 -04:00
George Kalpakas 0c00c94f34 test(docs-infra): clean up global listeners after `ScrollService` tests (#31390)
The `ScrollService` sets up some global `window` listeners.

Previously, these listeners were never unregistered. This was not a
problem in the real app, because the `ScrollService` instance exists for
the lifetime of a user session. In tests, however, where the `window`
instance is among all tests, the listeners would survive the
`ScrollService` tests. This, in addition to the fact that we used a mock
`ViewportScroller` which did not return the expected type from
`getScrollPosition()`, caused errors to be thrown in unrelated tests
(i.e. whenever a scroll event was emitted on `window`). See [here][1]
for an example failure.

This commit fixes it by adding an `ngOnDestroy()` method that
unregisters the listeners and ensuring it is called after each
`ScrollService` test.

[1]: https://circleci.com/gh/angular/angular/381649

PR Close #31390
2019-07-11 12:15:34 -04:00
George Kalpakas 9b29ca95a2 fix(docs-infra): show (and style correctly) the 'No results found' message (#31390)
PR Close #31390
2019-07-11 12:15:34 -04:00
Stefanie Fluin f7e9659c4d fix(docs-infra): return full width highlight to sidenav (#31246)
PR Close #31246
2019-06-24 20:17:27 -07:00
Stefanie Fluin c52ade2878 fix(docs-infra): fix search result header color (#30924)
PR Close #30924
2019-06-17 16:33:53 -07:00
George Kalpakas 87b1a2af4d refactor(docs-infra): avoid hard-coding URLs to redirect on archive mode (#30894)
Related discussion:
https://github.com/angular/angular/pull/30894#pullrequestreview-246731995

PR Close #30894
2019-06-11 00:07:43 +00:00
George Kalpakas a2cd401a2e fix(docs-infra): do not redirect docs URLs on archive deployments (#30894)
To avoid showing outdated info (such as events, resources, etc.) but
still allow people to see docs for older versions, we redirect
non-documentation URLs to `/docs`. Recently(-ish) we have added
documentation content under the `/cli/...` and `/start/...`
path-prefixes, but we haven't added them to the list of documentation
URLs that should not be redirected. As a result, on archive deployments
(e.g. https://v7.angular.io/cli), they are redirected to `/docs`, making
it impossible to see the documentation for these versions (unless you
know about the `?mode=stable` work-around).

This commit fixes it by adding `cli` and `start` to the list of
documentation URLs that are excluded from redirection.

PR Close #30894
2019-06-11 00:07:42 +00:00