web-platform-tests/wpt

More CSSOM tests

Open

#5,474 opened on 2017年4月7日

GitHub で見る
 (0 comments) (0 reactions) (0 assignees)HTML (4,581 stars) (2,898 forks)batch import
good first issuetype:missing-coveragewg-css

説明

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 create

see also https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Testing_media_queries for alternative

then evaluate query.mediaText to test serialized query

selectors

specify style sheet with rule with selector you want to test, e.g.,

<style>p.class {...}</style>

then use document.styleSheets[0].cssRules[0].selectorText to test results of serializing selector (p.class in 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).color

rules

specify rule in style sheet, e.g.,

<style>#test { color: blue; }<style>

then test serialized rule with

document.styleSheets[0].cssRules[0].cssText

declarations

<div id=test style='color: blue; font-size: 10px'>

then test serialized declaration with

var test = document.getElementById('test');
test.style.cssText

ALTERNATIVE STYLE SHEETS

  • Document.selectedStyleSheetSet
  • Document.lastStyleSheetSet
  • Document.preferredStyleSheetSet
  • Document.styleSheetSets
  • Document.enableStyleSheetForSet()

see https://drafts.csswg.org/cssom/#extensions-to-the-document-interface

GETCOMPUTEDSTYLE()

  • test pseudoElt parameter
    • different cases (upper, lower, mixed)
    • whitespace padding
    • different values than ::before and ::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

コントリビューターガイド