Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: LayoutTests/fast/events/clipboard-dataTransferItemList-remove.html

Issue 23051003: Add support for DataTransferItemList.remove() method (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/fast/events/clipboard-dataTransferItemList-remove-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <link rel="help" href="http://www.w3.org/TR/2013/WD-html51-20130528/editing.html #dom-datatransferitemlist-remove">
5 <script src="../js/resources/js-test-pre.js"></script>
6 </head>
7 <body>
8 <script>
9 description("Checks that DataTransferItemList.remove() is working");
10
11 var dataTansferItemList;
12 function copy(event)
13 {
14 debug("* copy event");
15 event.preventDefault();
haraken 2013/08/13 13:25:44 Nit: Why do you need preventDefault() in copy() bu
do-not-use 2013/08/13 13:51:21 I need preventDefault() in copy() because I am edi
16 dataTansferItemList = event.clipboardData.items;
17
18 dataTansferItemList.add('a', 'text/plain');
19 dataTansferItemList.add('http://www.google.com/', 'text/uri-list');
20 dataTansferItemList.add('<em>Markup</em>', 'text/html');
21 dataTansferItemList.add('hello world', 'custom-data');
22
23 shouldBe('dataTansferItemList.length', '4');
24 shouldBeEqualToString('dataTansferItemList[0].type', 'text/plain');
25 shouldBeEqualToString('dataTansferItemList[1].type', 'text/uri-list');
26 shouldBeEqualToString('dataTansferItemList[2].type', 'text/html');
27 shouldBeEqualToString('dataTansferItemList[3].type', 'custom-data');
28
29 // Failure cases.
30 shouldThrow('dataTansferItemList.remove()', '"TypeError: Not enough argument s"');
31 shouldNotThrow('dataTansferItemList.remove(-1)');
32 shouldBe('dataTansferItemList.length', '4');
33 shouldNotThrow('dataTansferItemList.remove(999)');
34 shouldBe('dataTansferItemList.length', '4');
35
36 // Success cases.
37 shouldNotThrow('dataTansferItemList.remove(0)');
38 shouldBe('dataTansferItemList.length', '3');
39 shouldBeEqualToString('dataTansferItemList[0].type', 'text/uri-list');
40 shouldBeEqualToString('dataTansferItemList[1].type', 'text/html');
41 shouldNotThrow('dataTansferItemList.remove(-4294967295)'); // Wraps to 1.
42 shouldBe('dataTansferItemList.length', '2');
43 shouldBeEqualToString('dataTansferItemList[1].type', 'custom-data');
44 }
45
46 function paste(event)
47 {
48 debug("* paste event");
49 dataTansferItemList = event.clipboardData.items;
50 shouldBe('dataTansferItemList.length', '2');
51 shouldThrow('dataTansferItemList.remove(0)', '"InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable."'); // List is readonly during paste.
52 shouldBe('dataTansferItemList.length', '2');
53 }
54
55 document.oncopy = copy;
56 document.onpaste = paste;
57 document.execCommand('copy');
58 document.execCommand('paste');
59 </script>
60 <script src="../js/resources/js-test-post.js"></script>
61 </body>
62 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/events/clipboard-dataTransferItemList-remove-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698