Permalink
Browse files

Remove unused variables from unit tests

  • Loading branch information...
1 parent 1d89eda commit 874e1b7e1511812ae8a433fbb0984054775e12f6 @jugglinmike jugglinmike committed Jun 30, 2014
Showing with 14 additions and 15 deletions.
  1. +4 −4 test/api.attributes.js
  2. +4 −4 test/api.manipulation.js
  3. +5 −5 test/api.traversing.js
  4. +1 −1 test/cheerio.js
  5. +0 −1 test/xml.js
View
@@ -419,7 +419,7 @@ describe('$(...)', function() {
var thisVals = [];
var toAdd = ['apple red', '', undefined];
- $fruits.addClass(function(idx, currentClass) {
+ $fruits.addClass(function(idx) {
args.push(toArray(arguments));
thisVals.push(this);
return toAdd[idx];
@@ -464,7 +464,7 @@ describe('$(...)', function() {
it('(no class attribute) : should not throw an exception', function() {
var $vegetables = cheerio(vegetables);
- var thrown = null;
+
expect(function() {
$('li', $vegetables).removeClass('vegetable');
})
@@ -516,7 +516,7 @@ describe('$(...)', function() {
var thisVals = [];
var toAdd = ['apple red', '', undefined];
- $fruits.removeClass(function(idx, currentClass) {
+ $fruits.removeClass(function(idx) {
args.push(toArray(arguments));
thisVals.push(this);
return toAdd[idx];
@@ -598,7 +598,7 @@ describe('$(...)', function() {
expect($('.sweetcorn').hasClass('fruit')).to.not.be.ok();
expect($('.sweetcorn').hasClass('vegetable')).to.not.be.ok();
- $('li').toggleClass(function(index, className, switchVal) {
+ $('li').toggleClass(function() {
return $(this).parent().is('#fruits') ? 'fruit' : 'vegetable';
});
expect($('.apple').hasClass('fruit')).to.not.be.ok();
View
@@ -772,8 +772,8 @@ describe('$(...)', function() {
expect($children).to.have.length(3);
$fruits.append($('<div></div><div></div>'));
- var $remove = $fruits.children().eq(0),
- $keep = $fruits.children().eq(1);
+ var $remove = $fruits.children().eq(0);
+
$remove.replaceWith($children);
expect($fruits.children()).to.have.length(4);
});
@@ -845,8 +845,8 @@ describe('$(...)', function() {
$fruits.html('<div></div><div></div>');
expect($fruits.children()).to.have.length(2);
- var $remove = $fruits.children().eq(0),
- $keep = $fruits.children().eq(1);
+ var $remove = $fruits.children().eq(0);
+
$remove.replaceWith($children);
expect($fruits.children()).to.have.length(4);
});
View
@@ -608,7 +608,7 @@ describe('$(...)', function() {
it('( (i, elem) -> ) : should break iteration when the iterator function returns false', function() {
var iterationCount = 0;
- $('li').each(function(idx, elem) {
+ $('li').each(function(idx) {
iterationCount++;
return idx < 1;
});
@@ -643,7 +643,7 @@ describe('$(...)', function() {
it('(fn) : should return an Cheerio object wrapping the returned items', function() {
var $fruits = $('li');
- var $mapped = $fruits.map(function(i, el) {
+ var $mapped = $fruits.map(function(i) {
return $fruits[2 - i];
});
@@ -657,7 +657,7 @@ describe('$(...)', function() {
var $fruits = $('li');
var retVals = [null, undefined, $fruits[1]];
- var $mapped = $fruits.map(function(i, el) {
+ var $mapped = $fruits.map(function(i) {
return retVals[i];
});
@@ -668,7 +668,7 @@ describe('$(...)', function() {
it('(fn) : should preform a shallow merge on arrays returned by iterator', function() {
var $fruits = $('li');
- var $mapped = $fruits.map(function(i, el) {
+ var $mapped = $fruits.map(function() {
return [1, [3, 4]];
});
@@ -682,7 +682,7 @@ describe('$(...)', function() {
it('(fn) : should tolerate `null` and `undefined` when flattening arrays returned by iterator', function() {
var $fruits = $('li');
- var $mapped = $fruits.map(function(i, el) {
+ var $mapped = $fruits.map(function() {
return [null, undefined];
});
View
@@ -235,7 +235,7 @@ describe('cheerio', function() {
it('(extended Array) should not interfere with prototype methods (issue #119)', function() {
var extended = [];
- var custom = extended.find = extended.children = extended.each = function() {};
+ extended.find = extended.children = extended.each = function() {};
var $empty = $(extended);
expect($empty.find).to.be($.prototype.find);
View
@@ -44,7 +44,6 @@ describe('render', function() {
it('should maintain the parsing options of distinct contexts independently', function() {
var str = '<g><someElem someAttribute="something">hello</someElem></g>';
var $x = cheerio.load('', { xmlMode: false });
- var $h = cheerio.load('', { xmlMode: true });
expect($x(str).html()).to.equal('<someelem someattribute="something">hello</someelem>');
});

0 comments on commit 874e1b7

Please sign in to comment.