Commit Graph

703 Commits

Author SHA1 Message Date
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
Stefanie Fluin fe4447d568 feat(docs-infra): simplify image styles and remove figure references (#33748)
Reference #33259
Removes figures elements as AIO is not typically using captions or image groups where figures would be necessary or appropriate

PR Close #33748
2019-11-14 09:27:02 -08:00
Stefanie Fluin ba29e4d953 feat(docs-infra): implement figure styles (#33259)
PR#28396 originally addressed an update via issue #23983 to make images more visible with a white background (implementation of gray "lightbox").

This PR implements those styles defined in PR#28396.

PR Close #33259
2019-10-23 12:59:34 -07: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 090732fc2d fix(docs-infra): show hamburger button on getting started guide (#32941)
In 1c3ee4190, the `getting-started` guide/tutorial was renamed to
`start`, but the corresponding CSS class that controls the display of
the top-left hamburger (and it automatically derived based on the URL)
was not updated.

This commit updates the class to ensure that the hamburger is not hidden
when navigating to the getting started guide.

PR Close #32941
2019-10-02 09:20:22 -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
Kapunahele Wong 984d23f687 fix(docs-infra): fix broken toc ul styles (#32124)
Fixes #32027

PR Close #32124
2019-08-14 12:01:17 -07:00
Stefanie Fluin 382d3ed1d2 fix(docs-infra): ui polish (#31013)
- Change margin to the header so that the the label aligns with the header
- Make code in API pages pre-wrap so that you can see the actual text on the screen - helps with issue #27296
- Modified text to be title case in label API to be consistent with rest of app labels
- Removed unused table of contents SCSS file
- TOC SCSS file reorg cleanup
- Soften headers font-weight in API pages
- Make linenums ordered list inside code examples always show as numbers

PR Close #31013
2019-08-05 12:53:02 -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
Stefanie Fluin c845a7b887 fix(docs-infra): fix logo to have branded red color (#31663)
Replace logo nav 2x logo file with one that has the correct branding red color in shield

PR Close #31663
2019-07-22 09:54:00 -07:00
Stefanie Fluin b9a94c6d02 fix(docs-infra): improve small screen experience for docs cards layout (#31576)
- Make docs cards expand to full width in smaller screen sizes.
- Reduce spacing around card container to match general spacing patterns seen in angular.io.
- Improve SCSS formatting.

PR Close #31576
2019-07-22 09:51:11 -07:00
Stefanie Fluin ebc71f7caa fix(docs-infra): fix mobile toc styles (#31533)
Return mobile toc styles from bug in PR#31013
Give docs pages header a width limit so it does not run into the Github icon link

PR Close #31533
2019-07-22 09:50:21 -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
Stefanie Fluin d33204956f fix(docs-infra): fix code hover style in TOC (#31173)
Fixes #31170

PR Close #31173
2019-07-11 12:57:32 -04:00
Tzvi Melamed 66d6b53fb1 fix(docs-infra): fix get started button rendering (#31470)
Fixes #31454

PR Close #31470
2019-07-11 12:56:29 -04:00
George Kalpakas e85fa5d4ff fix(docs-infra): fix layout of `file-not-found` page (#31390)
The `.sidenav-content` element, [which is also][1] the `#file-not-found`
element, [already has][2] the necessary padding. Especially the top
padding is important to ensure the element is not obscured by the
top-bar.

[1]: https://github.com/angular/angular/blob/1d3e22766/aio/src/app/app.component.html#L51
[2]: https://github.com/angular/angular/blob/1d3e22766/aio/src/styles/1-layouts/_content-layout.scss#L10

PR Close #31390
2019-07-11 12:15:34 -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
George Kalpakas 479d926b4b fix(docs-infra): improve `search-results` layout on smaller screens (#31390)
Previously, the `search-results` layout was switch from horizontal to
vertical at 480px. Yes, since some search queries can yield more than 5
`.search-area`s, even 600px are too narrow to accomodate a horizontal
layout.

This commit changes the breakpoint at which the layout switches to
vertical from 480px to 600px.

PR Close #31390
2019-07-11 12:15:34 -04:00
George Kalpakas b9195289a5 fix(docs-infra): remove redundant `search-results` styles (#31390)
Previously, `.search-area` had a default style of `display: flex`, but
it was overriden to `display: block` in media queries for
`max-width: 480px` and `min-width: 600px`. As a result, it only had
`display: flex` between 481px and 599px.

Since no flex layout features are necessary inside `.search-area`, this
commit changes the style to always be `display: block` (i.e. the default
for `div` elements).

PR Close #31390
2019-07-11 12:15:34 -04:00
George Kalpakas 75b6b0e1ba refactor(docs-infra): clean up `aio-search-results` styles (#31390)
PR Close #31390
2019-07-11 12:15:34 -04:00
George Kalpakas 2d4f507b61 style(docs-infra): make indentation in `_search-results.scss` consistent with other `.scss` files (#31390)
PR Close #31390
2019-07-11 12:15:34 -04:00
George Kalpakas 00ecfc7f9a fix(docs-infra): separate vendor-specific CSS selectors (#31252)
In #31118, some vendor-specific selectors were combined in one rule-set.
As pointed out in [this comment][1], this would result in the whole
rule-set being ignored by all browsers, since one invalid/unrecognized
selector invalidates the declaration block.

This commit fixes it by defining a separate rule-set per selector. The
list of vendor-specific selectors is also adjusted to better target the
currently supported browsers.

[1]: https://github.com/angular/angular/pull/31118/files#r296923652

PR Close #31252
2019-06-25 10:25:31 -07:00
George Kalpakas 6ff3970ec7 style(docs-infra): clean up some styles (#31252)
PR Close #31252
2019-06-25 10:25:31 -07: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 65974154e2 feat(docs-infra): change typography font sizes to be rem based (#31118)
PR Close #31118
2019-06-21 14:22:20 -07:00
Vani 5909c442b7 docs: update group() link to point to the animations group API (#30618)
PR Close #30618
2019-06-18 10:49:46 -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
Alan 82e0b4a4fb fix(docs-infra): enable only vertical scrolling for contributors bio (#30991)
- `auto` will enable scrolling only when needed
- `overflow-y` will ensure to keep the scrolling horizontally only

PR Close #30991
2019-06-12 11:47:13 -07:00
Stefanie Fluin 699283c4ee feat(docs-infra): layout ui polish (#30883)
PR Close #30883
2019-06-11 14:20:35 -07:00