W3C home > Mailing lists > Public > public-css-testsuite@w3.org > January 2009

Re: CSS Namespaces Module Test Suite

From: fantasai <fantasai.lists@inkedblade.net>
Date: Wed, 28 Jan 2009 12:31:38 -0800
Message-ID: <4980C0AA.6080102@inkedblade.net>
To: Anne van Kesteren <annevk@opera.com>
CC: public-css-testsuite@w3.org

Anne van Kesteren wrote:
> 
> On Mon, 13 Oct 2008 13:53:16 +0200, fantasai
> <fantasai.lists@inkedblade.net> wrote:
>> Thanks, Anne. Here are my comments:
> 
> Thank you:
>   http://dev.w3.org/CSS/css3-namespace-test-suite/
>> s/line/sentence/g;
> 
> Done.

OK.

>> Also, you need to add
>>    - tests that introduce various whitespace and comment patterns
> 
> Done (basic tests, syntax-012.xml).

OK. syntax-012.xml looks good.

>>    - tests for parsing failures within the @namespace rule (to make
>>      sure the failure is detected, causes the rule to be ignored, and
>>      doesn't affect anything outside the scope of the "ignore" behavior
>>      for @rules).
> 
> Done (syntax-013.xml, one test requires scripting). (Actually managed to 
> find a bug here in at least Opera and Firefox. The @namespace rule in 
> the style sheet '@namespace x "test' gets dropped rather than fixed up 
> per the rules in CSS 2.1 section 4.2.)

