diff --git a/package.json b/package.json index 8d356a5..13569bd 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "url": "git+https://github.com/FE-star/exercise4.git" }, "keywords": [ - "tet" + "test" ], "author": "Daniel Yang", "license": "MIT", diff --git a/test/mocha.opts b/test/mocha.opts index 0c57d9b..e69de29 100644 --- a/test/mocha.opts +++ b/test/mocha.opts @@ -1 +0,0 @@ ---require should \ No newline at end of file diff --git a/test/test.js b/test/test.js index 63a72e4..614f1d5 100644 --- a/test/test.js +++ b/test/test.js @@ -1,10 +1,12 @@ +require('should'); + describe('this', function () { it('setTimeout', function (done) { var obj = { say: function () { setTimeout(() => { // this 是什么?想想为什么? - this.should.equal(null) + this.should.equal(obj) done() }, 0) } @@ -15,7 +17,7 @@ describe('this', function () { it('global', function () { function test() { // this 是什么?想想为什么? - this.should.equal(null) + this.should.equal(global) } test() }) @@ -26,7 +28,7 @@ describe('this', function () { say: function () { function _say() { // this 是什么?想想为什么? - this.should.equal(null) + this.should.equal(global) } return _say.bind(obj) }() @@ -39,7 +41,7 @@ describe('this', function () { obj.say = function () { function _say() { // this 是什么?想想为什么? - this.should.equal(null) + this.should.equal(obj) } return _say.bind(obj) }()