fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return element from string': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Y.Assert.areEqual(document.getElementById('test-id'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return first match when dupe id exists': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Y.Assert.areEqual(dupe, Y.DOM.byId('test-id'));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return null when no match': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return null when input is null': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return null when input is undefined': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should avoid mistaking name for id': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var inputs = document.getElementsByTagName('form')[0]
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual(inputs[0], Y.DOM.byId('test-name-id1'));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual(inputs[1], Y.DOM.byId('test-name-id2'));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should avoid mistaking form id for named input': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var form = document.getElementsByTagName('form')[0];
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual(form, Y.DOM.byId('test-names'));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should search the given node': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney node.innerHTML = '<span id="test-by-id-root">foo</span><span>bar</span>';
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should restrict search to the given node': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Y.Assert.isNull(Y.DOM.byId('test-by-id-root', node));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should search the given node (off document)': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney node.innerHTML = '<span id="test-by-id-root">foo</span><span>bar</span>';
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should search the given document (frame)': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Y.Assert.areEqual(document.getElementById('test-id'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should search the given document (frame)': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var frame = document.getElementById('test-frame'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return all elements with the given id': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var nodes = document.getElementById('test-dupe-ids')
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney ArrayAssert.itemsAreEqual(nodes, Y.DOM.allById('test-dupe-id'));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return all elements with the given id (root element)': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-dupe-root'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney ArrayAssert.itemsAreEqual(nodes, Y.DOM.allById('test-dupe-id', node));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return empty array when no match': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney ArrayAssert.itemsAreEqual([], Y.DOM.allById('fake-id'));
03492fa477ba30a43e50ef260c72731b9b754d91Matt Sweeney 'should find cloned element': function() {
03492fa477ba30a43e50ef260c72731b9b754d91Matt Sweeney ArrayAssert.itemsAreEqual([clone], Y.DOM.allById('cloned-node'));
db445e900d0225be4de71ea099e90c2a0ad12921Matt Sweeney 'should ignore matches on NAME instead of ID': function() {
db445e900d0225be4de71ea099e90c2a0ad12921Matt Sweeney Assert.areEqual(1, Y.DOM.allById('test-names').length);
db445e900d0225be4de71ea099e90c2a0ad12921Matt Sweeney 'should find all clones': function() {
db445e900d0225be4de71ea099e90c2a0ad12921Matt Sweeney ArrayAssert.itemsAreEqual([clone, clone2], Y.DOM.allById('cloned-node'));
db445e900d0225be4de71ea099e90c2a0ad12921Matt Sweeney 'should find all cloned forms': function() {
db445e900d0225be4de71ea099e90c2a0ad12921Matt Sweeney var node = document.getElementById('test-clone-form'),
db445e900d0225be4de71ea099e90c2a0ad12921Matt Sweeney ArrayAssert.itemsAreEqual([clone, clone2], Y.DOM.allById('cloned-node'));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return the text content of the given node': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-get-text'),
83bac8606b329c30526704e0950e886c89bfde48Matt Sweeney Assert.areEqual(Y.Lang.trim(text), Y.Lang.trim(Y.DOM.getText(node)));
c31e28da00e9fe86d7e9aebaa5ff25933fec30b4Matt Sweeney 'should return the text content of the given text node': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return empty string when no text found' : function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return empty string when input is null' : function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return empty string when input is undefined' : function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should set content with the given text': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual(content, Y.DOM.getText(node, content));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should set html content as text': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual(content, Y.DOM.getText(node, content));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should preserve spaces': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual(content, Y.DOM.getText(node, content));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should replace existing content': function() {
82f3694450ab9870df1b580e54d8cb58968869f9Matt Sweeney Assert.areEqual(content, Y.DOM.getText(node, content));
82f3694450ab9870df1b580e54d8cb58968869f9Matt Sweeney 'should set text for text node': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual(content, Y.DOM.getText(node, content));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return the next element': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var root = document.getElementById('test-element-by-axis'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual(root.getElementsByTagName('span')[0],
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return the next node': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var root = document.getElementById('test-element-by-axis'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Y.DOM.elementByAxis(node, 'nextSibling', null, true));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return the next element that passes the test fn': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var root = document.getElementById('test-element-by-axis'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual(root.getElementsByTagName('em')[0],
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return the next node that passes the test fn': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var root = document.getElementById('test-element-by-axis'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual(root.getElementsByTagName('span')[0].nextSibling,
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Y.DOM.elementByAxis(node, 'nextSibling', fn, true));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return the previous element': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var root = document.getElementById('test-element-by-axis'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual(root.getElementsByTagName('div')[0],
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return the previous node': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var root = document.getElementById('test-element-by-axis'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Y.DOM.elementByAxis(node, 'previousSibling', null, true));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return the previous element that passes the test fn': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var root = document.getElementById('test-element-by-axis'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual(root.getElementsByTagName('div')[0],
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Y.DOM.elementByAxis(node, 'previousSibling', fn));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return the previous node that passes the test fn': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var root = document.getElementById('test-element-by-axis'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual(root.getElementsByTagName('div')[0].previousSibling,
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Y.DOM.elementByAxis(node, 'previousSibling', fn, true));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return the parent element': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var root = document.getElementById('test-element-by-axis'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual(root, Y.DOM.elementByAxis(node, 'parentNode'));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return the ancestor element that passes the test fn': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var root = document.getElementById('test-element-by-axis'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return null when not found': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var root = document.getElementById('test-element-by-axis'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.isNull(Y.DOM.elementByAxis(node, 'previousSibling'));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.isNull(Y.DOM.elementByAxis(node, 'previousSibling', fn));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.isNull(Y.DOM.elementByAxis(node, 'previousSibling', null, true));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.isNull(Y.DOM.elementByAxis(node, 'previousSibling', fn, true));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return null when input is null': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.isNull(Y.DOM.elementByAxis(null, 'previousSibling'));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.isNull(Y.DOM.elementByAxis(document.body));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return null when input is undefined': function() {
80d53e62b2ae5fa5ab6ae4fbcfcbfd8ef5764dd7Matt Sweeney 'should stop when the stop function returns true': function() {
80d53e62b2ae5fa5ab6ae4fbcfcbfd8ef5764dd7Matt Sweeney var root = document.getElementById('test-element-by-axis'),
80d53e62b2ae5fa5ab6ae4fbcfcbfd8ef5764dd7Matt Sweeney Assert.isNull(Y.DOM.elementByAxis(node, 'parentNode', fn, null, stopFn));
80d53e62b2ae5fa5ab6ae4fbcfcbfd8ef5764dd7Matt Sweeney 'should find ancestor before stop': function() {
80d53e62b2ae5fa5ab6ae4fbcfcbfd8ef5764dd7Matt Sweeney var root = document.getElementById('test-element-by-axis'),
80d53e62b2ae5fa5ab6ae4fbcfcbfd8ef5764dd7Matt Sweeney Y.DOM.elementByAxis(node, 'parentNode', fn, null, stopFn).id);
80d53e62b2ae5fa5ab6ae4fbcfcbfd8ef5764dd7Matt Sweeney 'should find ancestor when both test and stop return true': function() {
80d53e62b2ae5fa5ab6ae4fbcfcbfd8ef5764dd7Matt Sweeney var root = document.getElementById('test-element-by-axis'),
80d53e62b2ae5fa5ab6ae4fbcfcbfd8ef5764dd7Matt Sweeney Y.DOM.elementByAxis(node, 'parentNode', fn, null, stopFn).id);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return the parent node': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return the same node': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return the matching ancestor': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var root = document.getElementById('test-element-by-axis'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual(document.body, Y.DOM.ancestor(node, fn));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return the matching ancestor (test self match)': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var root = document.getElementById('test-element-by-axis'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual(node, Y.DOM.ancestor(node, fn, true));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return the matching ancestor (test self not matched)': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var root = document.getElementById('test-element-by-axis'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual(document.body, Y.DOM.ancestor(node, fn, true));
80d53e62b2ae5fa5ab6ae4fbcfcbfd8ef5764dd7Matt Sweeney 'should stop when the stop function returns true': function() {
80d53e62b2ae5fa5ab6ae4fbcfcbfd8ef5764dd7Matt Sweeney var root = document.getElementById('test-element-by-axis'),
80d53e62b2ae5fa5ab6ae4fbcfcbfd8ef5764dd7Matt Sweeney Assert.isNull(Y.DOM.ancestor(node, fn, null, stopFn));
80d53e62b2ae5fa5ab6ae4fbcfcbfd8ef5764dd7Matt Sweeney 'should find ancestor before stop': function() {
80d53e62b2ae5fa5ab6ae4fbcfcbfd8ef5764dd7Matt Sweeney var root = document.getElementById('test-element-by-axis'),
80d53e62b2ae5fa5ab6ae4fbcfcbfd8ef5764dd7Matt Sweeney 'should find ancestor when both test and stop return true': function() {
80d53e62b2ae5fa5ab6ae4fbcfcbfd8ef5764dd7Matt Sweeney var root = document.getElementById('test-element-by-axis'),
aab1eeae8965892252706bf128f878101c5a01b1Matt Sweeney 'should return an array of one (documentElement)': function() {
aab1eeae8965892252706bf128f878101c5a01b1Matt Sweeney ArrayAssert.itemsAreEqual([document.documentElement],
aab1eeae8965892252706bf128f878101c5a01b1Matt Sweeney 'should include the starting node': function() {
aab1eeae8965892252706bf128f878101c5a01b1Matt Sweeney ArrayAssert.itemsAreEqual([document.documentElement, document.body, node],
aab1eeae8965892252706bf128f878101c5a01b1Matt Sweeney 'should omit the starting node': function() {
aab1eeae8965892252706bf128f878101c5a01b1Matt Sweeney ArrayAssert.itemsAreEqual([document.documentElement, document.body],
aab1eeae8965892252706bf128f878101c5a01b1Matt Sweeney 'should return the matching ancestors': function() {
aab1eeae8965892252706bf128f878101c5a01b1Matt Sweeney ArrayAssert.itemsAreEqual([document.body], Y.DOM.ancestors(node, fn));
aab1eeae8965892252706bf128f878101c5a01b1Matt Sweeney 'should return the matching ancestors (test self match)': function() {
aab1eeae8965892252706bf128f878101c5a01b1Matt Sweeney var root = document.getElementById('test-element-by-axis'),
aab1eeae8965892252706bf128f878101c5a01b1Matt Sweeney ArrayAssert.itemsAreEqual([node], Y.DOM.ancestors(node, fn, true));
aab1eeae8965892252706bf128f878101c5a01b1Matt Sweeney 'should return the matching ancestors (test self not matched)': function() {
aab1eeae8965892252706bf128f878101c5a01b1Matt Sweeney var root = document.getElementById('test-element-by-axis'),
aab1eeae8965892252706bf128f878101c5a01b1Matt Sweeney ArrayAssert.itemsAreEqual([document.body], Y.DOM.ancestors(node, fn, true));
deb3172da8a688abb44a22d5b084c4dd0437df89Matt Sweeney 'should stop when the stop function returns true': function() {
deb3172da8a688abb44a22d5b084c4dd0437df89Matt Sweeney var root = document.getElementById('test-element-by-axis'),
deb3172da8a688abb44a22d5b084c4dd0437df89Matt Sweeney ArrayAssert.itemsAreEqual([], Y.DOM.ancestors(node, fn, null, stopFn));
deb3172da8a688abb44a22d5b084c4dd0437df89Matt Sweeney 'should find ancestor before stop': function() {
deb3172da8a688abb44a22d5b084c4dd0437df89Matt Sweeney var root = document.getElementById('test-element-by-axis'),
deb3172da8a688abb44a22d5b084c4dd0437df89Matt Sweeney 'should find ancestor when both test and stop return true': function() {
deb3172da8a688abb44a22d5b084c4dd0437df89Matt Sweeney var root = document.getElementById('test-element-by-axis'),
deb3172da8a688abb44a22d5b084c4dd0437df89Matt Sweeney Y.DOM.ancestors(node, fn, null, stopFn).length);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'html element should contain body element': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.isTrue(Y.DOM.contains(document.documentElement, document.body));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'body element should not contain html element': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.isFalse(Y.DOM.contains(document.body, document.documentElement));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should be true for contained element': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.isTrue(Y.DOM.contains(document.body, node));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should be false for uncontained element': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.isFalse(Y.DOM.contains(document.body, node));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should be true when element is element': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.isTrue(Y.DOM.contains(document.body, document.body));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should be true for contained text node': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.isTrue(Y.DOM.contains(document.documentElement, node));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should be false for uncontained text node': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.isFalse(Y.DOM.contains(document.body, node));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return false for null input': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.isFalse(Y.DOM.contains(document.body, null));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return false for undefined input': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'html element should contain body element': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.isTrue(Y.DOM._bruteContains(document.documentElement, document.body));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'body element should not contain html element': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.isFalse(Y.DOM._bruteContains(document.body, document.documentElement));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should be true for contained element': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.isTrue(Y.DOM._bruteContains(document.body, node));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should be false for uncontained element': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.isFalse(Y.DOM._bruteContains(document.body, node));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should be true when element is element': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.isTrue(Y.DOM._bruteContains(document.body, document.body));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should be true for contained text node': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.isTrue(Y.DOM._bruteContains(document.documentElement, node));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should be false for uncontained text node': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.isFalse(Y.DOM._bruteContains(document.body, node));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return false for null input': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.isFalse(Y.DOM._bruteContains(document.body, null));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.isFalse(Y.DOM._bruteContains(null, node));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.isFalse(Y.DOM._bruteContains(null, null));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return false for undefined input': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.isFalse(Y.DOM._bruteContains(document.body));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return false for off document node': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return true for in document node': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return false for removed node': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should work with duplicate IDs in document': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var nodes = document.getElementById('test-dupe-ids')
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should work with duplicate IDs off document': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should work with form that has input name="id" and id="id"': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-names');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return false when input is null': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return false for cloned node off document': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return true for cloned node in document (same id)': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return true for cloned node in document (new id)': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create empty div': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should trim leading space': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create empty div (self-closed input)': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create div with text': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create div with innerHTML': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var el = Y.DOM.create(('<div><em>bar</em></div>'));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('<em>bar</em>', el.innerHTML.toLowerCase());
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create input type submit': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var el = Y.DOM.create('<input name="foo" value="bar" type="submit">');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create input type radio': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var el = Y.DOM.create('<input name="test-input" type="radio">');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create form': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a form with content': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var el = Y.DOM.create('<form><fieldset><legend>foo</legend>' +
83bac8606b329c30526704e0950e886c89bfde48Matt Sweeney '<label>foo:</label><input name="foo"><input type="submit"></fieldset></form>'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create legend': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create fieldset': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create label': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a list item': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a one item list': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a table': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a table with content': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var el = Y.DOM.create('<table><tr><td>foo</td><td>bar</td></tr></table>'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('TD', td.nextSibling.tagName, 'td 2');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a table head': function() {
1c8e83505eae7560612e069a40097601f35c7dc0Matt Sweeney 'should create a table head from uppercase': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a table head with nested table': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var el = Y.DOM.create('<thead><tr><td><table><tbody><tr>' +
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney '<td>fresh</td></tr></tbody></table></td></tr></thead>');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual(1, el.getElementsByTagName('table').length);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a table heading cell': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a caption': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var el = Y.DOM.create('<caption>fresh</caption>');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a colgroup': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a col element': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a colgroup with col elements': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var el = Y.DOM.create('<colgroup><col><col></colgroup>'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney // IE inserts a linefeed between cols
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a table row': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a table row with content': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var el = Y.DOM.create('<tr><td>foo</td><td>bar</td></tr>');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('TD', el.firstChild.nextSibling.tagName, 'td 2');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a table cell': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a table cell with content': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a button element': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var el = Y.DOM.create('<button>fresh</button>');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create an optgroup element': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var el = Y.DOM.create('<optgroup></optgroup>');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create an optgroup with an option': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var el = Y.DOM.create('<optgroup><option>foo</option></optgroup>');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('OPTION', el.firstChild.tagName, 'option');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create an optgroup with options': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var el = Y.DOM.create('<optgroup><option>foo</option><option>bar</option></optgroup>');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('OPTION', el.firstChild.tagName, 'option');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('OPTION', el.firstChild.nextSibling.tagName, 'option 2');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a select element': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a select with an option': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var el = Y.DOM.create('<select><option>foo</option></select>');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('OPTION', el.firstChild.tagName, 'option');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a select with options': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var el = Y.DOM.create('<select><option>foo</option><option>bar</option></select>');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('OPTION', el.firstChild.tagName, 'option');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('OPTION', el.firstChild.nextSibling.tagName, 'option 2');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a option element': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a option with content': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var el = Y.DOM.create('<option><foo</option>');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a selected option': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var el = Y.DOM.create('<option selected><foo</option>');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create an iframe (self-closed)': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create an iframe': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var el = Y.DOM.create('<iframe src="http://search.yahoo.com/" id="yui-iframetest"></iframe>');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create an iframe with attributes': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var html = '<iframe border="0" frameBorder="0" marginWidth="0"' +
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney ' marginHeight="0" leftMargin="0" topMargin="0"' +
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney ' allowTransparency="true" width="100%" height="99%"></iframe>';
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a script': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a script with src': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var el = Y.DOM.create('<scr' + 'ipt src="http://search.yahoo.com/"></scr' + 'ipt>');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('http://search.yahoo.com/', el.src);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a link element': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a link element with attrs': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var el = Y.DOM.create('<link href="http://search.yahoo.com/" rel="stylesheet">');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('http://search.yahoo.com/', el.href);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should create a textNode': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return a fragment when creating a collection': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var html = '<div>foo</div><div id="tmp-bar">bar</div><div>baz</div>',
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('tmp-bar', el.childNodes[1].id);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('foo', el.childNodes[0].innerHTML);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return a fragment containing options': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var html = '<option>foo</option><option id="tmp-bar">bar</option><option>baz</option>',
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('tmp-bar', el.childNodes[1].id);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return a fragment including text nodes': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return a fragment with the correct selected option': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var html = '<option>foo</option><option selected>bar</option><option>baz</option>';
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return a fragment containing table cells': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var html = '<td>foo</td><td id="tmp-bar">bar</td><td>baz</td>',
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('tmp-bar', el.childNodes[1].id);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return a fragment containing col elements': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('COL', el.childNodes[0].tagName);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('COL', el.childNodes[1].tagName);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return a fragment containing table bodies': function() {
14dc4f889a7b6c39f10aa490ea3c4c69de5e99bbMatt Sweeney var html = '<tbody><tr><td>foo</td></tr></tbody><tbody id="tmp-bar"><tr><td>bar</td></tr></tbody><tbody><tr><td>bar</td></tr></tbody>',
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('TBODY', el.childNodes[0].tagName);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('TBODY', el.childNodes[1].tagName);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('tmp-bar', el.childNodes[1].id);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return a fragment containing thead with nested table and tbody': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var html = '<thead><tr><td><table><tbody><tr><td>fresh</td></tr>' +
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney '</tbody></table></td></tr></thead><tbody></tbody>',
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('THEAD', el.firstChild.tagName);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual(1, el.firstChild.getElementsByTagName('table').length);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('TBODY', el.childNodes[1].tagName);
510f536d1be251eaf69272bd5b0b9a1f953683d9Matt Sweeney 'should return null when given null input': function() {
510f536d1be251eaf69272bd5b0b9a1f953683d9Matt Sweeney 'should return null when given undefined input': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return "className" value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('foo', Y.DOM.getAttribute(node, 'class'), 'class');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('foo', Y.DOM.getAttribute(node, 'className'), 'className');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return "for" value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('id', Y.DOM.getAttribute(node, 'for'));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('id', Y.DOM.getAttribute(node, 'htmlFor'));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should handle bad input': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should set className': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should set "for" attribute': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should handle bad input': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'input value should match html value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-text-value'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'input value should match no html value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-text-no-value'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'input value should match empty html value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-text-empty-value'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'textarea value should match html value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-textarea-text-value'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'textarea value should match no html value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-textarea-no-value'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should ignore textarea html value attribute': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-textarea-value');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'select value should match html value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-select-value');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'select value should match no html value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-select-no-value'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'select value should match empty html value with text': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-select-empty-value-text'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'select value should match empty html value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-select-empty-value'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'option value should match html value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-option-value');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'option value should match html content': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-option-value-text');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'option value should match no html value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-option-no-value'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'option value should match empty html value with text': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-select-empty-value-text'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'option value should match empty html value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-select-empty-value'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'button value should match html value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-button-value');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'button value should match no html value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-button-no-value'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'button value should ignore html content': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-button-text-value');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'button value should match empty value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-button-empty-value');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'input value should match updated value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-text-value'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'value updated from empty string should be new value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-text-empty-value'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'value updated from no value should be new value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-text-no-value'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'textarea from html value should match new value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-textarea-text-value'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'textarea from no value should match new value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-textarea-no-value'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'button value should match updated value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-button-value'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'button value updated from empty string should be new value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-button-empty-value'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'button value updated from no value should be new value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-button-no-value'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'option value should match updated value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-option-value'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'option value updated from text should be new value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-option-value-text'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'option value updated from empty string should be new value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-option-empty-value'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'option value updated from no value should be new value': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-option-no-value'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return fragment from HTMLCollection': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney node.innerHTML = '<div>foo</div><div>bar</div><div>baz</div>';
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return fragment from Array of HTML Elements': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return null for bad input': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return true for window object': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return true for frame window object': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var frame = document.getElementById('test-frame'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return false for document object': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return false for non-window input': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should remove all childNodes': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney html = '<em>foo</em><strong>bar</strong><span>baz</span>';
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should append the given html to the node': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('EM', node.lastChild.nodeName);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should prepend the given html to the node': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Y.DOM.addHTML(node, '<em>new content</em>', node.firstChild);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('EM', node.firstChild.nodeName);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should insert the given html after the first child': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney node.innerHTML = '<em>foo</em><strong>bar</strong>';
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Y.DOM.addHTML(node, '<span>new content</span>', node.childNodes[1]);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('SPAN', node.childNodes[1].nodeName);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should append the given node': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Y.DOM.addHTML(node, document.createElement('div'));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('DIV', node.firstChild.nodeName);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should add html before the given node': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney node.innerHTML = '<em>foo</em><strong>bar</strong>';
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Y.DOM.addHTML(node.childNodes[1], '<span>new content</span>', 'before');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('SPAN', node.childNodes[1].nodeName);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should add html after the given node': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney node.innerHTML = '<em>foo</em><strong>bar</strong>';
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Y.DOM.addHTML(node.childNodes[1], '<span>new content</span>', 'after');
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('SPAN', node.childNodes[2].nodeName);
59f175924390b0e7cf15bcae6f4e894b893259b4Matt Sweeney 'should replace the existing content (empty string)': function() {
59f175924390b0e7cf15bcae6f4e894b893259b4Matt Sweeney node.innerHTML = '<em>foo</em><strong>bar</strong>';
59f175924390b0e7cf15bcae6f4e894b893259b4Matt Sweeney 'should replace the existing content (null)': function() {
59f175924390b0e7cf15bcae6f4e894b893259b4Matt Sweeney node.innerHTML = '<em>foo</em><strong>bar</strong>';
59f175924390b0e7cf15bcae6f4e894b893259b4Matt Sweeney 'should replace the existing content (undefined)': function() {
59f175924390b0e7cf15bcae6f4e894b893259b4Matt Sweeney node.innerHTML = '<em>foo</em><strong>bar</strong>';
59f175924390b0e7cf15bcae6f4e894b893259b4Matt Sweeney 'should replace the existing content (0)': function() {
59f175924390b0e7cf15bcae6f4e894b893259b4Matt Sweeney node.innerHTML = '<em>foo</em><strong>bar</strong>';
cf44c6be4a920ebd3f8ac3143e387dda03dc7208Matt Sweeney 'should append the given nodelist': function() {
cf44c6be4a920ebd3f8ac3143e387dda03dc7208Matt Sweeney node.innerHTML = '<em>foo</em><strong>bar</strong>';
cf44c6be4a920ebd3f8ac3143e387dda03dc7208Matt Sweeney Assert.areEqual('EM', node2.childNodes[0].nodeName);
cf44c6be4a920ebd3f8ac3143e387dda03dc7208Matt Sweeney 'should insert the given nodelist before the given node': function() {
cf44c6be4a920ebd3f8ac3143e387dda03dc7208Matt Sweeney node.innerHTML = '<em>foo</em><strong>bar</strong>';
cf44c6be4a920ebd3f8ac3143e387dda03dc7208Matt Sweeney node2.innerHTML = '<span>baz</span><b>foobar</b>';
cf44c6be4a920ebd3f8ac3143e387dda03dc7208Matt Sweeney Y.DOM.addHTML(node2, nodelist, node2.firstChild.nextSibling);
cf44c6be4a920ebd3f8ac3143e387dda03dc7208Matt Sweeney Assert.areEqual('EM', node2.childNodes[1].nodeName);
cf44c6be4a920ebd3f8ac3143e387dda03dc7208Matt Sweeney 'should prepend the given nodelist': function() {
cf44c6be4a920ebd3f8ac3143e387dda03dc7208Matt Sweeney node.innerHTML = '<em>foo</em><strong>bar</strong>';
cf44c6be4a920ebd3f8ac3143e387dda03dc7208Matt Sweeney node2.innerHTML = '<span>baz</span><b>foobar</b>';
cf44c6be4a920ebd3f8ac3143e387dda03dc7208Matt Sweeney Y.DOM.addHTML(node2, nodelist, node2.firstChild);
cf44c6be4a920ebd3f8ac3143e387dda03dc7208Matt Sweeney Assert.areEqual('EM', node2.childNodes[0].nodeName);
2291c2a0c5280ce4cee43acf12a9a3df24f253f1Matt Sweeney 'should append the given number': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return RegExp obj': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return cached RegExp obj': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return new RegExp obj': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return document from body': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return document from new node': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var doc = Y.DOM._getDoc(document.createElement('div'));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return document from window': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return document from document': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return iframe document from iframe window': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var win = document.getElementById('test-frame').contentWindow,
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return iframe document from iframe node': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var win = document.getElementById('test-frame').contentWindow,
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney doc = Y.DOM._getDoc(win.document.getElementById('demo'));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return iframe document from iframe document': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var win = document.getElementById('test-frame').contentWindow,
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return window from body': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return window from new node': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var win = Y.DOM._getWin(document.createElement('div'));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return window from window': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return window from document': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return iframe window from iframe window': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var node = document.getElementById('test-frame'),
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areSame(node.contentWindow.window, win.window);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return iframe window from iframe node': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var contentWin = document.getElementById('test-frame').contentWindow,
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney win = Y.DOM._getWin(contentWin.document.getElementById('demo'));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should return iframe window from iframe document': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var contentWin = document.getElementById('test-frame').contentWindow,
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should append html on all nodes in HTMLCollection': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney node.innerHTML = '<span></span><span></span><span></span>';
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('P', node.childNodes[0].firstChild.tagName);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('P', node.childNodes[1].firstChild.tagName);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual('P', node.childNodes[2].firstChild.tagName);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney 'should setText on all nodes in HTMLCollection': function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney node.innerHTML = '<span>foo</span><span>bar</span><span>baz</span>',
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual(val, node.childNodes[0].innerHTML);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual(val, node.childNodes[1].innerHTML);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Assert.areEqual(val, node.childNodes[2].innerHTML);
d84031076fc432d8aae518149d34d0299805466cMatt Sweeney 'should return all sibling nodes (firstChild)': function() {
d84031076fc432d8aae518149d34d0299805466cMatt Sweeney node2 = parent.getElementsByTagName('span')[0],
d84031076fc432d8aae518149d34d0299805466cMatt Sweeney node3 = parent.getElementsByTagName('strong')[0],
d84031076fc432d8aae518149d34d0299805466cMatt Sweeney ArrayAssert.itemsAreEqual(siblings, [node2, node3]);
d84031076fc432d8aae518149d34d0299805466cMatt Sweeney 'should return all sibling nodes (lastChild)': function() {
d84031076fc432d8aae518149d34d0299805466cMatt Sweeney node = parent.getElementsByTagName('strong')[0],
d84031076fc432d8aae518149d34d0299805466cMatt Sweeney node3 = parent.getElementsByTagName('span')[0],
d84031076fc432d8aae518149d34d0299805466cMatt Sweeney ArrayAssert.itemsAreEqual(siblings, [node2, node3]);
d84031076fc432d8aae518149d34d0299805466cMatt Sweeney 'should return all sibling nodes': function() {
d84031076fc432d8aae518149d34d0299805466cMatt Sweeney node3 = parent.getElementsByTagName('strong')[0],
d84031076fc432d8aae518149d34d0299805466cMatt Sweeney ArrayAssert.itemsAreEqual(siblings, [node2, node3]);
d84031076fc432d8aae518149d34d0299805466cMatt Sweeney 'should return all matching sibling nodes': function() {
d84031076fc432d8aae518149d34d0299805466cMatt Sweeney node3 = parent.getElementsByTagName('strong')[0],
3489fc6bb1b5c6100aead509cd90048e4bb61617Matt Sweeney 'should wrap the node with the given html': function() {
3489fc6bb1b5c6100aead509cd90048e4bb61617Matt Sweeney 'should wrap the node with the given complex html': function() {
3489fc6bb1b5c6100aead509cd90048e4bb61617Matt Sweeney Y.DOM.wrap(node, '<p><em><strong><span></span></strong></em></p>');
3489fc6bb1b5c6100aead509cd90048e4bb61617Matt Sweeney Assert.areEqual('SPAN', node.parentNode.tagName);
5e366c4598b5b84847ec142b157bae6e29041a4dMatt Sweeney 'should wrap the paragraph with a div': function() {
5e366c4598b5b84847ec142b157bae6e29041a4dMatt Sweeney Assert.areEqual('DIV', node.parentNode.tagName);
3489fc6bb1b5c6100aead509cd90048e4bb61617Matt Sweeney 'should remove the node\'s parent': function() {
3489fc6bb1b5c6100aead509cd90048e4bb61617Matt Sweeney var node = document.createElement('span').appendChild(document.createElement('em'));
3489fc6bb1b5c6100aead509cd90048e4bb61617Matt Sweeney Assert.isTrue(!node.parentNode || node.parentNode.nodeType !== 1);
3489fc6bb1b5c6100aead509cd90048e4bb61617Matt Sweeney 'should remove the node\'s parent and replace in DOM': function() {
3489fc6bb1b5c6100aead509cd90048e4bb61617Matt Sweeney node = parent.appendChild(document.createElement('strong')).
3489fc6bb1b5c6100aead509cd90048e4bb61617Matt Sweeney document.body.insertBefore(parent, document.body.firstChild);
3489fc6bb1b5c6100aead509cd90048e4bb61617Matt Sweeney Assert.areEqual('SPAN', node.parentNode.tagName);
d84031076fc432d8aae518149d34d0299805466cMatt Sweeney 'should remove the node\'s parent and replace in DOM with siblings (node as firstChild)': function() {
d84031076fc432d8aae518149d34d0299805466cMatt Sweeney parent.innerHTML = '<p><em>bar</em><strong>baz</strong><span>foo</span></p>';
d84031076fc432d8aae518149d34d0299805466cMatt Sweeney Assert.areEqual('DIV', node.parentNode.tagName);
d84031076fc432d8aae518149d34d0299805466cMatt Sweeney Assert.areEqual('STRONG', node.nextSibling.tagName);
d84031076fc432d8aae518149d34d0299805466cMatt Sweeney Assert.areEqual('DIV', node.nextSibling.parentNode.tagName);
d84031076fc432d8aae518149d34d0299805466cMatt Sweeney Assert.areEqual('SPAN', node.nextSibling.nextSibling.tagName);
3489fc6bb1b5c6100aead509cd90048e4bb61617Matt Sweeney 'should remove the node\'s parent and replace in DOM with siblings': function() {
3489fc6bb1b5c6100aead509cd90048e4bb61617Matt Sweeney parent.innerHTML = '<p><span>foo</span><em>bar</em><strong>baz</strong></p>';
3489fc6bb1b5c6100aead509cd90048e4bb61617Matt Sweeney Assert.areEqual('DIV', node.parentNode.tagName);
3489fc6bb1b5c6100aead509cd90048e4bb61617Matt Sweeney Assert.areEqual('SPAN', node.previousSibling.tagName);
3489fc6bb1b5c6100aead509cd90048e4bb61617Matt Sweeney Assert.areEqual('DIV', node.previousSibling.parentNode.tagName);
3489fc6bb1b5c6100aead509cd90048e4bb61617Matt Sweeney Assert.areEqual('STRONG', node.nextSibling.tagName);
3489fc6bb1b5c6100aead509cd90048e4bb61617Matt Sweeney Assert.areEqual('DIV', node.nextSibling.parentNode.tagName);
b563272ca356962156a763b23e4736d0197b9134Matt Sweeney 'should get the id from the DIV': function() {
b563272ca356962156a763b23e4736d0197b9134Matt Sweeney 'should get the id from the new form element': function() {
b563272ca356962156a763b23e4736d0197b9134Matt Sweeney 'should get the id from the new form element (setAttribute)': function() {
b563272ca356962156a763b23e4736d0197b9134Matt Sweeney 'should get the id from the new form element rather than the named input': function() {
b563272ca356962156a763b23e4736d0197b9134Matt Sweeney 'should get the id from the new form rather than the named input (setAttribute)': function() {
b563272ca356962156a763b23e4736d0197b9134Matt Sweeney 'should get the id from the form rather than the named input': function() {
b563272ca356962156a763b23e4736d0197b9134Matt Sweeney var element = document.getElementsByTagName('form')[0];
b563272ca356962156a763b23e4736d0197b9134Matt Sweeney Assert.areEqual('test-names', Y.DOM.getId(element));
b563272ca356962156a763b23e4736d0197b9134Matt Sweeney 'should set the id on the DIV': function() {
b563272ca356962156a763b23e4736d0197b9134Matt Sweeney 'should set the id on the FORM': function() {
b563272ca356962156a763b23e4736d0197b9134Matt Sweeney 'should set the id on the FORM with a named INPUT': function() {
b563272ca356962156a763b23e4736d0197b9134Matt Sweeney 'should set the id on the FORM with an INPUT id === "id"': function() {
d84031076fc432d8aae518149d34d0299805466cMatt Sweeney 'should generate an ID': function() {
d84031076fc432d8aae518149d34d0299805466cMatt Sweeney 'should return exising ID': function() {
d84031076fc432d8aae518149d34d0299805466cMatt Sweeney}, '@VERSION@' ,{requires:['dom-core', 'test']});