Skip to content

Commit

Permalink
bugfix: removeAttr didn't return cheerio object
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewmueller committed Feb 5, 2012
1 parent 5e51852 commit 9872126
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/api/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ var removeAttr = exports.removeAttr = function(name) {
this.each(function() {
$.removeAttr(this, name);
});

return this;
};

var hasClass = exports.hasClass = function(selector) {
Expand Down
7 changes: 5 additions & 2 deletions test/api.attributes.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ describe '$(...)', ->

$pear = $('.pear', $fruits).attr('id', 'pear')
$('#pear', $fruits).should.have.length 1
should.exist $pear.cheerio

it '(map) : object map should set multiple attributes', ->
$fruits = $(fruits)
Expand All @@ -47,7 +48,7 @@ describe '$(...)', ->
attrs.id.should.equal 'apple'
attrs.style.should.equal 'color:red;'
attrs['data-url'].should.equal 'http://apple.com'

describe '.removeAttr', ->

it '(key) : should remove a single attr', ->
Expand All @@ -57,7 +58,9 @@ describe '$(...)', ->
$('ul', $fruits).removeAttr('id')
should.not.exist $('ul', $fruits).attr('id')


it 'should return cheerio object', ->
should.exist $('ul', fruits).removeAttr('id').cheerio

describe '.hasClass', ->

it '(valid class) : should return true', ->
Expand Down

0 comments on commit 9872126

Please sign in to comment.