Browse Source

feat add test

ganzw 8 years ago
parent
commit
085a9e8dfe
2 changed files with 8 additions and 44 deletions
  1. 0 38
      README.md
  2. 8 6
      test/index.html

+ 0 - 38
README.md

@@ -1,44 +1,6 @@
 # clipBoard.js
 with javascript operating clipboard, copy、cut and paste.
 
-# example
-
-<div>
-<input type="text" id="data" value="剪切板">
-<button id="copy">复制</button>
-<button id="cut">剪切</button>
-<!--[if IE]>
-<button id="paste">粘贴</button>
-<![endif]-->
-<script src="clipBoard.min.js"></script>
-<script>
-/**
-* 复制、剪切:chrome、Firefox、ie
-* 粘贴:ie
-* @date   2016-04-25
-* @return {[type]}   [description]
-*/
-document.getElementById('copy').onclick = function() {
-var test = new clipBoard(document.getElementById('data'), {
-beforeCopy: function() {
-},
-copy: function() {
-return document.getElementById('data').value;
-},
-afterCopy: function() {
-}
-});
-};
-document.getElementById('cut').onclick = function() {
-var test = new clipBoard(document.getElementById('data'), {});
-test.cut();
-};
-document.getElementById('paste').onclick = function() {
-var a = new clipBoard(document.getElementById('data'), {});
-a.paste();
-};
-</script>
-</div>
 
 # support
 |               | copy   |  cut    |  paste   |

+ 8 - 6
test/index.html

@@ -5,7 +5,7 @@
     <title>test</title>
 </head>
 <body>
-    <input type="text" id="data" value="测试数据">
+    <input type="text" id="data" value="剪切板">
     <button id="copy">复制</button>
     <button id="cut">剪切</button>
     <!--[if IE]>
@@ -22,11 +22,13 @@
     document.getElementById('copy').onclick = function() {
     	var test = new clipBoard(document.getElementById('data'), {
     		beforeCopy: function() {
-    		},
-    		copy: function() {
-    			return document.getElementById('data').value;
-    		},
-    		afterCopy: function() {
+                alert('开始复制');
+            },
+            copy: function() {
+                return document.getElementById('data').value;
+            },
+            afterCopy: function() {
+                alert('复制成功!');
     		}
     	});
     };