feat(aio): support hiding the copy button on code-examole components

In the API docs there are occasions where we do not wish the code snippet
to have a copy button. This commit supports that by providing a new `hideCopy`
attribute.
This commit is contained in:
Peter Bacon Darwin
2017-05-02 11:57:26 +01:00
committed by Matias Niemelä
parent cb5bc76766
commit a0b9c23100
4 changed files with 27 additions and 3 deletions

View File

@ -65,6 +65,13 @@ describe('CodeExampleComponent', () => {
const actual = codeExampleDe.query(By.css('header')).nativeElement.innerText;
expect(actual).toBe('Great Example');
});
it('should pass hideCopy to CodeComonent', () => {
TestBed.overrideComponent(HostComponent, {
set: {template: '<code-example hideCopy="true"></code-example>'}});
createComponent(oneLineCode);
expect(codeComponent.hideCopy).toBe(true);
});
});
//// Test helpers ////
@ -83,6 +90,7 @@ class TestCodeComponent {
@Input() linenums: boolean | number;
@Input() path: string;
@Input() region: string;
@Input() hideCopy: boolean;
get someCode() {
return this.code && this.code.length > 30 ? this.code.substr(0, 30) + '...' : this.code;