summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/forms/input-file-set-value.html
blob: 7ea0275b162454f7b4e0cf7945baa780b6e539c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!DOCTYPE html>
<script src="../../resources/js-test.js"></script>

<body>

<script>
description("Tests that setting the value of input type=file throws and changing type resets.");

input = document.createElement("input");
document.body.appendChild(input);

input.value = "example.txt";
shouldBeEqualToString("input.value", "example.txt");
input.type = "file";
shouldBeEqualToString("input.value", "");
shouldThrow('input.value = "foo"', '"InvalidStateError: Failed to set the \'value\' property on \'HTMLInputElement\': This input element accepts a filename, which may only be programmatically set to the empty string."');
input.value = "";
</script>