Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should copy value label to clipboard when input gets focus', () => {
copyFn.mockReset();
const component = mount();
component.find('input').simulate('focus');
expect(copyFn).toHaveBeenCalledWith(value.label);
});
});
handleFocusedCell = ({col, row, focusSelectionIndex}) => {
const header = this.state.headers[col]
const rowData = this.state.collection[row]
const cell = rowData[header]
copy(cell).then(() => console.log('copied'))
if (Array.isArray(cell)) {
this.setState({
disabled: {
cell : false,
collection: false,
enter : true,
},
})
this.props.onItemSelected(cell)
} else if (cell !== null && typeof cell === 'object') {
this.setState({
disabled: {
cell : false,
collection: true,
enter : false,
async copy(as) {
let value = null
for (const copyAs of this.copyAs) {
if (copyAs.as === as) {
value = copyAs.value
}
}
if (value === null) {
value = this[as]
}
await copy(value)
Nova.success(Nova.app.__('Copied!'))
}
onClick={() => copy(children)}
title="Copy to clipboard"
const handleCopy = React.useCallback(() => {
if (input.current) {
copy(input.current.innerHTML).then(()=>{
setOpenCopyWarn(true)
})
}
},[input])
return (
onClick={() => copy(props.code)}
title="Copy to clipboard"
async function copyMarkup(markupFormat: MarkupFormat) {
const builtBadgeUrl = generateBuiltBadgeUrl()
const markup = generateMarkup({
badgeUrl: builtBadgeUrl,
link,
title,
markupFormat,
})
try {
await clipboardCopy(markup)
} catch (e) {
setMessage('Copy failed')
setMarkup(markup)
return
}
setMarkup(markup)
if (indicatorRef.current) {
indicatorRef.current.trigger()
}
}
onClick={() => copy(vtexIOString)}
title="Copy to clipboard">
onClick() {
if(copy(this.props.textToCopy)) {
this.setState({ showTooltip: true });
}
}
const onEnterPressed = (keyName: string) => (e: React.KeyboardEvent) => {
if (e.key === 'Enter') {
clipboardCopy(keyName);
}
};