docs(aio): adjust zips/plunker paths
This commit is contained in:

committed by
Pete Bacon Darwin

parent
d855e90524
commit
4598af23c0
@ -200,6 +200,15 @@ describe('LiveExampleComponent', () => {
|
||||
expect(anchor.getAttribute('title')).toBe(liveExampleContent, 'title');
|
||||
});
|
||||
}));
|
||||
|
||||
it('should not duplicate the exampleDir on a zip when there is a / on the name', async(() => {
|
||||
setHostTemplate('<live-example name="testing/ts"></live-example>');
|
||||
testComponent(() => {
|
||||
const hrefs = getHrefs();
|
||||
expect(hrefs[0]).toContain('/testing/ts/eplnkr.html');
|
||||
expect(hrefs[1]).toContain('/testing/ts/testing.zip');
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
describe('when embedded', () => {
|
||||
|
@ -80,6 +80,7 @@ export class LiveExampleComponent implements OnInit {
|
||||
showEmbedded = false;
|
||||
title: string;
|
||||
zip: string;
|
||||
zipName: string;
|
||||
|
||||
constructor(
|
||||
private elementRef: ElementRef,
|
||||
@ -92,8 +93,9 @@ export class LiveExampleComponent implements OnInit {
|
||||
exampleDir = location.path(false).match(/[^\/?\#]+(?=\/?(?:$|\#|\?))/)[0];
|
||||
}
|
||||
this.exampleDir = exampleDir.trim();
|
||||
this.zipName = exampleDir.indexOf('/') === -1 ? this.exampleDir : exampleDir.split('/')[0];
|
||||
this.plnkrName = attrs.plnkr ? attrs.plnkr.trim() + '.' : '';
|
||||
this.zip = `${zipBase}${exampleDir}/${this.plnkrName}${exampleDir}.zip`;
|
||||
this.zip = `${zipBase}${exampleDir}/${this.plnkrName}${this.zipName}.zip`;
|
||||
|
||||
const noDownload = this.getAttrValue(['noDownload', 'nodownload']); // noDownload aliases
|
||||
this.enableDownload = !boolFromAtty(noDownload);
|
||||
|
Reference in New Issue
Block a user