blob: 2d03a4c55a5546970547d9ea8dd6080b43057142 [file] [log] [blame]
Test cases of :nth-last-child() matching only the last child.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Testing ":nth-last-child(1)"
PASS document.querySelectorAll('#test-root :nth-last-child(1)').length is 1
PASS document.querySelectorAll('#test-root :nth-last-child(1)')[0].id is "testcase5"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
Testing ":nth-last-child(+1)"
PASS document.querySelectorAll('#test-root :nth-last-child(+1)').length is 1
PASS document.querySelectorAll('#test-root :nth-last-child(+1)')[0].id is "testcase5"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
Testing ":nth-last-child(-n+1)"
PASS document.querySelectorAll('#test-root :nth-last-child(-n+1)').length is 1
PASS document.querySelectorAll('#test-root :nth-last-child(-n+1)')[0].id is "testcase5"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
Testing ":nth-last-child(-2n+1)"
PASS document.querySelectorAll('#test-root :nth-last-child(-2n+1)').length is 1
PASS document.querySelectorAll('#test-root :nth-last-child(-2n+1)')[0].id is "testcase5"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
Testing ":nth-last-child(-3n+1)"
PASS document.querySelectorAll('#test-root :nth-last-child(-3n+1)').length is 1
PASS document.querySelectorAll('#test-root :nth-last-child(-3n+1)')[0].id is "testcase5"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
Testing ":nth-last-child(odd):nth-last-child(1):nth-last-child(2n+1)"
PASS document.querySelectorAll('#test-root :nth-last-child(odd):nth-last-child(1):nth-last-child(2n+1)').length is 1
PASS document.querySelectorAll('#test-root :nth-last-child(odd):nth-last-child(1):nth-last-child(2n+1)')[0].id is "testcase5"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
Testing ":nth-last-child(odd):nth-last-child(+1):nth-last-child(2n+1)"
PASS document.querySelectorAll('#test-root :nth-last-child(odd):nth-last-child(+1):nth-last-child(2n+1)').length is 1
PASS document.querySelectorAll('#test-root :nth-last-child(odd):nth-last-child(+1):nth-last-child(2n+1)')[0].id is "testcase5"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
Testing ":nth-last-child(odd):nth-last-child(-n+1):nth-last-child(2n+1)"
PASS document.querySelectorAll('#test-root :nth-last-child(odd):nth-last-child(-n+1):nth-last-child(2n+1)').length is 1
PASS document.querySelectorAll('#test-root :nth-last-child(odd):nth-last-child(-n+1):nth-last-child(2n+1)')[0].id is "testcase5"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
Testing ":nth-last-child(odd):nth-last-child(-2n+1):nth-last-child(2n+1)"
PASS document.querySelectorAll('#test-root :nth-last-child(odd):nth-last-child(-2n+1):nth-last-child(2n+1)').length is 1
PASS document.querySelectorAll('#test-root :nth-last-child(odd):nth-last-child(-2n+1):nth-last-child(2n+1)')[0].id is "testcase5"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
Testing ":nth-last-child(odd):nth-last-child(-3n+1):nth-last-child(2n+1)"
PASS document.querySelectorAll('#test-root :nth-last-child(odd):nth-last-child(-3n+1):nth-last-child(2n+1)').length is 1
PASS document.querySelectorAll('#test-root :nth-last-child(odd):nth-last-child(-3n+1):nth-last-child(2n+1)')[0].id is "testcase5"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
Testing ":nth-last-child(-n-1)"
PASS document.querySelectorAll('#test-root :nth-last-child(-n-1)').length is 0
PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(255, 0, 0)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(255, 0, 0)"
Testing ":nth-last-child(n+1)"
PASS document.querySelectorAll('#test-root :nth-last-child(n+1)').length is 5
PASS document.querySelectorAll('#test-root :nth-last-child(n+1)')[0].id is "testcase1"
PASS document.querySelectorAll('#test-root :nth-last-child(n+1)')[1].id is "testcase2"
PASS document.querySelectorAll('#test-root :nth-last-child(n+1)')[2].id is "testcase3"
PASS document.querySelectorAll('#test-root :nth-last-child(n+1)')[3].id is "testcase4"
PASS document.querySelectorAll('#test-root :nth-last-child(n+1)')[4].id is "testcase5"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(10, 100, 200)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(10, 100, 200)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(10, 100, 200)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
Testing ":nth-last-child(n-1)"
PASS document.querySelectorAll('#test-root :nth-last-child(n-1)').length is 5
PASS document.querySelectorAll('#test-root :nth-last-child(n-1)')[0].id is "testcase1"
PASS document.querySelectorAll('#test-root :nth-last-child(n-1)')[1].id is "testcase2"
PASS document.querySelectorAll('#test-root :nth-last-child(n-1)')[2].id is "testcase3"
PASS document.querySelectorAll('#test-root :nth-last-child(n-1)')[3].id is "testcase4"
PASS document.querySelectorAll('#test-root :nth-last-child(n-1)')[4].id is "testcase5"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[0]).backgroundColor is "rgb(10, 100, 200)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[1]).backgroundColor is "rgb(10, 100, 200)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[2]).backgroundColor is "rgb(10, 100, 200)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[3]).backgroundColor is "rgb(10, 100, 200)"
PASS getComputedStyle(document.querySelectorAll("#test-root *")[4]).backgroundColor is "rgb(10, 100, 200)"
PASS successfullyParsed is true
TEST COMPLETE