Adding upstream version 1.2.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
eac40c2ddc
commit
e864a6175d
14 changed files with 584 additions and 0 deletions
37
tests/bind.js
Normal file
37
tests/bind.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
import { bind } from '..';
|
||||
import { expect } from 'chai';
|
||||
|
||||
/*global describe,it*/
|
||||
|
||||
describe('bind()', () => {
|
||||
it('should bind when used as a simple decorator', next => {
|
||||
let c = {
|
||||
@bind
|
||||
foo() {
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
expect(c.foo()).to.equal(c);
|
||||
|
||||
let p = c.foo;
|
||||
expect(p()).to.equal(c);
|
||||
|
||||
let a = {};
|
||||
expect(c.foo.call(a)).to.equal(c);
|
||||
|
||||
next();
|
||||
});
|
||||
|
||||
it('should bind when used as a function', next => {
|
||||
let ctx = {},
|
||||
c = bind(function(){ return this; }, ctx);
|
||||
|
||||
expect(c()).to.equal(ctx);
|
||||
|
||||
let a = {};
|
||||
expect(c.call(a)).to.equal(ctx);
|
||||
|
||||
next();
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue