build(aio): fix generated github links
The change from `modules` to `packages` needed to be applied to these links.
This commit is contained in:
parent
b4081e3713
commit
31ef92fc36
|
@ -17,6 +17,14 @@ describe('site App', function() {
|
||||||
|
|
||||||
it('should convert a doc with a code-example');
|
it('should convert a doc with a code-example');
|
||||||
|
|
||||||
|
describe('api-docs', () => {
|
||||||
|
it('should show a link to github', () => {
|
||||||
|
page.navigateTo('api/common/NgClass');
|
||||||
|
expect(page.ghLink.getAttribute('href'))
|
||||||
|
.toMatch(/https:\/\/github.com\/angular\/angular\/tree\/.+\/packages\/common\/src\/directives\/ng_class\.ts/);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('google analytics', () => {
|
describe('google analytics', () => {
|
||||||
beforeEach(done => page.gaReady.then(done));
|
beforeEach(done => page.gaReady.then(done));
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,22 @@
|
||||||
import { browser, element, by, promise } from 'protractor';
|
import { browser, element, by, promise, ElementFinder } from 'protractor';
|
||||||
|
|
||||||
|
const githubRegex = /https:\/\/github.com\/angular\/angular\//;
|
||||||
|
|
||||||
export class SitePage {
|
export class SitePage {
|
||||||
links = element.all(by.css('md-toolbar a'));
|
links = element.all(by.css('md-toolbar a'));
|
||||||
docViewer = element(by.css('aio-doc-viewer'));
|
docViewer = element(by.css('aio-doc-viewer'));
|
||||||
codeExample = element.all(by.css('aio-doc-viewer pre > code'));
|
codeExample = element.all(by.css('aio-doc-viewer pre > code'));
|
||||||
|
ghLink = this.docViewer
|
||||||
|
.all(by.css('a'))
|
||||||
|
.filter((a: ElementFinder) => a.getAttribute('href').then(href => githubRegex.test(href)))
|
||||||
|
.first();
|
||||||
featureLink = element(by.css('md-toolbar a[href="features"]'));
|
featureLink = element(by.css('md-toolbar a[href="features"]'));
|
||||||
gaReady: promise.Promise<any>;
|
gaReady: promise.Promise<any>;
|
||||||
ga = () => browser.executeScript('return window["gaCalls"]') as promise.Promise<any[][]>;
|
ga = () => browser.executeScript('return window["gaCalls"]') as promise.Promise<any[][]>;
|
||||||
locationPath = () => browser.executeScript('return document.location.pathname') as promise.Promise<string>;
|
locationPath = () => browser.executeScript('return document.location.pathname') as promise.Promise<string>;
|
||||||
|
|
||||||
navigateTo() {
|
navigateTo(pageUrl = '') {
|
||||||
return browser.get('/').then(_ => this.replaceGa(_));
|
return browser.get('/' + pageUrl).then(_ => this.replaceGa(_));
|
||||||
}
|
}
|
||||||
|
|
||||||
getDocViewerText() {
|
getDocViewerText() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% macro githubHref(doc, versionInfo) -%}
|
{% macro githubHref(doc, versionInfo) -%}
|
||||||
https://github.com/{$ versionInfo.gitRepoInfo.owner $}/{$ versionInfo.gitRepoInfo.repo $}/tree/{$ versionInfo.currentVersion.isSnapshot and versionInfo.currentVersion.SHA or versionInfo.currentVersion.raw $}/modules/{$ doc.fileInfo.projectRelativePath $}#L{$ doc.location.start.line+1 $}-L{$ doc.location.end.line+1 $}
|
https://github.com/{$ versionInfo.gitRepoInfo.owner $}/{$ versionInfo.gitRepoInfo.repo $}/tree/{$ versionInfo.currentVersion.isSnapshot and versionInfo.currentVersion.SHA or versionInfo.currentVersion.raw $}/packages/{$ doc.fileInfo.projectRelativePath $}#L{$ doc.location.start.line+1 $}-L{$ doc.location.end.line+1 $}
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|
||||||
{% macro githubViewLink(doc, versionInfo) -%}
|
{% macro githubViewLink(doc, versionInfo) -%}
|
||||||
|
|
Loading…
Reference in New Issue