2 <script src=
"../../resources/testharness.js"></script>
3 <script src=
"../../resources/testharnessreport.js"></script>
4 <div>foo
<input value=
"initial">bar
</div>
5 <div>baz
<textarea>initial
</textarea>quux
</div>
8 var input
= document
.querySelector('input');
9 var textarea
= document
.querySelector('textarea');
10 if (window
.internals
) {
11 internals
.setSuggestedValue(input
, 'suggested');
12 internals
.setAutofilled(input
, true);
13 internals
.setSuggestedValue(textarea
, 'suggested');
14 internals
.setAutofilled(textarea
, true);
17 // We should emit initial value if control is auto-filled.
20 assert_equals(getSelection().toString(), '');
21 }, 'select input inner whole');
25 assert_equals(getSelection().toString(), '');
26 }, 'select textarea inner whole');
28 // We should not put suggested value to toString().
30 input
.setSelectionRange(2, 5);
31 assert_equals(getSelection().toString(), '');
32 }, 'select input inner');
35 textarea
.setSelectionRange(2, 5);
36 assert_equals(getSelection().toString(), '');
37 }, 'select textarea inner');
39 // Selection should not have auto-filled value.
41 getSelection().selectAllChildren(input
.parentNode
);
42 assert_equals(getSelection().toString(), 'foobar');
43 }, 'select input outer');
46 getSelection().selectAllChildren(textarea
.parentNode
);
47 assert_equals(getSelection().toString(), 'bazquux');
48 }, 'select textarea outer');