       expect($li_first.text()).toEqual('one')
 
   describe 'html()', ->
+    it 'should return undefined for a non existing element', ->
+      expect($('#noexists').html()).toEqual(undefined)
+
+    it 'should not fail when called on an empty set', ->
+      expect(-> $('#noexists').html()).not.toThrow()
+
     it 'should return the innerHTML of an element', ->
       html = document.getElementById('second').innerHTML
       expect($li_second.html()).toEqual(html)

      expect($li_second.html()).toEqual(content)

  describe 'val()', ->
    it 'should return the value of an element', ->
      value = document.getElementById('name').value
      expect($input.val()).toEqual(value)

    it 'should set the value of an element', ->
      content = 'changed'
      document.getElementById('name').value = content
      expect($input.val()).toEqual(content)

  describe 'addClass()', ->
    it 'should add a class to an element', ->
      $li_first.addClass('uno')
      expect(getClass($li_first)).toEqual(['first', 'active', 'uno'])

    $input = $('#name')

  describe 'text()', ->
    it 'should return undefined for a non existing element', ->
      expect($('#noexists').text()).toEqual(undefined)

    it 'should not fail when called on an empty set', ->
      expect(-> $('#noexists').text()).not.toThrow()

    it 'should return the textContent of an element', ->
      expect($li_first.text()).toEqual('uno')

