docs(aio): revised "Docs" page
This commit is contained in:

committed by
Pete Bacon Darwin

parent
3d06b18fee
commit
4ac5096232
@ -9,6 +9,9 @@
|
||||
You can also <a [href]="zip" download title="Download example">download this example</a>.
|
||||
</p>
|
||||
</span>
|
||||
<span *ngSwitchCase="'downloadOnly'">
|
||||
<a [href]="zip" download title="{{title}}">{{title}}</a>
|
||||
</span>
|
||||
<span *ngSwitchDefault>
|
||||
<a [href]="plnkr" target="_blank" title="{{title}}">{{title}}</a>
|
||||
<span *ngIf="enableDownload">
|
||||
|
@ -167,10 +167,20 @@ describe('LiveExampleComponent', () => {
|
||||
it('should not have a download link when `noDownload` atty present', async(() => {
|
||||
setHostTemplate('<live-example noDownload></live-example>');
|
||||
testComponent(() => {
|
||||
expect(getAnchors().length).toBe(1, 'only the live-example anchor');
|
||||
const hrefs = getHrefs();
|
||||
expect(hrefs.length).toBe(1, 'only the plunker live-example anchor');
|
||||
expect(hrefs[0]).toContain('plnkr.html');
|
||||
});
|
||||
}));
|
||||
|
||||
it('should only have a download link when `downloadOnly` atty present', async(() => {
|
||||
setHostTemplate('<live-example downloadOnly>download this</live-example>');
|
||||
testComponent(() => {
|
||||
const hrefs = getHrefs();
|
||||
expect(hrefs.length).toBe(1, 'only the zip anchor');
|
||||
expect(hrefs[0]).toContain('.zip'); });
|
||||
}));
|
||||
|
||||
it('should have default title when no title attribute or content', async(() => {
|
||||
setHostTemplate('<live-example></live-example>');
|
||||
testComponent(() => {
|
||||
|
@ -23,6 +23,7 @@ const zipBase = 'content/zips/';
|
||||
* [embedded-style] // show plnkr in embedded style (default and on narrow screens)
|
||||
* [flat-style] // show plnkr in flat (original) style
|
||||
* [noDownload] // no downloadable zip option
|
||||
* [downloadOnly] // just the zip
|
||||
* [title="..."]> // text for live example link and tooltip
|
||||
* text // higher precedence way to specify text for live example link and tooltip
|
||||
* </live-example>
|
||||
@ -99,7 +100,12 @@ export class LiveExampleComponent implements OnInit {
|
||||
|
||||
const noDownload = this.getAttrValue(['noDownload', 'nodownload']); // noDownload aliases
|
||||
this.enableDownload = !boolFromAtty(noDownload);
|
||||
|
||||
this.plnkrImg = imageBase + (attrs.img || defaultPlnkrImg);
|
||||
|
||||
if (boolFromAtty(this.getAttrValue(['downloadOnly', 'downloadonly']))) {
|
||||
this.mode = 'downloadOnly';
|
||||
}
|
||||
}
|
||||
|
||||
calcPlnkrLink(width: number) {
|
||||
@ -154,7 +160,9 @@ export class LiveExampleComponent implements OnInit {
|
||||
|
||||
@HostListener('window:resize', ['$event.target.innerWidth'])
|
||||
onResize(width) {
|
||||
this.calcPlnkrLink(width);
|
||||
if (this.mode !== 'downloadOnly') {
|
||||
this.calcPlnkrLink(width);
|
||||
}
|
||||
}
|
||||
|
||||
toggleEmbedded () { this.showEmbedded = !this.showEmbedded; }
|
||||
|
Reference in New Issue
Block a user