Copy to clipboard functionality and tests