blob: 457da99083517b1bbacdba88fad4b74de2709712 [file] [log] [blame]
<!doctype html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<style>
#test-root * {
background-color: red;
}
</style>
<style id="style">
</style>
</head>
<body>
<div style="display:none" id="test-root">
</div>
</body>
<script>
description('Test :not(selector) on larger scale.');
var classes = [];
for (var i = 0; i < 30; ++i)
classes.push("class" + i);
var attributes = [];
for (var i = 0; i < 30; ++i)
attributes.push(["attribute" + i, "value" + i]);
function generateTestTree() {
var testRoot = document.getElementById('test-root');
for (var classIndex = 0; classIndex <= classes.length; ++classIndex) {
for (var attributeIndex = 0; attributeIndex <= attributes.length; ++attributeIndex) {
var testCase = document.createElement("testcase");
for (var i = 0; i < classIndex; ++i)
testCase.classList.add(classes[i]);
for (var i = 0; i < attributeIndex; ++i)
testCase.setAttribute(attributes[i][0], attributes[i][1]);
testRoot.appendChild(testCase);
}
}
}
generateTestTree();
var testCaseCount = (classes.length + 1) * (attributes.length + 1);
shouldBe('document.querySelectorAll("testcase:not(.class29[attribute7=value7][attribute5=value5][attribute17=value17].class13[attribute18=value18].class11[attribute28=value28][attribute25=value25].class0.class19.class6[attribute11=value11].class28[attribute3=value3].class23[attribute21=value21][attribute24=value24][attribute6=value6][attribute1=value1].class25[attribute15=value15][attribute27=value27][attribute23=value23].class15[attribute13=value13].class22.class12[attribute20=value20].class2[attribute9=value9][attribute26=value26].class1.class26.class27.class16[attribute10=value10].class18.class21.class5.class8.class4[attribute19=value19].class10[attribute29=value29][attribute14=value14][attribute8=value8].class3.class20[attribute4=value4].class9[attribute16=value16][attribute22=value22][attribute2=value2][attribute12=value12].class14.class24.class7.class17[attribute0=value0])").length', '' + (testCaseCount - 1));
shouldBe('document.querySelectorAll("testcase:not(.class16):not([attribute21=value21]):not([attribute8=value8]):not(.class20):not([attribute18=value18]):not([attribute20=value20]):not([attribute3=value3]):not(.class10):not(.class14):not([attribute17=value17]):not(.class4):not(.class17):not(.class22):not([attribute12=value12]):not([attribute16=value16]):not(.class9):not(.class5):not([attribute23=value23]):not(.class7):not(.class27):not(.class0):not([attribute9=value9]):not([attribute0=value0]):not([attribute27=value27]):not(.class3):not([attribute28=value28]):not([attribute6=value6]):not([attribute13=value13]):not(.class2):not([attribute24=value24]):not([attribute2=value2]):not(.class15):not([attribute5=value5]):not([attribute15=value15]):not(.class21):not([attribute22=value22]):not(.class29):not([attribute29=value29]):not(.class12):not([attribute1=value1]):not(.class8):not(.class19):not([attribute4=value4]):not([attribute25=value25]):not(.class28):not(.class13):not(.class26):not(.class18):not([attribute14=value14]):not(.class1):not([attribute11=value11]):not(.class24):not(.class6):not(.class23):not(.class11):not([attribute10=value10]):not(.class25):not([attribute7=value7]):not([attribute26=value26]):not([attribute19=value19])").length', '' + 1);
</script>
<script src="../../resources/js-test-post.js"></script>
</html>