');
    });
    it('should prepend to content', function() {
      var root = jqLite('
text');
    });
    it('should prepend text to content', function() {
      var root = jqLite('
');
      expect(root.prepend('abc')).toEqual(root);
      expect(root.html().toLowerCase()).toEqual('abctext');
    });
    it('should prepend array to empty in the right order', function() {
      var root = jqLite('
');
      expect(root.prepend([a, b, c])).toBe(root);
      expect(sortedHtml(root)).
        toBe('
');
    });
    it('should prepend array to content in the right order', function() {
      var root = jqLite('
text
');
      expect(root.prepend([a, b, c])).toBe(root);
      expect(sortedHtml(root)).
        toBe('
');
    });
  });
  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 parent or an empty set when no parent', function() {
      var parent = jqLite('
'),
          child = parent.find('p');
      expect(parent.parent()).toBeTruthy();
      expect(parent.parent().length).toEqual(0);
      expect(child.parent().length).toBe(1);
      expect(child.parent()[0]).toBe(parent[0]);
    });
    it('should return empty set when no parent', function() {
      var element = jqLite('
abc
');
      expect(element.parent()).toBeTruthy();
      expect(element.parent().length).toEqual(0);
    });
    it('should return empty jqLite object when parent is a document fragment', function() {
      //this is quite unfortunate but jQuery 1.5.1 behaves this way
      var fragment = document.createDocumentFragment(),
          child = jqLite('
foo
');
      fragment.appendChild(child[0]);
      expect(child[0].parentNode).toBe(fragment);
      expect(child.parent().length).toBe(0);
    });
  });
  describe('next', function() {
    it('should return next sibling', function() {
      var element = jqLite('
bi
');
      var b = element.find('b');
      var i = element.find('i');
      expect(b.next()).toJqEqual([i]);
    });
    it('should ignore non-element siblings', function() {
      var element = jqLite('
bTextNodei
');
      var b = element.find('b');
      var i = element.find('i');
      expect(b.next()).toJqEqual([i]);
    });
  });
  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');
    });
  });
  describe('eq', function() {
    it('should select the nth element ', function() {
      var element = jqLite('
aa
bb
');
      expect(element.find('span').eq(0).html()).toBe('aa');
      expect(element.find('span').eq(-1).html()).toBe('bb');
      expect(element.find('span').eq(20).length).toBe(0);
    });
  });
  describe('triggerHandler', function() {
    it('should trigger all registered handlers for an event', function() {
      var element = jqLite('
poke'),
          pokeSpy = jasmine.createSpy('poke'),
          clickSpy1 = jasmine.createSpy('clickSpy1'),
          clickSpy2 = jasmine.createSpy('clickSpy2');
      element.bind('poke', pokeSpy);
      element.bind('click', clickSpy1);
      element.bind('click', clickSpy2);
      expect(pokeSpy).not.toHaveBeenCalled();
      expect(clickSpy1).not.toHaveBeenCalled();
      expect(clickSpy2).not.toHaveBeenCalled();
      element.triggerHandler('poke');
      expect(pokeSpy).toHaveBeenCalledOnce();
      expect(clickSpy1).not.toHaveBeenCalled();
      expect(clickSpy2).not.toHaveBeenCalled();
      element.triggerHandler('click');
      expect(clickSpy1).toHaveBeenCalledOnce();
      expect(clickSpy2).toHaveBeenCalledOnce();
    });
  });
  describe('camelCase', function() {
   it('should leave non-dashed strings alone', function() {
     expect(camelCase('foo')).toBe('foo');
     expect(camelCase('')).toBe('');
     expect(camelCase('fooBar')).toBe('fooBar');
   });
   it('should covert dash-separated strings to camelCase', function() {
     expect(camelCase('foo-bar')).toBe('fooBar');
     expect(camelCase('foo-bar-baz')).toBe('fooBarBaz');
     expect(camelCase('foo:bar_baz')).toBe('fooBarBaz');
   });
   it('should covert browser specific css properties', function() {
     expect(camelCase('-moz-foo-bar')).toBe('MozFooBar');
     expect(camelCase('-webkit-foo-bar')).toBe('webkitFooBar');
     expect(camelCase('-webkit-foo-bar')).toBe('webkitFooBar');
   })
  });
});