Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions lib/assertions/should.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 7 additions & 9 deletions lib/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
11 changes: 1 addition & 10 deletions test/assertions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -276,4 +267,4 @@ exports['test .header()'] = function(done){

exports.after = function(){
app.close();
};
};
4 changes: 2 additions & 2 deletions test/jquery.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = {
+ '<input type="radio" name="signature" value="hide" />'
+ '<input type="checkbox" name="agreement" value="ageed" />'
+ '<input type="checkbox" name="email" value="yes" checked="checked" />'
+ '<select name="province">'
+ '<select multiple=true name="province">'
+ ' <option value="bc">British Columbia</option>'
+ ' <option value="ab">Alberta</option>'
+ '</select>'
Expand Down Expand Up @@ -50,4 +50,4 @@ module.exports = {
$('select > option[value=bc]').should.not.be.selected;
$('select > option[value=ab]').should.be.selected;
}
};
};