You should probably split this into two tests, one for the end-of-stylesheet
error (that requires scripting) and one for other errors (that don't require
scripting). For the non-scripting test, add a few more tests:

   - Space between @ and namespace, e.g. @ namespace "test";
   - Missing end quote: @namespace "test;
   - Missing end quote in url: @namespace url('test);
   - Missing end-parens in url (should eat until close parens): @namespace url(test;

>>    - tests for @namespace followed by an invalid @rule (both invalid
>>      rules with known @keywords and rules with unknown @keywords)
> 
> Done (syntax-014.xml).

The rule for t should use a prefix so that it is ignored if the @namespace
doesn't get parsed properly.

You probably also want the "test-wrong" declaration to have some
testable effect.

>> http://dev.w3.org/CSS/css3-namespace-test-suite/src/prefix-001.xml
>>
>>    - Swap the order of the namespace declarations so that "x" wins
>>      in case the UA is mapping both declarations to the same prefix.
>>      (In this case neither background color will appear. Or you could
>>      add a test
>>        { background: red }
>>      rule to make it red in such a case.)
>>    - Add a rule
>>        FOO|test { background: red; }
>>      which tests an unbound prefix with the same case-insensitive
>>      mapping as the correct bound prefix.
> 
> Done.

r+

>> http://dev.w3.org/CSS/css3-namespace-test-suite/src/prefix-002.xml
>> http://dev.w3.org/CSS/css3-namespace-test-suite/src/prefix-003.xml
>>
>>    - These two have the same title. Please add something to the title
>>      to distinguish the two tests for when they are indexed in a TOC.
> 
> Done.

Changed to add "(Implied element namespace)" and "(Explicit element namespace)"
in place of a number.

r+

>> http://dev.w3.org/CSS/css3-namespace-test-suite/src/prefix-005.xml
>>
>>    - Put a rel="author" line for bz instead of a comment.
>>    - I don't think "empty string default namespace" is an appropriate
>>      title here. It's also a duplicate of the previous title. Please
>>      choose something appropriately unique and descriptive.
> 
> Done.

Changed to "No default namespace" since that seems to be what you're testing
as far as Namespaces is concerned...

r+

>> http://dev.w3.org/CSS/css3-namespace-test-suite/src/scope-001.xml
>>
>>    - I would title this 'scope <style>' to be more precise
> 
> Done.

r+

>> http://dev.w3.org/CSS/css3-namespace-test-suite/src/scope-002.xml
>>
>>    - Shift the test { background: lime } up into a separate <style>
>>    - Add an @namespace w declaration to the <style> with the @import
>>      and a
>>        w|test { background:red}
>>      rule to the scope.css style sheet
>>    - Add another @import with another external style sheet and add
>>      y and z declarations/selectors to test crossing sibling @imports.
> 
> Done, except that I did not add a z declaration/selector because that
> seemed unnecessary.

Ok. But you wrote
   test|y { background:lime }
instead of
   y|test { background: red }
I fixed it for you. Please verify that the test is now correct.

>> http://dev.w3.org/CSS/css3-namespace-test-suite/src/syntax-001.xml
>>
>>    - This should perhaps be @namespace "string".
> 
> Named it case-insensitivity instead.

r+

>>    - You also should have corresponding tests with 'string' and url().
>>      For url() syntax you need to test all three of double-quoted,
>>      single-quoted, and unquoted url() syntax.
> 
> Done. The new tests are now in syntax-005.xml.

r+

>> http://dev.w3.org/CSS/css3-namespace-test-suite/src/syntax-002.xml
>>
>>    - Add a backslash before the 'p' and the 'N' in @NAmespace.
>>    - Unicode-escape the A with six digits plus a space.
> 
> Done.

r+

>> http://dev.w3.org/CSS/css3-namespace-test-suite/src/syntax-003.xml
>>
>>    - The title should mention that this is a default namespace
>>      declaration.
>>    - Add corresponding tests with 'string' and "string".
> 
> Done, also added url() and url('').

I think you meant to leave out the prefixes in all these @namespace
declarations?

r- because the test is meaningless as-is.

>> http://dev.w3.org/CSS/css3-namespace-test-suite/src/syntax-005.xml
>> http://dev.w3.org/CSS/css3-namespace-test-suite/src/syntax-006.xml
>>
>>    - Apart from the escaped r, it seems -006 is merely a more complex
>>      form of -005, i.e. aside from the escape -005's test is a subset
>>      of -006. Was that the intent, or am I missing something here?
>>      Because if so, I would suggest removing -005, it doesn't seem
>>      necessary.
> 
> -005 is now a new test.

Ok. Since syntax-006.xml is an invalid test, I've flagged it as invalid.
Also made the title a bit clearer. Please review these changes:

   http://dev.w3.org/cvsweb/CSS/css3-namespace-test-suite/src/syntax-006.xml.diff?r1=1.2&r2=1.3&sortby=file

Also, the I would change the first @namespace declaration to use a prefix
and use that prefix instead of *, like this:

    @namespace x u\00072l("test");
    @import url("support/fail.css");
    @namespace url("test2");
    x|test { background:lime }
    test { background:red }

This makes sure that the first @namespace is being processed correctly.

>> http://dev.w3.org/CSS/css3-namespace-test-suite/src/syntax-007.xml
>>
>>    - This test is effectively the same as one with the @charset rule
>>      replaced by @foo;, because @charset is not valid there. You need
>>      to rewrite this test to use an external style sheet and place
>>      the @charset rule at the start of the style sheet.
> 
> Done.

The test is wrong. Because the @charset specifies an unknown encoding,
UAs are required to ignore the style sheet. Try specifying UTF-8.

>> http://dev.w3.org/CSS/css3-namespace-test-suite/src/syntax-008.xml
>>
>>    - You should also test prefixes that start with an escaped
>>      character that is not otherwise allowed in an identifier.
>>    - You need to test escapes in both the @namespace declaration
>>      and in the selector (but the escaping should not match).
>>    - I'd mention escaping in the title since that's mainly what's
>>      being tested here.
> 
> Done.

r+

> On Mon, 13 Oct 2008 14:34:43 +0200, fantasai
> <fantasai.lists@inkedblade.net> wrote:
>> Other tests needed:
>>
>>    "A URI string parsed from the URI syntax must be treated as a
>>     literal string: as with the STRING syntax, no URI-specific
>>     normalization is applied."
>>
>>    So a couple good tests here would be
>>      - comparing http://... in the source with HTTP://..., in the style
>>        sheet
>>      - comparing .com in the source with .COM in the style sheet
>>      - comparing a straight URL with one that has URI (%) escapes in it
>>
> 
> Done (syntax-011.xml).

Very good, except you forgot to use url() syntax. :)

>>    "All strings—including the empty string and strings representing
>>     invalid URIs—are valid namespace names in @namespace declarations."
>>
>>    This can't be tested by matching because XML namespaces must be URIs,
>>    but it can be tested by not-matching: overwriting a matching 
>> @namespace
>>    declaration with a non-matching one that has invalid URI characters
>>    in it (like "<>" or something).
> 
> The XML specification seems rather vague on whether that is an authoring
> or user agent requirement. Seems like a bug in XML. (I think user agents
> accept any string as namespace from some adhoc testing which meets my
> expectations.)

Yeah, but it's best if we write a test that will be accurate on both
types of systems. In any case, the validity of non-URI strings in CSS
needs a test. :)

>>    "If a namespace prefix or default namespace is declared more than
>>    once only the last declaration shall be used."
>>
>>    Multiple declarations probably deserves its own explicit test.
> 
> Done (syntax-010.xml).

r+

>>    "The prefix of a qualified name may be omitted to indicate that the
>>    name belongs to no namespace, i.e. that the namespace name part of
>>    the expanded name has no value."
>>
>>    Need a test for this one as well.
> 
> Done (prefix-006.xml).

r+

>>    "To form a qualified name in CSS syntax, a namespace prefix that
>>    has been declared within scope is prepended to a local name (such
>>    as an element or attribute name), separated by a "vertical bar"
>>    (|, U+007C)."
>>
>>    Should have a test that makes sure an escaped | is not recognized
>>    as the namespace prefix separator.
> 
> Done (syntax-009.xml).

r+

~fantasai
Received on Wednesday, 28 January 2009 20:32:20 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 20 September 2010 17:51:57 GMT