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:

committed by
Matias Niemelä

parent
cb5bc76766
commit
a0b9c23100
@ -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;
|
||||
|
Reference in New Issue
Block a user