fix(aio): fix scrolling to top (#17102)

Previously, the `#top-of-page` element (used when scrolling to top) was placed
inside the content section (which at the time had zero top margin and padding).
Furthermore, there was a top offset applied when scrolling that took the static
top bar's height into account. Since now the top bar is not static any more and
the content section has a non-zero top padding, scrolling to top does not work
as expected.

This commit fixes this by:
- Moving the `#top-of-page` element to the top of the `aio-shell`.
- Stop accounting for the top bar's top.

Fixes #17006
This commit is contained in:
George Kalpakas
2017-06-02 00:03:10 +03:00
committed by Victor Berchet
parent 068133ec85
commit 7822187b17
6 changed files with 39 additions and 5 deletions

View File

@ -41,6 +41,26 @@ describe('site App', function() {
expect(page.getInnerHtml(codeExample)).toContain('<h1>Tour of Heroes</h1>');
});
describe('scrolling to the top', () => {
it('should scroll to the top when navigating to another page', () => {
page.navigateTo('guide/docs');
page.scrollToBottom();
page.getScrollTop().then(scrollTop => expect(scrollTop).toBeGreaterThan(0));
page.navigateTo('guide/api');
page.getScrollTop().then(scrollTop => expect(scrollTop).toBe(0));
});
it('should scroll to the top when navigating to the same page', () => {
page.navigateTo('guide/docs');
page.scrollToBottom();
page.getScrollTop().then(scrollTop => expect(scrollTop).toBeGreaterThan(0));
page.navigateTo('guide/docs');
page.getScrollTop().then(scrollTop => expect(scrollTop).toBe(0));
});
});
describe('api-docs', () => {
it('should show a link to github', () => {
page.navigateTo('api/common/NgClass');