Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add the which chain method as per issue #347 #349

Merged
merged 1 commit into from
Jan 22, 2015
Merged
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
3 changes: 2 additions & 1 deletion lib/chai/core/assertions.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module.exports = function (chai, _) {
* - been
* - is
* - that
* - which
* - and
* - has
* - have
Expand All @@ -39,7 +40,7 @@ module.exports = function (chai, _) {

[ 'to', 'be', 'been'
, 'is', 'and', 'has', 'have'
, 'with', 'that', 'at'
, 'with', 'that', 'which', 'at'
, 'of', 'same' ].forEach(function (chain) {
Assertion.addProperty(chain, function () {
return this;
Expand Down
2 changes: 2 additions & 0 deletions test/expect.js
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,8 @@ describe('expect', function () {
var tea = { name: 'chai', extras: ['milk', 'sugar', 'smile'] };
expect(tea).to.have.property('extras').with.lengthOf(3);

expect(tea).to.have.property('extras').which.contains('smile');

err(function(){
expect(tea).to.have.property('extras').with.lengthOf(4);
}, "expected [ 'milk', 'sugar', 'smile' ] to have a length of 4 but got 3");
Expand Down