summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/forms/input-inputmode.html
blob: 4ffb56584f96e62eb3e6bcd42aff0f0877ef0dba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE HTML>
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<script>
description('Tests the behavior of .inputMode of HTMLInputElement.');

var input = document.createElement('input');

// .inputMode just reflect the corresponding attributes.
input.type = 'text';
shouldBe('input.inputMode', '""');
input.setAttribute('inputmode', '0');
shouldBe('input.inputMode', '"0"');
input.setAttribute('inputmode', 'abc');
shouldBe('input.inputMode', '"abc"');

input.inputMode = 'foo';
shouldBe('input.getAttribute("inputmode")', '"foo"');

input.inputMode = '';
shouldBe('input.getAttribute("inputmode")', '""');

// Null.
debug('Setting null to inputMode:');
input.inputMode = null;
shouldBe('input.inputMode', '"null"');
shouldBe('input.getAttribute("inputmode")', '"null"');
input.setAttribute('inputmode', null);
shouldBe('input.inputMode', '"null"');

// Undefined.
debug('Setting undefined to inputMode:');
input.inputMode = undefined;
shouldBe('input.inputMode', '"undefined"');
shouldBe('input.getAttribute("inputmode")', '"undefined"');
input.setAttribute('inputmode', undefined);
shouldBe('input.inputMode', '"undefined"');

// Non-string.
debug('Setting non-string to inputMode:');
input.inputMode = 256;
shouldBe('input.inputMode', '"256"');
shouldBe('input.getAttribute("inputmode")', '"256"');
input.setAttribute('inputmode', 256);
shouldBe('input.inputMode', '"256"');

</script>
</body>
</html>