selector_new.html revision 7bd6c48178788dd4f19fa028e0294192ee2c7278
5a3bd0ef762b8a3238869ac9963194555e39e6a7jpikus<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
5a3bd0ef762b8a3238869ac9963194555e39e6a7jpikus<script type="text/javascript" src="/build/yui/yui.js"></script>
5a3bd0ef762b8a3238869ac9963194555e39e6a7jpikusYUI({ base: '/build/', filter: 'raw' }).use('console', 'test', function(Y) {
5a3bd0ef762b8a3238869ac9963194555e39e6a7jpikus var testSuite = new Y.Test.Suite("Selector Test Suite"),
5a3bd0ef762b8a3238869ac9963194555e39e6a7jpikus doc = document,
$ = Y.Selector.query;
//Y.config.useBrowserConsole = false;
testSuite.runTest = function(expected, selector, root, firstOnly) {
msg = 'expected: ' + expected.length + ', actual: ' + actualLength;
Y.Assert.areEqual(expected, actual, msg);
Y.ArrayAssert.itemsAreEqual(expected, actual, msg);
testSuite.css1DocAllCases = {name: 'CSS1 Document QueryAll'};
testSuite.css1BodyAllCases = {name: 'CSS1 Body QueryAll'};
testSuite.css1ElementAllCases = {name: 'CSS1 Element QueryAll'};
testSuite.css1DocCases = {name: 'CSS1 Document Query'};
testSuite.css1BodyCases = {name: 'CSS1 Body Query'};
testSuite.css1ElementCases = {name: 'CSS1 Element Query'};
testSuite.runTest([], q, root, firstOnly);
testSuite.runTest([], q, root, firstOnly);
testSuite.runTest([], q, null, firstOnly);
'h1': doc.getElementsByTagName('h1'),
'h2': doc.getElementsByTagName('h2'),
'.h2': doc.getElementsByTagName('h2'),
return Y.DOM.hasClass(node, 'heading');
'#only-h1': doc.getElementsByTagName('h1'),
'h1.heading': function() {
return Y.DOM.hasClass(node, 'heading');
'h1#only-h1': doc.getElementsByTagName('h1'),
'.heading#only-h1': doc.getElementsByTagName('h1'),
'div.heading': [],
'h1.heading#fake-id': [],
'h1.fake-class#only-h1': [],
'faketag.fake-class#only-h1': []
'h2, h2': doc.getElementsByTagName('h2'),
'h1, ': doc.getElementsByTagName('h1')
'h1 em': Y.DOM.byId('only-h1').getElementsByTagName('em'),
'div div h1': doc.getElementsByTagName('h1'),
'#first-child-of-body div h1': doc.getElementsByTagName('h1'),
'div h1': doc.getElementsByTagName('h1'),
'.first-child h1': doc.getElementsByTagName('h1'),
'body .first-child h1': doc.getElementsByTagName('h1'),
'html .first-child h1': doc.getElementsByTagName('h1'),
'html #only-body #only-h1 em': Y.DOM.byId('only-h1').getElementsByTagName('em'),
'#only-body h1': doc.getElementsByTagName('h1')
testSuite.css1DocCases[testCase] = function() {
testSuite.css1BodyCases[testCase] = function() {
test(doc.body);
testSuite.css1ElementCases[testCase] = function() {
test(Y.DOM.byId('test-root'));
testSuite.css1DocAllCases[testCase] = function() {
testSuite.css1BodyAllCases[testCase] = function() {
test(doc.body, true);
testSuite.css1ElementAllCases[testCase] = function() {
test(Y.DOM.byId('test-root'), true);
Y.each(test, function(fn, query) {
testSuite.css1DocCases[testCase] = function() {
testSuite.runTest(expected, query, doc, true);
testSuite.css1BodyCases[testCase] = function() {
testSuite.css1ElementCases[testCase] = function() {
testSuite.css1DocAllCases[testCase] = function() {
testSuite.runTest(expected, query, doc);
testSuite.css1BodyAllCases[testCase] = function() {
testSuite.css1ElementAllCases[testCase] = function() {
Y.Test.Runner.add(testSuite);