diff --git a/lib/assertions/should.js b/lib/assertions/should.js index 64b36a8..9b919b0 100644 --- a/lib/assertions/should.js +++ b/lib/assertions/should.js @@ -47,19 +47,13 @@ function n(n) { return nums[n] || n; } Assertion.prototype.text = function(str){ var elem = this.obj - , text = elem.text() - , include = this.includes; + , text = elem.text(); if (str instanceof RegExp) { this.assert( str.test(text) , 'expected ' + j(elem)+ ' to have text matching ' + i(str) , 'expected ' + j(elem) + ' text ' + i(text) + ' to not match ' + i(str)); - } else if (include) { - this.assert( - ~text.indexOf(str) - , 'expected ' + j(elem) + ' to include text ' + i(str) + ' within ' + i(text) - , 'expected ' + j(elem) + ' to not include text ' + i(str) + ' within ' + i(text)); } else { this.assert( str == text diff --git a/lib/browser.js b/lib/browser.js index 0e39fb5..94cf665 100644 --- a/lib/browser.js +++ b/lib/browser.js @@ -164,19 +164,17 @@ Browser.prototype.request = function(method, path, options, fn, saveHistory){ , headers = options.headers || {}; // Ensure that server is ready to take connections - if (server && !server.fd){ + if (server && !server.__started){ (server.__deferred = server.__deferred || []) .push(arguments); - if (!server.__started) { - server.listen(server.__port = ++startingPort, host, function(){ - process.nextTick(function(){ - server.__deferred.forEach(function(args){ - self.request.apply(self, args); - }); + server.listen(server.__port = ++startingPort, host, function(){ + process.nextTick(function(){ + server.__deferred.forEach(function(args){ + self.request.apply(self, args); }); }); - server.__started = true; - } + }); + server.__started = true; return; } diff --git a/package.json b/package.json index b541c91..c3fc76b 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ , "qs": ">= 0.1.0" } , "devDependencies": { - "express": "2.3.x" + "express": "~2.5" , "mocha": "*" , "htmlparser": ">= 0.0.1" , "jsdom": ">= 0.0.1" diff --git a/test/assertions.test.js b/test/assertions.test.js index 3be02ec..b5c7b1d 100644 --- a/test/assertions.test.js +++ b/test/assertions.test.js @@ -64,15 +64,6 @@ exports['test .text()'] = function(done){ $('p').prev().should.have.text(/^To/); $('*').should.not.have.text('Tobi'); - $('*').should.include.text('Tobi'); - - err(function(){ - $('*').should.not.include.text('Tobi'); - }, "expected [jQuery '*'] to not include text 'Tobi' within 'Tobithe ferretTobithe ferret'"); - - err(function(){ - $('*').should.include.text('Shuppa'); - }, "expected [jQuery '*'] to include text 'Shuppa' within 'Tobithe ferretTobithe ferret'"); err(function(){ $('h1').should.not.have.text('Tobi'); @@ -276,4 +267,4 @@ exports['test .header()'] = function(done){ exports.after = function(){ app.close(); -}; \ No newline at end of file +}; diff --git a/test/jquery.test.js b/test/jquery.test.js index a9eacf3..4129be6 100644 --- a/test/jquery.test.js +++ b/test/jquery.test.js @@ -19,7 +19,7 @@ module.exports = { + '' + '' + '' - + '' + ' ' + ' ' + '' @@ -50,4 +50,4 @@ module.exports = { $('select > option[value=bc]').should.not.be.selected; $('select > option[value=ab]').should.be.selected; } -}; \ No newline at end of file +};