test_is_element_themed.html (2440B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Test InspectorUtils::IsElementThemed</title> 6 <script src="/tests/SimpleTest/SimpleTest.js"></script> 7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 8 <style> 9 .not-themed-border:focus { 10 border: none; 11 } 12 13 .not-themed-background:focus { 14 background-color: red; 15 } 16 </style> 17 </head> 18 <body> 19 <h1>Test InspectorUtils::isValidCSSColor</h1> 20 21 <button id="themed-button">Themed Button</button> 22 <input id="themed-input-number" type="number"/> 23 <input id="themed-input-text" type="text"/> 24 <textarea id="themed-textarea"></textarea> 25 26 <button id="not-themed-button-(border)" class="not-themed-border">Not Themed Button</button> 27 <input id="not-themed-input-number-(border)" class="not-themed-border" type="number"/> 28 <input id="not-themed-input-text-(border)" class="not-themed-border" type="text"/> 29 <textarea id="not-themed-textarea-(border)" class="not-themed-border"></textarea> 30 31 <button id="not-themed-button-(background)" class="not-themed-background">Not Themed Button</button> 32 <input id="not-themed-input-number-(background)" class="not-themed-background" type="number"/> 33 <input id="not-themed-input-text-(background)" class="not-themed-background" type="text"/> 34 <textarea id="not-themed-textarea-(background)" class="not-themed-background"></textarea> 35 36 <script type="application/javascript"> 37 const InspectorUtils = SpecialPowers.InspectorUtils; 38 const tests = [{ 39 id: "themed-button", 40 themed: true, 41 }, { 42 id: "themed-input-number", 43 themed: true, 44 }, { 45 id: "themed-input-text", 46 themed: true, 47 }, { 48 id: "themed-textarea", 49 themed: true, 50 }, { 51 id: "not-themed-button-(border)", 52 themed: false, 53 }, { 54 id: "not-themed-input-number-(border)", 55 themed: false, 56 }, { 57 id: "not-themed-input-text-(border)", 58 themed: false, 59 }, { 60 id: "not-themed-textarea-(border)", 61 themed: false, 62 }, { 63 id: "not-themed-button-(background)", 64 themed: false, 65 }, { 66 id: "not-themed-input-number-(background)", 67 themed: false, 68 }, { 69 id: "not-themed-input-text-(background)", 70 themed: false, 71 }, { 72 id: "not-themed-textarea-(background)", 73 themed: false, 74 }]; 75 76 for (const { id, themed } of tests) { 77 ok(InspectorUtils.isElementThemed(document.getElementById(id)), 78 `#${id} is${themed ? " ": " not "}themed natively`); 79 } 80 </script> 81 </body> 82 </html>