tizen beta release
[framework/web/webkit-efl.git] / LayoutTests / fast / forms / script-tests / input-pattern.js
1 description('Test the behavior of pattern attribute and pattern DOM property.');
2
3 var input = document.createElement('input');
4 input.type = 'text';
5
6 // No pattern attribute.
7 shouldBe('input.pattern', '""');
8
9 // Set a string value.
10 input.pattern = 'foo';
11 shouldBe('input.getAttribute("pattern")', '"foo"');
12 input.setAttribute('pattern', 'bar');
13 shouldBe('input.pattern', '"bar"');
14
15 // Null.
16 input.pattern = null;
17 shouldBe('input.pattern', '""');
18 shouldBe('input.getAttribute("pattern")', 'null');
19 input.setAttribute('pattern', null);
20 shouldBe('input.pattern', '"null"');
21
22 // Undefined.
23 input.pattern = undefined;
24 shouldBe('input.pattern', '"undefined"');
25 shouldBe('input.getAttribute("pattern")', '"undefined"');
26 input.setAttribute('pattern', undefined);
27 shouldBe('input.pattern', '"undefined"');
28
29 // Non-string.
30 input.pattern = 256;
31 shouldBe('input.pattern', '"256"');
32 shouldBe('input.getAttribute("pattern")', '"256"');
33 input.setAttribute('pattern', 256);
34 shouldBe('input.pattern', '"256"');