Comparing version
0.3.1 / 2011-07-19 | ||
================== | ||
* Fixed body on non-2xx response. Closes #56 | ||
* Update jQuery to 1.6.2. Closes #43 | ||
0.3.0 / 2011-07-01 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -1,2 +0,1 @@ | ||
/*! | ||
@@ -95,2 +94,3 @@ * Tobi - Browser | ||
this.window = jsdom.jsdom(wrap(html), null, options).createWindow(); | ||
this.window.navigator = { userAgent: 'node' }; | ||
this.jQuery = jQuery.create(this.window); | ||
@@ -234,4 +234,21 @@ this.jQuery.browser = this.jQuery.fn.browser = this; | ||
// Success | ||
if (status >= 200 && status < 300) { | ||
// Redirect | ||
if (status >= 300 && status < 400) { | ||
var location = res.headers.location | ||
, uri = url.parse(location) | ||
, path = uri.pathname + (uri.search || ''); | ||
otherHostname = uri.hostname; | ||
if (otherHostname && | ||
(otherHostname !== 'undefined') && | ||
(otherHostname !== self.host)) { | ||
self = self.hostBrowser(uri); | ||
} | ||
self.emit('redirect', location); | ||
if (self.followRedirects) { | ||
self.request('GET', path, {}, fn); | ||
} else { | ||
return fn(res); | ||
} | ||
// Other | ||
} else { | ||
var contentType = res.headers['content-type']; | ||
@@ -270,23 +287,2 @@ | ||
}); | ||
// Redirect | ||
} else if (status >= 300 && status < 400) { | ||
var location = res.headers.location | ||
, uri = url.parse(location) | ||
, path = uri.pathname + (uri.search || ''); | ||
otherHostname = uri.hostname; | ||
if (otherHostname && | ||
(otherHostname !== 'undefined') && | ||
(otherHostname !== self.host)) { | ||
self = self.hostBrowser(uri); | ||
} | ||
self.emit('redirect', location); | ||
if (self.followRedirects) { | ||
self.request('GET', path, {}, fn); | ||
} else { | ||
return fn(res); | ||
} | ||
// Error | ||
} else { | ||
fn(res); | ||
} | ||
@@ -293,0 +289,0 @@ }); |
@@ -12,3 +12,3 @@ | ||
exports.version = '0.3.0'; | ||
exports.version = '0.3.1'; | ||
@@ -15,0 +15,0 @@ /** |
{ "name": "tobi" | ||
, "description": "expressive server-side functional testing with jQuery and jsdom" | ||
, "version": "0.3.0" | ||
, "version": "0.3.1" | ||
, "author": "TJ Holowaychuk <tj@vision-media.ca>" | ||
@@ -5,0 +5,0 @@ , "keywords": ["test", "testing", "browser", "jquery", "css"] |
@@ -37,3 +37,3 @@ /** | ||
app.get('/500', function(req, res){ | ||
res.send(500); | ||
res.send('<p>OH NO!</p>', 500); | ||
}); | ||
@@ -201,4 +201,5 @@ | ||
var browser = tobi.createBrowser(app); | ||
browser.request('GET', '/500', {}, function(res){ | ||
browser.request('GET', '/500', {}, function(res, $){ | ||
res.should.have.status(500); | ||
$('p').text().should.equal('OH NO!'); | ||
done(); | ||
@@ -516,9 +517,9 @@ }); | ||
res.should.have.status(200); | ||
$('[name=user[subscribe]]').should.be.checked; | ||
$('[name="user[subscribe]"]').should.be.checked; | ||
browser.uncheck('user[subscribe]'); | ||
$('[name=user[subscribe]]').should.not.be.checked; | ||
$('[name="user[subscribe]"]').should.not.be.checked; | ||
done(); | ||
}); | ||
}, | ||
'test .check(name)': function(done){ | ||
@@ -528,9 +529,9 @@ var browser = tobi.createBrowser(app); | ||
res.should.have.status(200); | ||
$('[name=user[agreement]]').should.not.be.checked; | ||
$('[name="user[agreement]"]').should.not.be.checked; | ||
browser.check('user[agreement]'); | ||
$('[name=user[agreement]]').should.be.checked; | ||
$('[name="user[agreement]"]').should.be.checked; | ||
done(); | ||
}); | ||
}, | ||
'test .check(css)': function(done){ | ||
@@ -540,5 +541,5 @@ var browser = tobi.createBrowser(app); | ||
res.should.have.status(200); | ||
$('[name=user[agreement]]').should.not.be.checked; | ||
browser.check('[name=user[agreement]]'); | ||
$('[name=user[agreement]]').should.be.checked; | ||
$('[name="user[agreement]"]').should.not.be.checked; | ||
browser.check('[name="user[agreement]"]'); | ||
$('[name="user[agreement]"]').should.be.checked; | ||
done(); | ||
@@ -552,5 +553,5 @@ }); | ||
res.should.have.status(200); | ||
$('[name=user[agreement]]').should.not.be.checked; | ||
$('[name="user[agreement]"]').should.not.be.checked; | ||
browser.check('user-agreement'); | ||
$('[name=user[agreement]]').should.be.checked; | ||
$('[name="user[agreement]"]').should.be.checked; | ||
done(); | ||
@@ -580,4 +581,4 @@ }); | ||
res.should.have.status(200); | ||
$('[name=user[name]]').val('tjholowaychuk'); | ||
$('[name=user[email]]').val('tj@vision-media.ca'); | ||
$('[name="user[name]"]').val('tjholowaychuk'); | ||
$('[name="user[email]"]').val('tj@vision-media.ca'); | ||
$('[type=submit]').click(function(res){ | ||
@@ -685,3 +686,3 @@ res.body.headers.should.have.property('content-type', 'application/x-www-form-urlencoded'); | ||
, 'user[display_signature]': 'No' | ||
, '[name=user[forum_digest]]': 'daily' | ||
, '[name="user[forum_digest]"]': 'daily' | ||
, '#signature': 'TJ Holowaychuk' | ||
@@ -711,3 +712,3 @@ }) | ||
res.should.have.status(200); | ||
$('[name=user[name]]').val('tjholowaychuk'); | ||
$('[name="user[name]"]').val('tjholowaychuk'); | ||
$('#signature').val('Wahoo'); | ||
@@ -735,3 +736,3 @@ $('form').submit(function(res){ | ||
res.should.have.status(200); | ||
$('[name=user[name]]').val('tjholowaychuk'); | ||
$('[name="user[name]"]').val('tjholowaychuk'); | ||
$('#signature').val('Wahoo'); | ||
@@ -758,3 +759,3 @@ $('form').submit(function(res){ | ||
res.should.have.status(200); | ||
$('[name=user[name]]').val('tjholowaychuk'); | ||
$('[name="user[name]"]').val('tjholowaychuk'); | ||
$('#signature').val('Wahoo'); | ||
@@ -761,0 +762,0 @@ browser.submit('user', function(res){ |
Sorry, the diff of this file is too big to display
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
426196
20.47%10172
28.09%