Revert "Correct default Selectionstart and SelectionEnd"

This reverts commit b2c1f89b93.
This commit is contained in:
paavininanda 2018-02-06 22:33:12 +05:30
parent 267f9db314
commit b517410a34
8 changed files with 86 additions and 131 deletions

View file

@ -27,7 +27,7 @@ fn test_set_content_ignores_max_length() {
Lines::Single, DOMString::from(""), DummyClipboardContext::new(""), Some(1), None, SelectionDirection::None
);
textinput.set_content(DOMString::from("mozilla rocks"), true);
textinput.set_content(DOMString::from("mozilla rocks"));
assert_eq!(textinput.get_content(), DOMString::from("mozilla rocks"));
}
@ -489,7 +489,7 @@ fn test_textinput_set_content() {
let mut textinput = text_input(Lines::Multiple, "abc\nde\nf");
assert_eq!(textinput.get_content(), "abc\nde\nf");
textinput.set_content(DOMString::from("abc\nf"), true);
textinput.set_content(DOMString::from("abc\nf"));
assert_eq!(textinput.get_content(), "abc\nf");
assert_eq!(textinput.edit_point().line, 0);
@ -634,10 +634,6 @@ fn test_textinput_unicode_handling() {
fn test_selection_bounds() {
let mut textinput = text_input(Lines::Single, "abcdef");
assert_eq!(TextPoint { line: 0, index: 0 }, textinput.selection_origin_or_edit_point());
assert_eq!(TextPoint { line: 0, index: 0 }, textinput.selection_start());
assert_eq!(TextPoint { line: 0, index: 0 }, textinput.selection_end());
textinput.set_selection_range(2, 5, SelectionDirection::Forward);
assert_eq!(TextPoint { line: 0, index: 2 }, textinput.selection_origin_or_edit_point());
assert_eq!(TextPoint { line: 0, index: 2 }, textinput.selection_start());

View file

@ -330871,12 +330871,6 @@
{}
]
],
"html/semantics/forms/textfieldselection/defaultSelection.html": [
[
"/html/semantics/forms/textfieldselection/defaultSelection.html",
{}
]
],
"html/semantics/forms/textfieldselection/select-event.html": [
[
"/html/semantics/forms/textfieldselection/select-event.html",

View file

@ -0,0 +1,4 @@
[setSelectionRange.html]
[setSelectionRange on line boundaries]
expected: FAIL

View file

@ -1,28 +0,0 @@
<!doctype html>
<meta charset="utf-8">
<title></title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<textarea>foo</textarea>
<input type="text" value="foo"></input>
<script>
for (let el of [document.querySelector("textarea"), document.querySelector("input")]) {
test(function() {
assert_equals(el.selectionStart, 0);
assert_equals(el.selectionEnd, 0);
}, `Default selectionStart and selectionEnd for ${el}`);
test(function() {
el.value="foo";
assert_equals(el.selectionStart, 0);
assert_equals(el.selectionEnd, 0);
}, `selectionStart and selectionEnd do not change when same value set again for ${el}`);
test(function() {
el.value="Foo";
assert_equals(el.selectionStart, 3);
assert_equals(el.selectionEnd, 3);
}, `selectionStart and selectionEnd change when value changed to upper case for ${el}`);
}
</script>