blob: 6dd40cc9b0ea58c42d5c9a70f822f108263b8d1a [file] [log] [blame]
Andrew Top61a84952019-04-30 15:07:33 -07001<!DOCTYPE html>
2<html>
3 <head>
4 <meta charset='utf-8'>
5 <title>HTML Media Capture Test: capture_reflect</title>
6 <link rel='author' title='Intel' href='http://www.intel.com/'>
7 <link rel='help' href='http://www.w3.org/TR/html-media-capture/#the-capture-attribute'>
8 <link rel='help' href='http://www.w3.org/html/wg/drafts/html/CR/infrastructure.html#reflect'>
9 <link rel='help' href='http://www.w3.org/html/wg/drafts/html/CR/infrastructure.html#boolean-attributes'>
10 <meta name='flags' content='dom'>
11 <meta name='assert' content='Test checks that the capture IDL attribute must reflect the content attribute of the same name.'>
12 <script src='/resources/testharness.js'></script>
13 <script src='/resources/testharnessreport.js'></script>
14 </head>
15 <body>
16 <pre style='display:none'>
17 partial interface HTMLInputElement {
18 attribute boolean capture;
19 };
20 </pre>
21
22 <div style='display:none'>
23 <input id='absent' type='file' accept='image/*'>
24 <input id='present' type='file' accept='image/*' capture>
25 <input id='present-empty-string' type='file' accept='image/*' capture=''>
26 <input id='present-canonical-name' type='file' accept='image/*' capture=capture>
27 </div>
28
29 <div id='log'></div>
30
31 <script>
32 test(function() {
33 var inputs = document.querySelectorAll('input');
34 for (var i=0, obj; i<inputs.length, obj=inputs[i]; i++) {
35 assert_own_property(obj, 'capture');
36 assert_equals(typeof obj.capture, 'boolean');
37 }
38 }, 'Element input should have own property capture');
39
40 test(function() {
41 assert_false(document.querySelector('#absent').capture);
42 }, 'input.capture is false when the capture attribute is absent');
43
44 test(function() {
45 assert_true(document.querySelector('#present').capture);
46 }, 'input.capture is true when the capture attribute is present');
47
48 test(function() {
49 assert_true(document.querySelector('#present-empty-string').capture);
50 }, 'input.capture is true when the capture attribute is present as empty string');
51
52 test(function() {
53 assert_true(document.querySelector('#present-canonical-name').capture);
54 }, 'input.capture is true when the capture attribute is present as canonical name');
55 </script>
56 </body>
57</html>