-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-copy-functionality.js
More file actions
63 lines (49 loc) · 1.7 KB
/
test-copy-functionality.js
File metadata and controls
63 lines (49 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Test script to verify copy functionality
// This can be run in browser console to test the copyGitHubMarkdown function
const testContent = `# Test README
This is a test README with various elements:
## Features
- ✅ Feature 1
- ✅ Feature 2
- ✅ Feature 3
## Code Example
\`\`\`javascript
console.log("Hello, World!");
\`\`\`
## Table
| Column 1 | Column 2 | Column 3 |
|----------|----------|----------|
| Data 1 | Data 2 | Data 3 |
## Links
[GitHub](https://github.com)
## Images

---
**Made with ❤️**
`;
// Function to test copy functionality
async function testCopyFunctionality() {
try {
console.log('Testing copy functionality...');
console.log('Original content length:', testContent.length);
// Test the copy function (assuming it's available globally or can be imported)
if (typeof copyGitHubMarkdown !== 'undefined') {
await copyGitHubMarkdown(testContent);
console.log('✅ Copy function executed successfully');
} else {
console.log('❌ copyGitHubMarkdown function not available');
}
// Test clipboard reading (if available)
if (navigator.clipboard && navigator.clipboard.readText) {
const clipboardContent = await navigator.clipboard.readText();
console.log('Clipboard content length:', clipboardContent.length);
console.log('✅ Copy verification completed');
} else {
console.log('⚠️ Cannot read clipboard content (security restrictions)');
}
} catch (error) {
console.error('❌ Copy test failed:', error);
}
}
console.log('Copy functionality test script loaded');
console.log('Run testCopyFunctionality() to test the copy feature');