mirror of
https://github.com/chaijs/chai
synced 2024-11-15 08:17:14 +00:00
Update the compiled version.
This commit is contained in:
parent
670f128970
commit
15f67bad72
1 changed files with 8 additions and 2 deletions
10
chai.js
10
chai.js
|
@ -433,10 +433,16 @@ Object.defineProperty(Assertion.prototype, 'exist',
|
|||
|
||||
Object.defineProperty(Assertion.prototype, 'empty',
|
||||
{ get: function () {
|
||||
new Assertion(this.obj).to.have.property('length');
|
||||
var expected = this.obj;
|
||||
|
||||
if (Array.isArray(this.obj)) {
|
||||
expected = this.obj.length;
|
||||
} else if (typeof this.obj === 'object') {
|
||||
expected = Object.keys(this.obj).length;
|
||||
}
|
||||
|
||||
this.assert(
|
||||
0 === this.obj.length
|
||||
!expected
|
||||
, 'expected ' + this.inspect + ' to be empty'
|
||||
, 'expected ' + this.inspect + ' not to be empty');
|
||||
|
||||
|
|
Loading…
Reference in a new issue