diff options
author | zherczeg@webkit.org <zherczeg@webkit.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2011-12-12 07:44:02 +0000 |
---|---|---|
committer | zherczeg@webkit.org <zherczeg@webkit.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2011-12-12 07:44:02 +0000 |
commit | a0d82b5c8a5645f7adc2019b2fc5d8f6d01ad0cb (patch) | |
tree | 0f7f1bf0b54dadd70d9905856d9746914e308de6 /third_party/WebKit/LayoutTests/fast/css/parsing-css-nth-child.html | |
parent | 0137df765d17629c01d6db34e55b8113a303b189 (diff) | |
download | chromium_src-a0d82b5c8a5645f7adc2019b2fc5d8f6d01ad0cb.zip chromium_src-a0d82b5c8a5645f7adc2019b2fc5d8f6d01ad0cb.tar.gz chromium_src-a0d82b5c8a5645f7adc2019b2fc5d8f6d01ad0cb.tar.bz2 |
Add new CSS nth-children parsing tests
https://bugs.webkit.org/show_bug.cgi?id=74178
Source/WebCore:
Reviewed by Darin Adler.
Test: fast/css/parsing-css-nth-child.html
* css/CSSParser.cpp:
(WebCore::isValidNthToken): Add "-n" to the possible identifiers.
LayoutTests:
The test covers several valid and invalid nth-child tokens.
Reviewed by Darin Adler.
* fast/css/parsing-css-nth-child-expected.txt: Added.
* fast/css/parsing-css-nth-child.html: Added.
git-svn-id: svn://svn.chromium.org/blink/trunk@102560 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Diffstat (limited to 'third_party/WebKit/LayoutTests/fast/css/parsing-css-nth-child.html')
-rw-r--r-- | third_party/WebKit/LayoutTests/fast/css/parsing-css-nth-child.html | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/css/parsing-css-nth-child.html b/third_party/WebKit/LayoutTests/fast/css/parsing-css-nth-child.html new file mode 100644 index 0000000..9af4a2f --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/css/parsing-css-nth-child.html @@ -0,0 +1,100 @@ +<head> +<style> +#a:nth-child(1n+0) { color: green; } +#b:nth-child(n+0) { color: green; } +#c:nth-child(n) { color: green; } +#d:nth-child(-n+0) { color: green; } +#e:nth-child(-n) { color: green; } + +#f:nth-child(1N+0) { color: green; } +#g:nth-child(N+0) { color: green; } +#h:nth-child(N) { color: green; } +#i:nth-child(-N+0) { color: green; } +#j:nth-child(-N) { color: green; } + +#k:nth-child(+ 1n) { color: green; } +#l:nth-child(-1N + - + 123 ) { color: green; } +#m:nth-child( N- 123) { color: green; } +#n:nth-child( n +12 3) { color: green; } +#o:nth-child( 23n + + + + +123 ) { color: green; } +#p:nth-child( 12 n ) { color: green; } +#q:nth-child(+12n-0+1) { color: green; } +#r:nth-child(+12N -- 1) { color: green; } +#s:nth-child(+12 N ) { color: green; } +#t:nth-child(+n+3) { color: green; } +#u:nth-child( +n + 7 ) { color: green; } +#v:nth-child(+ n + 7) { color: green; } +</style> + +<script> + +/** Changes the result text font size. */ +function runTest() +{ + if (window.layoutTestController) + layoutTestController.dumpAsText(); + + var rules = document.styleSheets[0].cssRules; + var text = ""; + for (var i = 0; i < rules.length; i++) { + text += rules.item(i).cssText; + text += "\n"; + } + + document.getElementById("result").appendChild(document.createTextNode(text)); + + if (document.getElementById("result").firstChild.data === document.getElementById("expected").firstChild.data) + document.getElementById("message").firstChild.data = "SUCCESS"; + else + document.getElementById("message").firstChild.data = "FAILURE"; +} + +</script> + +</head> + +<body onload="runTest()"> + +<p>Test parsing of CSS nth-child tokens.</p> + +<p id="message">TEST DID NOT COMPLETE</p> + +<p>Rules from the stylesheet:</p> + +<pre id="result"></pre> + +<p>Expected result:</p> + +<pre id="expected">#a:nth-child(1n+0) { color: green; } +#b:nth-child(n+0) { color: green; } +#c:nth-child(n) { color: green; } +#d:nth-child(-n+0) { color: green; } +#e:nth-child(-n) { color: green; } +#f:nth-child(1N+0) { color: green; } +#g:nth-child(N+0) { color: green; } +#h:nth-child(N) { color: green; } +#i:nth-child(-N+0) { color: green; } +#j:nth-child(-N) { color: green; } +#l:nth-child(-1N + - + 123) { color: green; } +#m:nth-child(N- 123) { color: green; } +#o:nth-child(23n + + + + +123) { color: green; } +#t:nth-child(+n+3) { color: green; } +#u:nth-child(+n + 7) { color: green; } +</pre> + +<script> + +</script> +</body> |