1 | ;
|
2 |
|
3 | var test = require('tape');
|
4 |
|
5 | var _require = require('./instance'),
|
6 | bind = _require.bind;
|
7 |
|
8 | test('bind()', function (assert) {
|
9 | var foo = {
|
10 | bar: function bar() {
|
11 | return this.quux;
|
12 | },
|
13 | quux: 42
|
14 | };
|
15 | bind(foo, 'bar'); // deconstruct the method to call it as a function
|
16 |
|
17 | var bar = foo.bar;
|
18 | var actual = bar();
|
19 | var expected = 42;
|
20 | var message = 'binds an object property to the object';
|
21 | assert.equal(actual, expected, message);
|
22 | assert.end();
|
23 | }); |
\ | No newline at end of file |