diff --git a/test/.eslintrc.json b/test/.eslintrc.json index 4705d0c..09620cb 100644 --- a/test/.eslintrc.json +++ b/test/.eslintrc.json @@ -5,10 +5,11 @@ "node": true }, "parserOptions": { - "ecmaVersion": 5, + "ecmaVersion": 6, "sourceType": "script" }, "globals": { + "sinon": false, "expect": false, "PIXI": false }, diff --git a/test/.eslintrc.json b/test/.eslintrc.json index 4705d0c..09620cb 100644 --- a/test/.eslintrc.json +++ b/test/.eslintrc.json @@ -5,10 +5,11 @@ "node": true }, "parserOptions": { - "ecmaVersion": 5, + "ecmaVersion": 6, "sourceType": "script" }, "globals": { + "sinon": false, "expect": false, "PIXI": false }, diff --git a/test/core/Matrix.js b/test/core/Matrix.js index 7ee653c..eb22493 100644 --- a/test/core/Matrix.js +++ b/test/core/Matrix.js @@ -4,7 +4,7 @@ { it('should create a new matrix', function () { - var matrix = new PIXI.Matrix(); + const matrix = new PIXI.Matrix(); expect(matrix.a).to.equal(1); expect(matrix.b).to.equal(0); @@ -13,7 +13,8 @@ expect(matrix.tx).to.equal(0); expect(matrix.ty).to.equal(0); - var input = [0, 1, 2, 3, 4, 5]; + const input = [0, 1, 2, 3, 4, 5]; + matrix.fromArray(input); expect(matrix.a).to.equal(0); @@ -23,7 +24,7 @@ expect(matrix.tx).to.equal(2); expect(matrix.ty).to.equal(5); - var output = matrix.toArray(true); + let output = matrix.toArray(true); expect(output.length).to.equal(9); expect(output[0]).to.equal(0); @@ -33,7 +34,7 @@ expect(output[6]).to.equal(2); expect(output[7]).to.equal(5); - var output = matrix.toArray(false); + output = matrix.toArray(false); expect(output.length).to.equal(9); expect(output[0]).to.equal(0); @@ -46,7 +47,7 @@ it('should apply different transforms', function () { - var matrix = new PIXI.Matrix(); + const matrix = new PIXI.Matrix(); matrix.translate(10, 20); matrix.translate(1, 2); @@ -61,7 +62,8 @@ expect(matrix.tx).to.equal(22); expect(matrix.ty).to.equal(88); - var m2 = matrix.clone(); + const m2 = matrix.clone(); + expect(m2).to.not.equal(matrix); expect(m2.a).to.equal(2); expect(m2.b).to.equal(0); @@ -79,7 +81,7 @@ expect(matrix.ty).to.equal(15); }); - it('should get IDENTITY and TEMP_MATRIX', function() + it('should get IDENTITY and TEMP_MATRIX', function () { expect(PIXI.Matrix.IDENTITY instanceof PIXI.Matrix).to.be.true; expect(PIXI.Matrix.TEMP_MATRIX instanceof PIXI.Matrix).to.be.true; diff --git a/test/.eslintrc.json b/test/.eslintrc.json index 4705d0c..09620cb 100644 --- a/test/.eslintrc.json +++ b/test/.eslintrc.json @@ -5,10 +5,11 @@ "node": true }, "parserOptions": { - "ecmaVersion": 5, + "ecmaVersion": 6, "sourceType": "script" }, "globals": { + "sinon": false, "expect": false, "PIXI": false }, diff --git a/test/core/Matrix.js b/test/core/Matrix.js index 7ee653c..eb22493 100644 --- a/test/core/Matrix.js +++ b/test/core/Matrix.js @@ -4,7 +4,7 @@ { it('should create a new matrix', function () { - var matrix = new PIXI.Matrix(); + const matrix = new PIXI.Matrix(); expect(matrix.a).to.equal(1); expect(matrix.b).to.equal(0); @@ -13,7 +13,8 @@ expect(matrix.tx).to.equal(0); expect(matrix.ty).to.equal(0); - var input = [0, 1, 2, 3, 4, 5]; + const input = [0, 1, 2, 3, 4, 5]; + matrix.fromArray(input); expect(matrix.a).to.equal(0); @@ -23,7 +24,7 @@ expect(matrix.tx).to.equal(2); expect(matrix.ty).to.equal(5); - var output = matrix.toArray(true); + let output = matrix.toArray(true); expect(output.length).to.equal(9); expect(output[0]).to.equal(0); @@ -33,7 +34,7 @@ expect(output[6]).to.equal(2); expect(output[7]).to.equal(5); - var output = matrix.toArray(false); + output = matrix.toArray(false); expect(output.length).to.equal(9); expect(output[0]).to.equal(0); @@ -46,7 +47,7 @@ it('should apply different transforms', function () { - var matrix = new PIXI.Matrix(); + const matrix = new PIXI.Matrix(); matrix.translate(10, 20); matrix.translate(1, 2); @@ -61,7 +62,8 @@ expect(matrix.tx).to.equal(22); expect(matrix.ty).to.equal(88); - var m2 = matrix.clone(); + const m2 = matrix.clone(); + expect(m2).to.not.equal(matrix); expect(m2.a).to.equal(2); expect(m2.b).to.equal(0); @@ -79,7 +81,7 @@ expect(matrix.ty).to.equal(15); }); - it('should get IDENTITY and TEMP_MATRIX', function() + it('should get IDENTITY and TEMP_MATRIX', function () { expect(PIXI.Matrix.IDENTITY instanceof PIXI.Matrix).to.be.true; expect(PIXI.Matrix.TEMP_MATRIX instanceof PIXI.Matrix).to.be.true; diff --git a/test/core/ObservablePoint.js b/test/core/ObservablePoint.js index 7cf0e3e..54818a1 100644 --- a/test/core/ObservablePoint.js +++ b/test/core/ObservablePoint.js @@ -4,8 +4,8 @@ { it('should create a new observable point', function () { - var cb = sinon.spy(); - var pt = new PIXI.ObservablePoint(cb, pt); + const cb = sinon.spy(); + const pt = new PIXI.ObservablePoint(cb, this); expect(pt.x).to.equal(0); expect(pt.y).to.equal(0); @@ -33,10 +33,14 @@ it('should copy a new observable point', function () { - var cb = function () {}; - var p1 = new PIXI.ObservablePoint(cb, p1, 10, 20); - var p2 = new PIXI.ObservablePoint(cb, p2, 5, 2); - var p3 = new PIXI.ObservablePoint(cb, p2, 5, 6); + function cb() + { + // do nothing + } + + const p1 = new PIXI.ObservablePoint(cb, this, 10, 20); + const p2 = new PIXI.ObservablePoint(cb, this, 5, 2); + const p3 = new PIXI.ObservablePoint(cb, this, 5, 6); p1.copy(p2); expect(p1.x).to.equal(p2.x); diff --git a/test/.eslintrc.json b/test/.eslintrc.json index 4705d0c..09620cb 100644 --- a/test/.eslintrc.json +++ b/test/.eslintrc.json @@ -5,10 +5,11 @@ "node": true }, "parserOptions": { - "ecmaVersion": 5, + "ecmaVersion": 6, "sourceType": "script" }, "globals": { + "sinon": false, "expect": false, "PIXI": false }, diff --git a/test/core/Matrix.js b/test/core/Matrix.js index 7ee653c..eb22493 100644 --- a/test/core/Matrix.js +++ b/test/core/Matrix.js @@ -4,7 +4,7 @@ { it('should create a new matrix', function () { - var matrix = new PIXI.Matrix(); + const matrix = new PIXI.Matrix(); expect(matrix.a).to.equal(1); expect(matrix.b).to.equal(0); @@ -13,7 +13,8 @@ expect(matrix.tx).to.equal(0); expect(matrix.ty).to.equal(0); - var input = [0, 1, 2, 3, 4, 5]; + const input = [0, 1, 2, 3, 4, 5]; + matrix.fromArray(input); expect(matrix.a).to.equal(0); @@ -23,7 +24,7 @@ expect(matrix.tx).to.equal(2); expect(matrix.ty).to.equal(5); - var output = matrix.toArray(true); + let output = matrix.toArray(true); expect(output.length).to.equal(9); expect(output[0]).to.equal(0); @@ -33,7 +34,7 @@ expect(output[6]).to.equal(2); expect(output[7]).to.equal(5); - var output = matrix.toArray(false); + output = matrix.toArray(false); expect(output.length).to.equal(9); expect(output[0]).to.equal(0); @@ -46,7 +47,7 @@ it('should apply different transforms', function () { - var matrix = new PIXI.Matrix(); + const matrix = new PIXI.Matrix(); matrix.translate(10, 20); matrix.translate(1, 2); @@ -61,7 +62,8 @@ expect(matrix.tx).to.equal(22); expect(matrix.ty).to.equal(88); - var m2 = matrix.clone(); + const m2 = matrix.clone(); + expect(m2).to.not.equal(matrix); expect(m2.a).to.equal(2); expect(m2.b).to.equal(0); @@ -79,7 +81,7 @@ expect(matrix.ty).to.equal(15); }); - it('should get IDENTITY and TEMP_MATRIX', function() + it('should get IDENTITY and TEMP_MATRIX', function () { expect(PIXI.Matrix.IDENTITY instanceof PIXI.Matrix).to.be.true; expect(PIXI.Matrix.TEMP_MATRIX instanceof PIXI.Matrix).to.be.true; diff --git a/test/core/ObservablePoint.js b/test/core/ObservablePoint.js index 7cf0e3e..54818a1 100644 --- a/test/core/ObservablePoint.js +++ b/test/core/ObservablePoint.js @@ -4,8 +4,8 @@ { it('should create a new observable point', function () { - var cb = sinon.spy(); - var pt = new PIXI.ObservablePoint(cb, pt); + const cb = sinon.spy(); + const pt = new PIXI.ObservablePoint(cb, this); expect(pt.x).to.equal(0); expect(pt.y).to.equal(0); @@ -33,10 +33,14 @@ it('should copy a new observable point', function () { - var cb = function () {}; - var p1 = new PIXI.ObservablePoint(cb, p1, 10, 20); - var p2 = new PIXI.ObservablePoint(cb, p2, 5, 2); - var p3 = new PIXI.ObservablePoint(cb, p2, 5, 6); + function cb() + { + // do nothing + } + + const p1 = new PIXI.ObservablePoint(cb, this, 10, 20); + const p2 = new PIXI.ObservablePoint(cb, this, 5, 2); + const p3 = new PIXI.ObservablePoint(cb, this, 5, 6); p1.copy(p2); expect(p1.x).to.equal(p2.x); diff --git a/test/core/Point.js b/test/core/Point.js index aee95aa..0251918 100644 --- a/test/core/Point.js +++ b/test/core/Point.js @@ -4,7 +4,7 @@ { it('should create a new point', function () { - var pt = new PIXI.Point(); + const pt = new PIXI.Point(); expect(pt.x).to.equal(0); expect(pt.y).to.equal(0); @@ -12,12 +12,12 @@ it('should clone a new point', function () { - var p1 = new PIXI.Point(10, 20); + const p1 = new PIXI.Point(10, 20); expect(p1.x).to.equal(10); expect(p1.y).to.equal(20); - var p2 = p1.clone(); + const p2 = p1.clone(); expect(p2.x).to.equal(10); expect(p2.y).to.equal(20); @@ -27,8 +27,8 @@ it('should copy from one point to another', function () { - var p1 = new PIXI.Point(10, 20); - var p2 = new PIXI.Point(2, 5); + const p1 = new PIXI.Point(10, 20); + const p2 = new PIXI.Point(2, 5); p1.copy(p2); @@ -38,7 +38,7 @@ it('should set a new value', function () { - var p1 = new PIXI.Point(10, 20); + const p1 = new PIXI.Point(10, 20); p1.set(); expect(p1.x).to.equal(0);