Testing on the cheap

Hello public-cssselfrags.

The spec depends on CSS3 Selectors, which has a testsuite.
http://www.w3.org/Style/CSS/Test/CSS3/Selectors/20091025/xhtml/index.html

Suppose we take a copy of the CSS Selectors test suite and split each test into two:
- an innermost file that is the test, except the selector under test is changed to :target 
- an outermost file that references the innermost in an iframe, with the selector used as a fragid (this is much the same as the existing iframe harness, see for example
http://www.w3.org/Style/CSS/Test/CSS3/Selectors/20091025/xhtml/full/xhtml_iframe/css3-modsel-1.xml )

Suppose we divide all selectors into one of three groups for the purposes of fragids:

a) must be selected
b) must not be selected
c) mumble mumble wiggle room

For a) the :target is green (and has whatever other styling the original test had to indicate a pass).
For b) the :target is red (and has whatever other styling the original test had to indicate a fail).
For c) we hope that category is small or ideally, empty.

As a worked example,
http://www.w3.org/Style/CSS/Test/CSS3/Selectors/20091025/xhtml/tests/css3-modsel-1.xml

which test the selector li,p

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title>Groups of selectors</title>
  <style type="text/css"><![CDATA[li,p { background-color : lime }]]></style>
  <link rel="next" href="css3-modsel-2.xml" title="Type element selectors"/>
  <link rel="last" href="css3-modsel-d4.xml" title="Dynamic updating of :first-child and :last-child"/>
  <link rel="up" href="./index.html"/>
  <link rel="top" href="../../index.html"/>
 </head>
 <body>
<ul>
  <li>The background of this list item should be green</li>
  <li>The background of this second list item should be also green</li>
</ul>
<p>The background of this paragraph should be green.</p>
</body>
</html>

becomes these two files. The first one looses the style element and most of the body, and adds an iframe with the fragid

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title>Groups of selectors</title>
  <link rel="next" href="css3-modsel-2.xml" title="Type element selectors"/>
  <link rel="last" href="css3-modsel-d4.xml" title="Dynamic updating of :first-child and :last-child"/>
  <link rel="up" href="./index.html"/>
  <link rel="top" href="../../index.html"/>
 </head>
 <body>
   <iframe src="css3-modsel-1.xml#css(li,p)"/>
 </body>
</html>

The second one has :target as the selector, looses the links in the head, and has the same body.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title>Groups of selectors</title>
  <style type="text/css"><![CDATA[:target{ background-color : lime }]]></style>
 </head>
 <body>
<ul>
  <li>The background of this list item should be green</li>
  <li>The background of this second list item should be also green</li>
</ul>
<p>The background of this paragraph should be green.</p>
</body>
</html>


-- 
 Chris Lilley   Technical Director, Interaction Domain                 
 W3C Graphics Activity Lead, Fonts Activity Lead
 Co-Chair, W3C Hypertext CG
 Member, CSS, WebFonts, SVG Working Groups

Received on Monday, 26 March 2012 18:58:27 UTC