| <!doctype html> | |
| <meta charset=utf-8> | |
| <!-- WARNING: These tests are preliminary and probably partly incorrect. --> | |
| <title>CSSOM automated IDL tests</title> | |
| <link rel="author" title="Ms2ger" href="mailto:Ms2ger@gmail.com"> | |
| <link rel="help" href="https://drafts.csswg.org/cssom-1/#idl-index"> | |
| <script src=/resources/testharness.js></script> | |
| <script src=/resources/testharnessreport.js></script> | |
| <script src=/resources/WebIDLParser.js></script> | |
| <script src=/resources/idlharness.js></script> | |
| <!-- | |
| Provide some objects to test. | |
| Use a non-empty style attribute to get a non-empty CSSStyleDeclaration. | |
| --> | |
| <style id="styleElement" style="z-index: 0;"> | |
| @import url("data:text/css,"); | |
| @namespace x "y"; | |
| @page { @top-left {} } | |
| @media all {} | |
| #test { color: green; } | |
| </style> | |
| <svg id="svgElement" style="height: 0;"></svg> | |
| <iframe id="xmlssPiIframe" src="support/xmlss-pi.xhtml" style="display: none;"></iframe> | |
| <h1>CSSOM IDL tests</h1> | |
| <div id=log></div> | |
| <script> | |
| "use strict"; | |
| var style_element, svg_element, xmlss_pi; | |
| function doTest([html, dom, uievents, cssom]) { | |
| style_element = document.getElementById('styleElement'); | |
| svg_element = document.getElementById('svgElement'); | |
| xmlss_pi = document.getElementById('xmlssPiIframe').contentDocument.firstChild; | |
| var idlArray = new IdlArray(); | |
| var svg = "interface SVGElement : Element {};"; | |
| idlArray.add_untested_idls(html + dom + svg); | |
| idlArray.add_untested_idls(uievents, { only: [ | |
| 'UIEvent', | |
| 'UIEventInit', | |
| 'MouseEvent', | |
| 'MouseEventInit', | |
| 'EventModifierInit' | |
| ]}); | |
| idlArray.add_idls(cssom); | |
| idlArray.add_objects({ | |
| "Document": ["document", "new Document()"], | |
| "StyleSheetList": ["document.styleSheets"], | |
| "CSSStyleSheet": ["style_element.sheet"], | |
| "MediaList": ["style_element.sheet.media"], | |
| "CSSRuleList": ["style_element.sheet.cssRules"], | |
| "CSSImportRule": ["style_element.sheet.cssRules[0]"], | |
| "CSSNamespaceRule": ["style_element.sheet.cssRules[1]"], | |
| "CSSPageRule": ["style_element.sheet.cssRules[2]"], | |
| "CSSMarginRule": ["style_element.sheet.cssRules[2].cssRules[0]"], | |
| "CSSMediaRule": ["style_element.sheet.cssRules[3]"], | |
| "CSSStyleRule": ["style_element.sheet.cssRules[4]"], | |
| "CSSStyleDeclaration": ["style_element.sheet.cssRules[4].style", // CSSStyleRule | |
| "style_element.sheet.cssRules[2].style", // CSSPageRule | |
| "style_element.sheet.cssRules[2].cssRules[0].style", // CSSMarginRule | |
| "style_element.style", // ElementCSSInlineStyle for HTMLElement | |
| "svg_element.style", // ElementCSSInlineStyle for SVGElement | |
| "getComputedStyle(svg_element)"], | |
| "ProcessingInstruction": ["xmlss_pi"], | |
| "Window": ["window"], | |
| "HTMLElement": ["style_element", "document.createElement('unknownelement')"], | |
| "SVGElement": ["svg_element"], | |
| }); | |
| idlArray.test(); | |
| }; | |
| function fetchData(url) { | |
| return fetch(url).then((response) => response.text()); | |
| } | |
| function waitForLoad() { | |
| return new Promise(function(resolve) { | |
| addEventListener("load", resolve); | |
| }); | |
| } | |
| promise_test(function() { | |
| // Have to wait for onload | |
| return Promise.all([fetchData("/interfaces/html.idl"), | |
| fetchData("/interfaces/dom.idl"), | |
| fetchData("/interfaces/uievents.idl"), | |
| fetchData("/interfaces/cssom.idl"), | |
| waitForLoad()]) | |
| .then(doTest); | |
| }, "Test driver"); | |
| </script> |