描述
Originally posted as https://github.com/w3c/csswg-test/issues/999 by @Ms2ger on 28 Dec 2015, 12:58 UTC:
Suggested tests to write for CSSOM at Test the Web Forward Tokyo:
SERIALIZING
media queries
use
query = new MediaList("query text")to createsee also https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Testing_media_queries for alternative
then evaluate
query.mediaTextto test serialized queryselectors
specify style sheet with rule with selector you want to test, e.g.,
<style>p.class {...}</style>then use
document.styleSheets[0].cssRules[0].selectorTextto test results of serializing selector (p.classin this example)computed property values
specify style sheet with property and value you want to test, e.g.,
<style>p { color: blue; }</style> <p id=test>blue text</p>then use
var test = document.getElementById('test'); getComputedStyle(test).getPropertyValue("color")also test
getComputedStyle(p).colorrules
specify rule in style sheet, e.g.,
<style>#test { color: blue; }<style>then test serialized rule with
document.styleSheets[0].cssRules[0].cssTextdeclarations
<div id=test style='color: blue; font-size: 10px'>then test serialized declaration with
var test = document.getElementById('test'); test.style.cssTextALTERNATIVE STYLE SHEETS
Document.selectedStyleSheetSetDocument.lastStyleSheetSetDocument.preferredStyleSheetSetDocument.styleSheetSetsDocument.enableStyleSheetForSet()see https://drafts.csswg.org/cssom/#extensions-to-the-document-interface
GETCOMPUTEDSTYLE()
- test
pseudoEltparameter
- different cases (upper, lower, mixed)
- whitespace padding
- different values than
::beforeand::after- test on element that hasn't been added into document
- test on element in different document
see https://drafts.csswg.org/cssom/#dom-window-getcomputedstyle
INSERTRULE()
- insert followed by delete - did it appear then disappear in rules list?
- insert multiple - does order of entries in rules list match insertion order?
- insertion liveness - is
cssRules[]live with respect to insertions and deletions?see https://dvcs.w3.org/hg/csswg/raw-file/tip/cssom/Overview.html#dom-stylesheet-insertrule