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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/selection/drag_with_unfocused_selection.html

Issue 2877623005: Make DragController::DragIsMove return false when selection does not have focus (Closed)
Patch Set: Add layout test Created 3 years, 7 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/page/DragController.cpp » ('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 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
4 <script src="../assert_selection.js"></script>
5 <script>
6 // Regression tests for crbug.com/717453.
7
8 function mouseMoveTo(element) {
9 const document = element.ownerDocument;
10 const mouseX = document.offsetLeft + element.offsetLeft + element.offsetWidth / 2;
11 const mouseY = document.offsetTop + element.offsetTop + element.offsetHeight / 2;
12 eventSender.mouseMoveTo(mouseX, mouseY);
13 }
14
15 test(() => {
16 assert_not_equals(window.eventSender, 'This test requires eventSender');
yosin_UTC9 2017/05/12 04:05:44 Let's use |assert_exists(window, 'eventSender');|
17
18 assert_selection(
19 [
20 '<textarea id="source">^text|</textarea>',
21 '<a href="http://www.example.com/" id="link">link</a>',
22 '<textarea id="target"></textarea>'
23 ].join(''),
24 selection => {
25 const document = selection.document;
26 const source = document.getElementById('source');
27 const link = document.getElementById('link');
28 const target = document.getElementById('target');
29 source.focus();
30 mouseMoveTo(link);
31 eventSender.mouseDown();
32 eventSender.leapForward(500);
33 mouseMoveTo(target);
34 eventSender.mouseUp();
35 },
36 [
37 '<textarea id="source">text</textarea>',
38 '<a href="http://www.example.com/" id="link">link</a>',
39 '<textarea id="target">^http://www.example.com/|</textarea>'
40 ].join(''));
41 }, 'Drag link with unfocused selection in text control');
42
43 test(() => {
44 assert_not_equals(window.eventSender, 'This test requires eventSender');
45
46 assert_selection(
47 [
yosin_UTC9 2017/05/12 04:05:45 nit: Please have two spaces indentation.
48 '<div contenteditable id="source">^text|</div>',
49 '<a href="http://www.example.com/" id="link">link</a>',
50 '<textarea id="target"></textarea>'
51 ].join(''),
52 selection => {
53 const document = selection.document;
54 const source = document.getElementById('source');
55 const link = document.getElementById('link');
56 const target = document.getElementById('target');
57 source.focus();
58 mouseMoveTo(link);
59 eventSender.mouseDown();
60 eventSender.leapForward(500);
61 mouseMoveTo(target);
62 eventSender.mouseUp();
63 },
64 [
65 '<div contenteditable id="source">text</div>',
66 '<a href="http://www.example.com/" id="link">link</a>',
67 '<textarea id="target">^http://www.example.com/|</textarea>'
68 ].join(''));
69 }, 'Drag link with unfocused selection in contenteditable div');
70
71 test(() => {
72 assert_not_equals(window.eventSender, 'This test requires eventSender');
yosin_UTC9 2017/05/12 04:05:44 Let's use |assert_exists(window, 'eventSender');|
73
74 assert_selection(
75 [
yosin_UTC9 2017/05/12 04:05:45 nit: Please have two spaces indentation.
76 '<div id="source">^text|</div>',
77 '<a href="http://www.example.com/" id="link">link</a>',
78 '<textarea id="target"></textarea>'
79 ].join(''),
80 selection => {
81 const document = selection.document;
82 const source = document.getElementById('source');
83 const link = document.getElementById('link');
84 const target = document.getElementById('target');
85 document.body.focus();
86 mouseMoveTo(link);
87 eventSender.mouseDown();
88 eventSender.leapForward(500);
89 mouseMoveTo(target);
90 eventSender.mouseUp();
91 },
92 [
93 '<div id="source">text</div>',
94 '<a href="http://www.example.com/" id="link">link</a>',
95 '<textarea id="target">^http://www.example.com/|</textarea>'
96 ].join(''));
97 }, 'Drag link with unfocused selection in uneditable text');
98 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/page/DragController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698