');
+ });
+ it('should append text', function(){
+ var root = jqLite('
');
+ expect(root.append('text')).toEqual(root);
+ expect(root.html()).toEqual('text');
+ });
+ });
+ describe('remove', function(){
+ it('should remove', function(){
+ var root = jqLite('
abc
');
+ var span = root.find('span');
+ expect(span.remove()).toEqual(span);
+ expect(root.html()).toEqual('');
+ });
+ });
+ describe('after', function(){
+ it('should after', function(){
+ var root = jqLite('
');
+ var span = root.find('span');
+ expect(span.after('
')).toEqual(span);
+ expect(root.html().toLowerCase()).toEqual('
');
+ });
+ it('should allow taking text', function(){
+ var root = jqLite('
');
+ var span = root.find('span');
+ span.after('abc');
+ expect(root.html().toLowerCase()).toEqual('
abc');
+ });
+ });
+ describe('parent', function(){
+ it('should return empty set when no parent', function(){
+ var element = jqLite('
abc
');
+ expect(element.parent()).toBeTruthy();
+ expect(element.parent().length).toEqual(0);
+ });
+ });
+ describe('find', function(){
+ it('should find child by name', function(){
+ var root = jqLite('
');
+ var innerDiv = root.find('div');
+ expect(innerDiv.length).toEqual(1);
+ expect(innerDiv.html()).toEqual('text');
+ });
+ });
+
});
diff --git a/test/testabilityPatch.js b/test/testabilityPatch.js
index dc6acf8b..b5c2c3f4 100644
--- a/test/testabilityPatch.js
+++ b/test/testabilityPatch.js
@@ -142,8 +142,11 @@ function childNode(element, index) {
}
function dealoc(obj) {
- var element = (obj||{}).$element || obj;
- if (element && element.dealoc) element.dealoc();
+ if (obj) {
+ var element = obj.$element || obj || {};
+ if (element.nodeName) element = jqLite(element);
+ if (element.dealoc) element.dealoc();
+ }
}
extend(angular, {
@@ -179,7 +182,7 @@ function sortedHtml(element, showNgClass) {
replace(//g, '>');
} else {
- html += '<' + node.nodeName.toLowerCase();
+ html += '<' + (node.nodeName || '?NOT_A_NODE?').toLowerCase();
var attributes = node.attributes || [];
var attrs = [];
var className = node.className || '';
--
cgit v1.2.3