1 description('Tests for value sanitization algorithm.');
2
3 var input;
4
5 debug('');
6 debug('Number:');
7 input = document.createElement('input');
8 input.setAttribute('value', '65536');
9 input.type = 'number';
10 shouldBe('input.value', '"65536"');
11 shouldBe('input.value = "256"; input.value', '"256"');
12 shouldBe('input.value = ""; input.value', '""');
13
14
15 debug('');
16 debug('Range:');
17 input = document.createElement('input');
18 input.type = 'text';
19 input.value = ':)';
20 input.type = 'range';
21 shouldBe('input.value', '"50"');
22
23 debug('');
24 debug('Text:');
25 var container = document.createElement('div');
26 document.body.appendChild(container);
27 container.innerHTML = '<input type="text" id="text" value="\n\r foo bar \n\r\n">';
28 input = document.getElementById('text');
29 shouldBe('input.value', '" foo bar "');
30 input.focus();
31 document.execCommand('SelectAll');
32 shouldBe('document.getSelection().toString()', '" foo bar "');
33
34 // FIXME: Add more sanitization tests.
35 // https://bugs.webkit.org/show_bug.cgi?id=37024
36
37 container.innerHTML = '';
38 var successfullyParsed = true;