dom-core-test.js revision b563272ca356962156a763b23e4736d0197b9134
ArrayAssert = Y.ArrayAssert;
name: 'Y.DOM.byId',
'should return element from string': function() {
},
'should return first match when dupe id exists': function() {
},
'should return null when no match': function() {
},
'should return null when input is null': function() {
},
'should return null when input is undefined': function() {
},
'should avoid mistaking name for id': function() {
.getElementsByTagName('input');
},
'should avoid mistaking form id for named input': function() {
},
'should search the given node': function() {
},
'should restrict search to the given node': function() {
},
'should search the given node (off document)': function() {
},
'should search the given document (frame)': function() {
},
'should search the given document (frame)': function() {
}
}));
name: 'Y.DOM.allById',
'should return all elements with the given id': function() {
.getElementsByTagName('span');
},
'should return all elements with the given id (root element)': function() {
},
'should return empty array when no match': function() {
},
'should find cloned element': function() {
},
'should ignore matches on NAME instead of ID': function() {
},
'should find all clones': function() {
},
'should find all cloned forms': function() {
}
}));
name: 'Y.DOM.getText',
'should return the text content of the given node': function() {
text = '',
i = 0,
}
},
'should return the text content of the given text node': function() {
var text = 'foo bar',
},
'should return empty string when no text found' : function() {
},
'should return empty string when input is null' : function() {
},
'should return empty string when input is undefined' : function() {
}
}));
name: 'Y.DOM.setText',
'should set content with the given text': function() {
content = 'testing text content';
},
'should set html content as text': function() {
content = '<div>testing text content</div>';
},
'should preserve spaces': function() {
content = ' testing text content ';
},
'should replace existing content': function() {
content = 'testing text content';
},
'should set text for text node': function() {
content = 'testing text content';
}
}));
name: 'Y.DOM.elementByAxis',
'should return the next element': function() {
},
'should return the next node': function() {
},
'should return the next element that passes the test fn': function() {
};
},
'should return the next node that passes the test fn': function() {
};
},
'should return the previous element': function() {
},
'should return the previous node': function() {
},
'should return the previous element that passes the test fn': function() {
};
},
'should return the previous node that passes the test fn': function() {
};
},
'should return the parent element': function() {
},
'should return the ancestor element that passes the test fn': function() {
};
},
'should return null when not found': function() {
};
},
'should return null when input is null': function() {
},
'should return null when input is undefined': function() {
},
'should stop when the stop function returns true': function() {
},
};
},
'should find ancestor before stop': function() {
},
};
},
'should find ancestor when both test and stop return true': function() {
},
};
}
}));
name: 'Y.DOM.ancestor',
'should return the parent node': function() {
},
'should return the same node': function() {
},
'should return the matching ancestor': function() {
};
},
'should return the matching ancestor (test self match)': function() {
};
},
'should return the matching ancestor (test self not matched)': function() {
};
},
'should stop when the stop function returns true': function() {
},
};
},
'should find ancestor before stop': function() {
},
};
},
'should find ancestor when both test and stop return true': function() {
},
};
}
}));
name: 'Y.DOM.ancestors',
'should return an array of one (documentElement)': function() {
},
'should include the starting node': function() {
},
'should omit the starting node': function() {
},
'should return the matching ancestors': function() {
};
},
'should return the matching ancestors (test self match)': function() {
};
},
'should return the matching ancestors (test self not matched)': function() {
};
},
'should stop when the stop function returns true': function() {
},
};
},
'should find ancestor before stop': function() {
},
};
],
},
'should find ancestor when both test and stop return true': function() {
},
};
}
}));
name: 'Y.DOM.contains',
'html element should contain body element': function() {
},
'body element should not contain html element': function() {
},
'should be true for contained element': function() {
},
'should be false for uncontained element': function() {
},
'should be true when element is element': function() {
},
'should be true for contained text node': function() {
},
'should be false for uncontained text node': function() {
},
'should return false for null input': function() {
},
'should return false for undefined input': function() {
}
}));
name: 'Y.DOM._bruteContains',
'html element should contain body element': function() {
},
'body element should not contain html element': function() {
},
'should be true for contained element': function() {
},
'should be false for uncontained element': function() {
},
'should be true when element is element': function() {
},
'should be true for contained text node': function() {
},
'should be false for uncontained text node': function() {
},
'should return false for null input': function() {
},
'should return false for undefined input': function() {
}
}));
name: 'Y.DOM.inDoc',
'should return false for off document node': function() {
},
'should return true for in document node': function() {
},
'should return false for removed node': function() {
},
'should work with duplicate IDs in document': function() {
.getElementsByTagName('span');
},
'should work with duplicate IDs off document': function() {
},
'should work with form that has input name="id" and id="id"': function() {
},
'should return false when input is null': function() {
},
'should return false for cloned node off document': function() {
},
'should return true for cloned node in document (same id)': function() {
},
'should return true for cloned node in document (new id)': function() {
}
}));
name: 'Y.DOM.create',
'should create empty div': function() {
},
'should trim leading space': function() {
},
'should create empty div (self-closed input)': function() {
},
'should create div with text': function() {
},
'should create div with innerHTML': function() {
},
'should create input type submit': function() {
},
'should create input type radio': function() {
},
'should create form': function() {
},
'should create a form with content': function() {
'<label>foo:</label><input name="foo"><input type="submit"></fieldset></form>'),
},
'should create legend': function() {
},
'should create fieldset': function() {
},
'should create label': function() {
},
'should create a list item': function() {
},
'should create a one item list': function() {
},
'should create a table': function() {
},
'should create a table with content': function() {
},
'should create a table head': function() {
},
'should create a table head from uppercase': function() {
},
'should create a table head with nested table': function() {
'<td>fresh</td></tr></tbody></table></td></tr></thead>');
},
'should create a table heading cell': function() {
},
'should create a caption': function() {
},
'should create a colgroup': function() {
},
'should create a col element': function() {
},
'should create a colgroup with col elements': function() {
i = 0,
cols = [],
// IE inserts a linefeed between cols
}
}
},
'should create a table row': function() {
},
'should create a table row with content': function() {
},
'should create a table cell': function() {
},
'should create a table cell with content': function() {
},
'should create a button element': function() {
},
'should create an optgroup element': function() {
},
'should create an optgroup with an option': function() {
},
'should create an optgroup with options': function() {
},
'should create a select element': function() {
},
'should create a select with an option': function() {
},
'should create a select with options': function() {
},
'should create a option element': function() {
},
'should create a option with content': function() {
},
'should create a selected option': function() {
},
'should create an iframe (self-closed)': function() {
},
'should create an iframe': function() {
},
'should create an iframe with attributes': function() {
var html = '<iframe border="0" frameBorder="0" marginWidth="0"' +
' marginHeight="0" leftMargin="0" topMargin="0"' +
' allowTransparency="true" width="100%" height="99%"></iframe>';
},
'should create a script': function() {
},
'should create a script with src': function() {
},
'should create a link element': function() {
},
'should create a link element with attrs': function() {
},
'should create a textNode': function() {
},
'should return a fragment when creating a collection': function() {
var html = '<div>foo</div><div id="tmp-bar">bar</div><div>baz</div>',
},
'should return a fragment containing options': function() {
var html = '<option>foo</option><option id="tmp-bar">bar</option><option>baz</option>',
},
'should return a fragment including text nodes': function() {
var html = 'foo <span>bar</span> baz',
},
'should return a fragment with the correct selected option': function() {
var html = '<option>foo</option><option selected>bar</option><option>baz</option>';
},
'should return a fragment containing table cells': function() {
var html = '<td>foo</td><td id="tmp-bar">bar</td><td>baz</td>',
},
'should return a fragment containing col elements': function() {
var html = '<col><col>',
},
'should return a fragment containing table bodies': function() {
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>',
},
'should return a fragment containing thead with nested table and tbody': function() {
var html = '<thead><tr><td><table><tbody><tr><td>fresh</td></tr>' +
'</tbody></table></td></tr></thead><tbody></tbody>',
},
'should return null when given null input': function() {
var html = null,
},
'should return null when given undefined input': function() {
}
}));
name: 'Y.DOM.getAttribute',
'should return "className" value': function() {
},
'should return "for" value': function() {
},
'should handle bad input': function() {
Y.DOM.getAttribute(null);
Y.DOM.getAttribute();
}
}));
name: 'Y.DOM.setAttribute',
'should set className': function() {
},
'should set "for" attribute': function() {
},
'should handle bad input': function() {
Y.DOM.setAttribute();
}
}));
name: 'Y.DOM.getValue',
'input value should match html value': function() {
val = 'test value';
},
'input value should match no html value': function() {
val = '';
},
'input value should match empty html value': function() {
val = '';
},
'textarea value should match html value': function() {
val = 'textarea test';
},
'textarea value should match no html value': function() {
val = '';
},
'should ignore textarea html value attribute': function() {
},
'select value should match html value': function() {
val = 'option value';
},
'select value should match no html value': function() {
val = '';
},
'select value should match empty html value with text': function() {
val = '';
},
'select value should match empty html value': function() {
val = '';
},
'option value should match html value': function() {
val = 'option value';
},
'option value should match html content': function() {
val = 'option text';
},
'option value should match no html value': function() {
val = '';
},
'option value should match empty html value with text': function() {
val = '';
},
'option value should match empty html value': function() {
val = '';
},
'button value should match html value': function() {
val = 'button value';
},
'button value should match no html value': function() {
val = '';
},
'button value should ignore html content': function() {
val = '';
},
'button value should match empty value': function() {
val = '';
}
}));
name: 'Y.DOM.setValue',
'input value should match updated value': function() {
val = 'new value';
},
'value updated from empty string should be new value': function() {
val = 'new value';
},
'value updated from no value should be new value': function() {
val = 'new value';
},
'textarea from html value should match new value': function() {
val = 'new textarea test';
},
'textarea from no value should match new value': function() {
val = 'new textarea test';
},
'button value should match updated value': function() {
val = 'new value';
},
'button value updated from empty string should be new value': function() {
val = 'new value';
},
'button value updated from no value should be new value': function() {
val = 'new value';
},
'option value should match updated value': function() {
val = 'new value';
},
'option value updated from text should be new value': function() {
val = 'new value';
},
'option value updated from empty string should be new value': function() {
val = 'new value';
},
'option value updated from no value should be new value': function() {
val = 'new value';
}
}));
name: 'Y.DOM._nl2Frag',
'should return fragment from HTMLCollection': function() {
frag;
},
'should return fragment from Array of HTML Elements': function() {
var nodes = [
],
},
'should return null for bad input': function() {
}
}));
name: 'Y.DOM.isWindow',
'should return true for window object': function() {
},
'should return true for frame window object': function() {
},
'should return false for document object': function() {
},
'should return false for non-window input': function() {
}
}));
name: 'Y.DOM._removeChildNodes',
'should remove all childNodes': function() {
html = '<em>foo</em><strong>bar</strong><span>baz</span>';
}
}));
name: 'Y.DOM.addHTML',
'should append the given html to the node': function() {
},
'should prepend the given html to the node': function() {
},
'should insert the given html after the first child': function() {
},
'should append the given node': function() {
},
'should add html before the given node': function() {
},
'should add html after the given node': function() {
},
'should replace the existing content (empty string)': function() {
},
'should replace the existing content (null)': function() {
},
'should replace the existing content (undefined)': function() {
},
'should replace the existing content (0)': function() {
},
'should append the given nodelist': function() {
},
'should insert the given nodelist before the given node': function() {
},
'should prepend the given nodelist': function() {
},
'should append the given number': function() {
}
}));
name: 'Y.DOM._getRegExp',
'should return RegExp obj': function() {
},
'should return cached RegExp obj': function() {
},
'should return new RegExp obj': function() {
}
}));
name: 'Y.DOM._getDoc',
'should return document from body': function() {
},
'should return document from new node': function() {
},
'should return document from window': function() {
},
'should return document from document': function() {
},
'should return iframe document from iframe window': function() {
},
'should return iframe document from iframe node': function() {
},
'should return iframe document from iframe document': function() {
}
}));
name: 'Y.DOM._getWin',
'should return window from body': function() {
},
'should return window from new node': function() {
},
'should return window from window': function() {
},
'should return window from document': function() {
},
'should return iframe window from iframe window': function() {
},
'should return iframe window from iframe node': function() {
},
'should return iframe window from iframe document': function() {
}
}));
name: 'Y.DOM._batch',
'should append html on all nodes in HTMLCollection': function() {
val = '<p>new text</p>';
},
'should setText on all nodes in HTMLCollection': function() {
val = 'new text';
}
}));
name: 'Y.DOM.siblings',
'should return all sibling nodes (firstChild)': function() {
},
'should return all sibling nodes (lastChild)': function() {
},
'should return all sibling nodes': function() {
},
'should return all matching sibling nodes': function() {
return n.tagName === 'STRONG';
});
}
}));
name: 'Y.DOM.wrap',
'should wrap the node with the given html': function() {
},
'should wrap the node with the given complex html': function() {
},
'should wrap the paragraph with a div': function() {
}
}));
name: 'Y.DOM.unwrap',
'should remove the node\'s parent': function() {
},
'should remove the node\'s parent and replace in DOM': function() {
},
'should remove the node\'s parent and replace in DOM with siblings (node as firstChild)': function() {
node;
},
'should remove the node\'s parent and replace in DOM with siblings': function() {
node;
}
}));
name: 'Y.DOM.getId',
'should get the id from the DIV': function() {
id = 'test-id';
},
'should get the id from the new form element': function() {
id = 'test-form-id';
},
'should get the id from the new form element (setAttribute)': function() {
id = 'test-form-id';
},
'should get the id from the new form element rather than the named input': function() {
id = 'test-form-id';
},
'should get the id from the new form rather than the named input (setAttribute)': function() {
id = 'test-form-id';
},
'should get the id from the form rather than the named input': function() {
}
}));
name: 'Y.DOM.setId',
'should set the id on the DIV': function() {
id = 'test-id';
},
'should set the id on the FORM': function() {
id = 'test-id';
},
'should set the id on the FORM with a named INPUT': function() {
id = 'test-id';
},
'should set the id on the FORM with an INPUT id === "id"': function() {
id = 'test-id';
}
}));
name: 'Y.DOM.generateID',
'should generate an ID': function() {
},
'should return exising ID': function() {
id = 'foo';
}
}));