Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions projects/assets-library/assets/icons/copy-to-clipboard.svg

This file was deleted.

1 change: 0 additions & 1 deletion projects/assets-library/src/icons/icon-library.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ const iconsRootPath = 'assets/icons';
{ key: IconType.CollapseAll, url: `${iconsRootPath}/collapse-all.svg` },
{ key: IconType.Collapsed, url: `${iconsRootPath}/plus-square.svg` },
{ key: IconType.Compare, url: `${iconsRootPath}/compare.svg` },
{ key: IconType.CopyToClipboard, url: `${iconsRootPath}/copy-to-clipboard.svg` },
{ key: IconType.Custom, url: `${iconsRootPath}/custom.svg` },
{ key: IconType.Dashboard, url: `${iconsRootPath}/dashboard.svg` },
{ key: IconType.Device, url: `${iconsRootPath}/device.svg` },
Expand Down
2 changes: 1 addition & 1 deletion projects/assets-library/src/icons/icon-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const enum IconType {
Collapsed = 'svg:plus-square',
Compare = 'svg:compare',
CompareArrows = 'compare_arrows',
CopyToClipboard = 'svg:copy-to-clipboard',
ContentCopy = 'content_copy',
Code = 'svg:code',
Custom = 'svg:custom',
CustomWebhook = 'svg:custom-webhook',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ describe('Copy to Clipboard component', () => {

test('correctly copies the text to clipboard', fakeAsync(() => {
spectator = createHost(
`<ht-copy-to-clipboard [text]="textToBeCopied" label="Copy to Clipboard"></ht-copy-to-clipboard>`,
`<ht-copy-to-clipboard [tooltipDuration]="tooltipDuration" [text]="textToBeCopied" label="Copy to Clipboard"></ht-copy-to-clipboard>`,
{
hostProps: {
textToBeCopied: 'Text to be copied'
textToBeCopied: 'Text to be copied',
tooltipDuration: 1000
}
}
);
Expand All @@ -62,7 +63,7 @@ describe('Copy to Clipboard component', () => {

spectator.tick();
expect(spectator.inject(PopoverService).drawPopover).toHaveBeenCalled();
spectator.tick(4000);
spectator.tick(1001);
expect(mockPopoverRef.close).toHaveBeenCalled();
}));
});
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class CopyToClipboardComponent implements OnInit, OnDestroy {
public size?: ButtonSize = ButtonSize.Small;

@Input()
public icon?: IconType = IconType.CopyToClipboard;
public icon?: IconType = IconType.ContentCopy;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is different than copy to clipboard and meant to replace it, can we remove the old one

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to check with Michael on this, but this one looks better and is coming from material directly.


@Input()
public label?: string = 'Copy to Clipboard';
Expand All @@ -63,6 +63,9 @@ export class CopyToClipboardComponent implements OnInit, OnDestroy {
@Input()
public text?: string;

@Input()
public tooltipDuration: number = 3000;

@Output()
public readonly copiedChanges: EventEmitter<boolean> = new EventEmitter();

Expand Down Expand Up @@ -133,7 +136,7 @@ export class CopyToClipboardComponent implements OnInit, OnDestroy {
});

return of(popoverRef).pipe(
delay(3000),
delay(this.tooltipDuration ?? 0),
finalize(() => popoverRef.close())
);
}
Expand Down