diff --git a/test/core/Bounds.js b/test/core/Bounds.js
index a4a3351..d2893a6 100644
--- a/test/core/Bounds.js
+++ b/test/core/Bounds.js
@@ -4,16 +4,14 @@
{
it('should register correct width/height with a LOADED Sprite', function ()
{
- var parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const parent = new PIXI.Container();
+ const texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const sprite = new PIXI.Sprite(texture);
parent.addChild(sprite);
- var bounds;
-
- bounds = sprite.getBounds();
+ let bounds = sprite.getBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -43,20 +41,17 @@
it('should register correct width/height with Graphics', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
+ const graphics = new PIXI.Graphics();
- var graphics = new PIXI.Graphics();
-
- var bounds;
-
- bounds = graphics.getBounds();
+ let bounds = graphics.getBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
expect(bounds.width).to.equal(0);
expect(bounds.height).to.equal(0);
- graphics.beginFill(0xFF0000).drawCircle(0, 0, 10, 10);// texture);
+ graphics.beginFill(0xFF0000).drawCircle(0, 0, 10, 10);
parent.addChild(graphics);
@@ -90,15 +85,13 @@
it('should register correct width/height with an empty Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
parent.addChild(container);
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -121,14 +114,14 @@
it('should register correct width/height with a Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container(); // Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10); // texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
container.addChild(graphics);
@@ -140,9 +133,7 @@
graphics.position.x = 100;
graphics.position.y = 100;
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(30);
expect(bounds.y).to.equal(20);
@@ -168,11 +159,11 @@
it('should register correct width/height with an item that has already had its parent Container transformed', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);
parent.addChild(container);
container.addChild(graphics);
@@ -180,9 +171,7 @@
container.position.x = 100;
container.position.y = 100;
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(100);
expect(bounds.y).to.equal(100);
@@ -199,20 +188,18 @@
it('should register correct width/height with a Mesh', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const texture = PIXI.RenderTexture.create(10, 10);
- var plane = new PIXI.mesh.Plane(texture);
+ const plane = new PIXI.mesh.Plane(texture);
parent.addChild(plane);
plane.position.x = 20;
plane.position.y = 20;
- var bounds;
-
- bounds = plane.getBounds();
+ let bounds = plane.getBounds();
expect(bounds.x).to.equal(20);
expect(bounds.y).to.equal(20);
@@ -232,14 +219,14 @@
it('should register correct width/height with an a DisplayObject is visible false', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
container.addChild(graphics);
@@ -253,9 +240,7 @@
graphics.visible = false;
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(30);
expect(bounds.y).to.equal(20);
@@ -281,12 +266,12 @@
it('should register correct bounds of invisible Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container(); // Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
parent.addChild(container);
@@ -295,9 +280,7 @@
container.visible = false;
container.position.set(100, 100);
- var bounds;
-
- bounds = container.getBounds();
+ const bounds = container.getBounds();
expect(bounds.x).to.equal(130);
expect(bounds.y).to.equal(120);
@@ -307,14 +290,14 @@
it('should register correct width/height with Container masked child', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
container.addChild(graphics);
@@ -327,9 +310,7 @@
graphics.position.x = 32;
graphics.position.y = 23;
- var bounds;
-
- bounds = graphics.getBounds();
+ let bounds = graphics.getBounds();
expect(bounds.x).to.equal(32);
expect(bounds.y).to.equal(23);
@@ -346,11 +327,11 @@
it('should register correct width/height with an a DisplayObject parent has moved', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10);
container.addChild(graphics);
@@ -361,7 +342,7 @@
container.position.x -= 100;
container.position.y -= 100;
- var bounds = graphics.getBounds();
+ const bounds = graphics.getBounds();
expect(bounds.x).to.equal(-110);
expect(bounds.y).to.equal(-110);
@@ -371,20 +352,18 @@
it('should register correct width/height with an a Text Object', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var text = new PIXI.Text('i am some text');
+ const text = new PIXI.Text('i am some text');
container.addChild(text);
parent.addChild(container);
- var bounds;
-
- bounds = text.getBounds();
- var bx = bounds.width;
+ let bounds = text.getBounds();
+ const bx = bounds.width;
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -401,9 +380,9 @@
it('should return a different rectangle if getting local bounds after global bounds ', function ()
{
- var parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const parent = new PIXI.Container();
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
sprite.position.x = 20;
sprite.position.y = 20;
@@ -413,14 +392,14 @@
parent.addChild(sprite);
- var bounds = sprite.getBounds();
+ const bounds = sprite.getBounds();
expect(bounds.x).to.equal(20);
expect(bounds.y).to.equal(20);
expect(bounds.width).to.equal(20);
expect(bounds.height).to.equal(20);
- var localBounds = sprite.getLocalBounds();
+ const localBounds = sprite.getLocalBounds();
expect(localBounds.x).to.equal(0);
expect(localBounds.y).to.equal(0);
@@ -430,23 +409,23 @@
it('should ensure bounds respect the trim of a texture ', function ()
{
- var parent = new PIXI.Container();
- var baseTexture = new PIXI.BaseRenderTexture(100, 100);
+ const parent = new PIXI.Container();
+ const baseTexture = new PIXI.BaseRenderTexture(100, 100);
- var orig = new PIXI.Rectangle(0, 0, 100, 50);
- var frame = new PIXI.Rectangle(2, 2, 50, 50);
- var trim = new PIXI.Rectangle(25, 0, 50, 50);
+ const orig = new PIXI.Rectangle(0, 0, 100, 50);
+ const frame = new PIXI.Rectangle(2, 2, 50, 50);
+ const trim = new PIXI.Rectangle(25, 0, 50, 50);
- var trimmedTexture = new PIXI.Texture(baseTexture, frame, orig, trim);
+ const trimmedTexture = new PIXI.Texture(baseTexture, frame, orig, trim);
- var sprite = new PIXI.Sprite(trimmedTexture);
+ const sprite = new PIXI.Sprite(trimmedTexture);
sprite.position.x = 20;
sprite.position.y = 20;
parent.addChild(sprite);
- var bounds = sprite.getBounds();
+ const bounds = sprite.getBounds();
expect(bounds.x).to.equal(20);
expect(bounds.y).to.equal(20);
diff --git a/test/core/Bounds.js b/test/core/Bounds.js
index a4a3351..d2893a6 100644
--- a/test/core/Bounds.js
+++ b/test/core/Bounds.js
@@ -4,16 +4,14 @@
{
it('should register correct width/height with a LOADED Sprite', function ()
{
- var parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const parent = new PIXI.Container();
+ const texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const sprite = new PIXI.Sprite(texture);
parent.addChild(sprite);
- var bounds;
-
- bounds = sprite.getBounds();
+ let bounds = sprite.getBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -43,20 +41,17 @@
it('should register correct width/height with Graphics', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
+ const graphics = new PIXI.Graphics();
- var graphics = new PIXI.Graphics();
-
- var bounds;
-
- bounds = graphics.getBounds();
+ let bounds = graphics.getBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
expect(bounds.width).to.equal(0);
expect(bounds.height).to.equal(0);
- graphics.beginFill(0xFF0000).drawCircle(0, 0, 10, 10);// texture);
+ graphics.beginFill(0xFF0000).drawCircle(0, 0, 10, 10);
parent.addChild(graphics);
@@ -90,15 +85,13 @@
it('should register correct width/height with an empty Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
parent.addChild(container);
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -121,14 +114,14 @@
it('should register correct width/height with a Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container(); // Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10); // texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
container.addChild(graphics);
@@ -140,9 +133,7 @@
graphics.position.x = 100;
graphics.position.y = 100;
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(30);
expect(bounds.y).to.equal(20);
@@ -168,11 +159,11 @@
it('should register correct width/height with an item that has already had its parent Container transformed', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);
parent.addChild(container);
container.addChild(graphics);
@@ -180,9 +171,7 @@
container.position.x = 100;
container.position.y = 100;
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(100);
expect(bounds.y).to.equal(100);
@@ -199,20 +188,18 @@
it('should register correct width/height with a Mesh', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const texture = PIXI.RenderTexture.create(10, 10);
- var plane = new PIXI.mesh.Plane(texture);
+ const plane = new PIXI.mesh.Plane(texture);
parent.addChild(plane);
plane.position.x = 20;
plane.position.y = 20;
- var bounds;
-
- bounds = plane.getBounds();
+ let bounds = plane.getBounds();
expect(bounds.x).to.equal(20);
expect(bounds.y).to.equal(20);
@@ -232,14 +219,14 @@
it('should register correct width/height with an a DisplayObject is visible false', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
container.addChild(graphics);
@@ -253,9 +240,7 @@
graphics.visible = false;
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(30);
expect(bounds.y).to.equal(20);
@@ -281,12 +266,12 @@
it('should register correct bounds of invisible Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container(); // Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
parent.addChild(container);
@@ -295,9 +280,7 @@
container.visible = false;
container.position.set(100, 100);
- var bounds;
-
- bounds = container.getBounds();
+ const bounds = container.getBounds();
expect(bounds.x).to.equal(130);
expect(bounds.y).to.equal(120);
@@ -307,14 +290,14 @@
it('should register correct width/height with Container masked child', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
container.addChild(graphics);
@@ -327,9 +310,7 @@
graphics.position.x = 32;
graphics.position.y = 23;
- var bounds;
-
- bounds = graphics.getBounds();
+ let bounds = graphics.getBounds();
expect(bounds.x).to.equal(32);
expect(bounds.y).to.equal(23);
@@ -346,11 +327,11 @@
it('should register correct width/height with an a DisplayObject parent has moved', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10);
container.addChild(graphics);
@@ -361,7 +342,7 @@
container.position.x -= 100;
container.position.y -= 100;
- var bounds = graphics.getBounds();
+ const bounds = graphics.getBounds();
expect(bounds.x).to.equal(-110);
expect(bounds.y).to.equal(-110);
@@ -371,20 +352,18 @@
it('should register correct width/height with an a Text Object', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var text = new PIXI.Text('i am some text');
+ const text = new PIXI.Text('i am some text');
container.addChild(text);
parent.addChild(container);
- var bounds;
-
- bounds = text.getBounds();
- var bx = bounds.width;
+ let bounds = text.getBounds();
+ const bx = bounds.width;
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -401,9 +380,9 @@
it('should return a different rectangle if getting local bounds after global bounds ', function ()
{
- var parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const parent = new PIXI.Container();
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
sprite.position.x = 20;
sprite.position.y = 20;
@@ -413,14 +392,14 @@
parent.addChild(sprite);
- var bounds = sprite.getBounds();
+ const bounds = sprite.getBounds();
expect(bounds.x).to.equal(20);
expect(bounds.y).to.equal(20);
expect(bounds.width).to.equal(20);
expect(bounds.height).to.equal(20);
- var localBounds = sprite.getLocalBounds();
+ const localBounds = sprite.getLocalBounds();
expect(localBounds.x).to.equal(0);
expect(localBounds.y).to.equal(0);
@@ -430,23 +409,23 @@
it('should ensure bounds respect the trim of a texture ', function ()
{
- var parent = new PIXI.Container();
- var baseTexture = new PIXI.BaseRenderTexture(100, 100);
+ const parent = new PIXI.Container();
+ const baseTexture = new PIXI.BaseRenderTexture(100, 100);
- var orig = new PIXI.Rectangle(0, 0, 100, 50);
- var frame = new PIXI.Rectangle(2, 2, 50, 50);
- var trim = new PIXI.Rectangle(25, 0, 50, 50);
+ const orig = new PIXI.Rectangle(0, 0, 100, 50);
+ const frame = new PIXI.Rectangle(2, 2, 50, 50);
+ const trim = new PIXI.Rectangle(25, 0, 50, 50);
- var trimmedTexture = new PIXI.Texture(baseTexture, frame, orig, trim);
+ const trimmedTexture = new PIXI.Texture(baseTexture, frame, orig, trim);
- var sprite = new PIXI.Sprite(trimmedTexture);
+ const sprite = new PIXI.Sprite(trimmedTexture);
sprite.position.x = 20;
sprite.position.y = 20;
parent.addChild(sprite);
- var bounds = sprite.getBounds();
+ const bounds = sprite.getBounds();
expect(bounds.x).to.equal(20);
expect(bounds.y).to.equal(20);
diff --git a/test/core/Sprite.js b/test/core/Sprite.js
index f176e3c..2a3d301 100755
--- a/test/core/Sprite.js
+++ b/test/core/Sprite.js
@@ -6,7 +6,7 @@
{
it('should not be negative for negative scale.x', function ()
{
- var sprite = new PIXI.Sprite();
+ const sprite = new PIXI.Sprite();
sprite.width = 100;
expect(sprite.width).to.be.at.least(0);
@@ -16,8 +16,8 @@
it('should not change sign of scale.x', function ()
{
- var texture = new PIXI.Texture(new PIXI.BaseTexture());
- var sprite = new PIXI.Sprite();
+ const texture = new PIXI.Texture(new PIXI.BaseTexture());
+ const sprite = new PIXI.Sprite();
texture.orig.width = 100;
sprite.scale.x = 1;
@@ -36,7 +36,7 @@
{
it('should not be negative for negative scale.y', function ()
{
- var sprite = new PIXI.Sprite();
+ const sprite = new PIXI.Sprite();
sprite.height = 100;
expect(sprite.height).to.be.at.least(0);
@@ -46,8 +46,8 @@
it('should not change sign of scale.y', function ()
{
- var texture = new PIXI.Texture(new PIXI.BaseTexture());
- var sprite = new PIXI.Sprite();
+ const texture = new PIXI.Texture(new PIXI.BaseTexture());
+ const sprite = new PIXI.Sprite();
texture.orig.height = 100;
sprite.scale.y = 1;
diff --git a/test/core/Bounds.js b/test/core/Bounds.js
index a4a3351..d2893a6 100644
--- a/test/core/Bounds.js
+++ b/test/core/Bounds.js
@@ -4,16 +4,14 @@
{
it('should register correct width/height with a LOADED Sprite', function ()
{
- var parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const parent = new PIXI.Container();
+ const texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const sprite = new PIXI.Sprite(texture);
parent.addChild(sprite);
- var bounds;
-
- bounds = sprite.getBounds();
+ let bounds = sprite.getBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -43,20 +41,17 @@
it('should register correct width/height with Graphics', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
+ const graphics = new PIXI.Graphics();
- var graphics = new PIXI.Graphics();
-
- var bounds;
-
- bounds = graphics.getBounds();
+ let bounds = graphics.getBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
expect(bounds.width).to.equal(0);
expect(bounds.height).to.equal(0);
- graphics.beginFill(0xFF0000).drawCircle(0, 0, 10, 10);// texture);
+ graphics.beginFill(0xFF0000).drawCircle(0, 0, 10, 10);
parent.addChild(graphics);
@@ -90,15 +85,13 @@
it('should register correct width/height with an empty Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
parent.addChild(container);
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -121,14 +114,14 @@
it('should register correct width/height with a Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container(); // Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10); // texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
container.addChild(graphics);
@@ -140,9 +133,7 @@
graphics.position.x = 100;
graphics.position.y = 100;
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(30);
expect(bounds.y).to.equal(20);
@@ -168,11 +159,11 @@
it('should register correct width/height with an item that has already had its parent Container transformed', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);
parent.addChild(container);
container.addChild(graphics);
@@ -180,9 +171,7 @@
container.position.x = 100;
container.position.y = 100;
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(100);
expect(bounds.y).to.equal(100);
@@ -199,20 +188,18 @@
it('should register correct width/height with a Mesh', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const texture = PIXI.RenderTexture.create(10, 10);
- var plane = new PIXI.mesh.Plane(texture);
+ const plane = new PIXI.mesh.Plane(texture);
parent.addChild(plane);
plane.position.x = 20;
plane.position.y = 20;
- var bounds;
-
- bounds = plane.getBounds();
+ let bounds = plane.getBounds();
expect(bounds.x).to.equal(20);
expect(bounds.y).to.equal(20);
@@ -232,14 +219,14 @@
it('should register correct width/height with an a DisplayObject is visible false', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
container.addChild(graphics);
@@ -253,9 +240,7 @@
graphics.visible = false;
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(30);
expect(bounds.y).to.equal(20);
@@ -281,12 +266,12 @@
it('should register correct bounds of invisible Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container(); // Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
parent.addChild(container);
@@ -295,9 +280,7 @@
container.visible = false;
container.position.set(100, 100);
- var bounds;
-
- bounds = container.getBounds();
+ const bounds = container.getBounds();
expect(bounds.x).to.equal(130);
expect(bounds.y).to.equal(120);
@@ -307,14 +290,14 @@
it('should register correct width/height with Container masked child', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
container.addChild(graphics);
@@ -327,9 +310,7 @@
graphics.position.x = 32;
graphics.position.y = 23;
- var bounds;
-
- bounds = graphics.getBounds();
+ let bounds = graphics.getBounds();
expect(bounds.x).to.equal(32);
expect(bounds.y).to.equal(23);
@@ -346,11 +327,11 @@
it('should register correct width/height with an a DisplayObject parent has moved', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10);
container.addChild(graphics);
@@ -361,7 +342,7 @@
container.position.x -= 100;
container.position.y -= 100;
- var bounds = graphics.getBounds();
+ const bounds = graphics.getBounds();
expect(bounds.x).to.equal(-110);
expect(bounds.y).to.equal(-110);
@@ -371,20 +352,18 @@
it('should register correct width/height with an a Text Object', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var text = new PIXI.Text('i am some text');
+ const text = new PIXI.Text('i am some text');
container.addChild(text);
parent.addChild(container);
- var bounds;
-
- bounds = text.getBounds();
- var bx = bounds.width;
+ let bounds = text.getBounds();
+ const bx = bounds.width;
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -401,9 +380,9 @@
it('should return a different rectangle if getting local bounds after global bounds ', function ()
{
- var parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const parent = new PIXI.Container();
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
sprite.position.x = 20;
sprite.position.y = 20;
@@ -413,14 +392,14 @@
parent.addChild(sprite);
- var bounds = sprite.getBounds();
+ const bounds = sprite.getBounds();
expect(bounds.x).to.equal(20);
expect(bounds.y).to.equal(20);
expect(bounds.width).to.equal(20);
expect(bounds.height).to.equal(20);
- var localBounds = sprite.getLocalBounds();
+ const localBounds = sprite.getLocalBounds();
expect(localBounds.x).to.equal(0);
expect(localBounds.y).to.equal(0);
@@ -430,23 +409,23 @@
it('should ensure bounds respect the trim of a texture ', function ()
{
- var parent = new PIXI.Container();
- var baseTexture = new PIXI.BaseRenderTexture(100, 100);
+ const parent = new PIXI.Container();
+ const baseTexture = new PIXI.BaseRenderTexture(100, 100);
- var orig = new PIXI.Rectangle(0, 0, 100, 50);
- var frame = new PIXI.Rectangle(2, 2, 50, 50);
- var trim = new PIXI.Rectangle(25, 0, 50, 50);
+ const orig = new PIXI.Rectangle(0, 0, 100, 50);
+ const frame = new PIXI.Rectangle(2, 2, 50, 50);
+ const trim = new PIXI.Rectangle(25, 0, 50, 50);
- var trimmedTexture = new PIXI.Texture(baseTexture, frame, orig, trim);
+ const trimmedTexture = new PIXI.Texture(baseTexture, frame, orig, trim);
- var sprite = new PIXI.Sprite(trimmedTexture);
+ const sprite = new PIXI.Sprite(trimmedTexture);
sprite.position.x = 20;
sprite.position.y = 20;
parent.addChild(sprite);
- var bounds = sprite.getBounds();
+ const bounds = sprite.getBounds();
expect(bounds.x).to.equal(20);
expect(bounds.y).to.equal(20);
diff --git a/test/core/Sprite.js b/test/core/Sprite.js
index f176e3c..2a3d301 100755
--- a/test/core/Sprite.js
+++ b/test/core/Sprite.js
@@ -6,7 +6,7 @@
{
it('should not be negative for negative scale.x', function ()
{
- var sprite = new PIXI.Sprite();
+ const sprite = new PIXI.Sprite();
sprite.width = 100;
expect(sprite.width).to.be.at.least(0);
@@ -16,8 +16,8 @@
it('should not change sign of scale.x', function ()
{
- var texture = new PIXI.Texture(new PIXI.BaseTexture());
- var sprite = new PIXI.Sprite();
+ const texture = new PIXI.Texture(new PIXI.BaseTexture());
+ const sprite = new PIXI.Sprite();
texture.orig.width = 100;
sprite.scale.x = 1;
@@ -36,7 +36,7 @@
{
it('should not be negative for negative scale.y', function ()
{
- var sprite = new PIXI.Sprite();
+ const sprite = new PIXI.Sprite();
sprite.height = 100;
expect(sprite.height).to.be.at.least(0);
@@ -46,8 +46,8 @@
it('should not change sign of scale.y', function ()
{
- var texture = new PIXI.Texture(new PIXI.BaseTexture());
- var sprite = new PIXI.Sprite();
+ const texture = new PIXI.Texture(new PIXI.BaseTexture());
+ const sprite = new PIXI.Sprite();
texture.orig.height = 100;
sprite.scale.y = 1;
diff --git a/test/core/Text.js b/test/core/Text.js
index d818099..4f67752 100644
--- a/test/core/Text.js
+++ b/test/core/Text.js
@@ -6,7 +6,7 @@
{
it('should call through to Sprite.destroy', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
expect(text.anchor).to.not.equal(null);
text.destroy();
@@ -15,7 +15,7 @@
it('should set context to null', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
expect(text.style).to.not.equal(null);
text.destroy();
@@ -24,8 +24,8 @@
it('should destroy children if children flag is set', function ()
{
- var text = new PIXI.Text('foo');
- var child = new PIXI.DisplayObject();
+ const text = new PIXI.Text('foo');
+ const child = new PIXI.DisplayObject();
text.addChild(child);
text.destroy({ children: true });
@@ -35,8 +35,8 @@
it('should accept options correctly', function ()
{
- var text = new PIXI.Text('foo');
- var child = new PIXI.DisplayObject();
+ const text = new PIXI.Text('foo');
+ const child = new PIXI.DisplayObject();
text.addChild(child);
text.destroy(true);
@@ -46,8 +46,8 @@
it('should pass opts on to children if children flag is set', function ()
{
- var text = new PIXI.Text('foo');
- var child = new PIXI.DisplayObject();
+ const text = new PIXI.Text('foo');
+ const child = new PIXI.DisplayObject();
var childDestroyOpts;
child.destroy = function (opts)
@@ -62,7 +62,7 @@
it('should modify the height of the object when setting height', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
text.height = 300;
@@ -71,7 +71,7 @@
it('should modify the width of the object when setting width', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
text.width = 300;
diff --git a/test/core/Bounds.js b/test/core/Bounds.js
index a4a3351..d2893a6 100644
--- a/test/core/Bounds.js
+++ b/test/core/Bounds.js
@@ -4,16 +4,14 @@
{
it('should register correct width/height with a LOADED Sprite', function ()
{
- var parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const parent = new PIXI.Container();
+ const texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const sprite = new PIXI.Sprite(texture);
parent.addChild(sprite);
- var bounds;
-
- bounds = sprite.getBounds();
+ let bounds = sprite.getBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -43,20 +41,17 @@
it('should register correct width/height with Graphics', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
+ const graphics = new PIXI.Graphics();
- var graphics = new PIXI.Graphics();
-
- var bounds;
-
- bounds = graphics.getBounds();
+ let bounds = graphics.getBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
expect(bounds.width).to.equal(0);
expect(bounds.height).to.equal(0);
- graphics.beginFill(0xFF0000).drawCircle(0, 0, 10, 10);// texture);
+ graphics.beginFill(0xFF0000).drawCircle(0, 0, 10, 10);
parent.addChild(graphics);
@@ -90,15 +85,13 @@
it('should register correct width/height with an empty Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
parent.addChild(container);
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -121,14 +114,14 @@
it('should register correct width/height with a Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container(); // Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10); // texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
container.addChild(graphics);
@@ -140,9 +133,7 @@
graphics.position.x = 100;
graphics.position.y = 100;
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(30);
expect(bounds.y).to.equal(20);
@@ -168,11 +159,11 @@
it('should register correct width/height with an item that has already had its parent Container transformed', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);
parent.addChild(container);
container.addChild(graphics);
@@ -180,9 +171,7 @@
container.position.x = 100;
container.position.y = 100;
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(100);
expect(bounds.y).to.equal(100);
@@ -199,20 +188,18 @@
it('should register correct width/height with a Mesh', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const texture = PIXI.RenderTexture.create(10, 10);
- var plane = new PIXI.mesh.Plane(texture);
+ const plane = new PIXI.mesh.Plane(texture);
parent.addChild(plane);
plane.position.x = 20;
plane.position.y = 20;
- var bounds;
-
- bounds = plane.getBounds();
+ let bounds = plane.getBounds();
expect(bounds.x).to.equal(20);
expect(bounds.y).to.equal(20);
@@ -232,14 +219,14 @@
it('should register correct width/height with an a DisplayObject is visible false', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
container.addChild(graphics);
@@ -253,9 +240,7 @@
graphics.visible = false;
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(30);
expect(bounds.y).to.equal(20);
@@ -281,12 +266,12 @@
it('should register correct bounds of invisible Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container(); // Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
parent.addChild(container);
@@ -295,9 +280,7 @@
container.visible = false;
container.position.set(100, 100);
- var bounds;
-
- bounds = container.getBounds();
+ const bounds = container.getBounds();
expect(bounds.x).to.equal(130);
expect(bounds.y).to.equal(120);
@@ -307,14 +290,14 @@
it('should register correct width/height with Container masked child', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
container.addChild(graphics);
@@ -327,9 +310,7 @@
graphics.position.x = 32;
graphics.position.y = 23;
- var bounds;
-
- bounds = graphics.getBounds();
+ let bounds = graphics.getBounds();
expect(bounds.x).to.equal(32);
expect(bounds.y).to.equal(23);
@@ -346,11 +327,11 @@
it('should register correct width/height with an a DisplayObject parent has moved', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10);
container.addChild(graphics);
@@ -361,7 +342,7 @@
container.position.x -= 100;
container.position.y -= 100;
- var bounds = graphics.getBounds();
+ const bounds = graphics.getBounds();
expect(bounds.x).to.equal(-110);
expect(bounds.y).to.equal(-110);
@@ -371,20 +352,18 @@
it('should register correct width/height with an a Text Object', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var text = new PIXI.Text('i am some text');
+ const text = new PIXI.Text('i am some text');
container.addChild(text);
parent.addChild(container);
- var bounds;
-
- bounds = text.getBounds();
- var bx = bounds.width;
+ let bounds = text.getBounds();
+ const bx = bounds.width;
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -401,9 +380,9 @@
it('should return a different rectangle if getting local bounds after global bounds ', function ()
{
- var parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const parent = new PIXI.Container();
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
sprite.position.x = 20;
sprite.position.y = 20;
@@ -413,14 +392,14 @@
parent.addChild(sprite);
- var bounds = sprite.getBounds();
+ const bounds = sprite.getBounds();
expect(bounds.x).to.equal(20);
expect(bounds.y).to.equal(20);
expect(bounds.width).to.equal(20);
expect(bounds.height).to.equal(20);
- var localBounds = sprite.getLocalBounds();
+ const localBounds = sprite.getLocalBounds();
expect(localBounds.x).to.equal(0);
expect(localBounds.y).to.equal(0);
@@ -430,23 +409,23 @@
it('should ensure bounds respect the trim of a texture ', function ()
{
- var parent = new PIXI.Container();
- var baseTexture = new PIXI.BaseRenderTexture(100, 100);
+ const parent = new PIXI.Container();
+ const baseTexture = new PIXI.BaseRenderTexture(100, 100);
- var orig = new PIXI.Rectangle(0, 0, 100, 50);
- var frame = new PIXI.Rectangle(2, 2, 50, 50);
- var trim = new PIXI.Rectangle(25, 0, 50, 50);
+ const orig = new PIXI.Rectangle(0, 0, 100, 50);
+ const frame = new PIXI.Rectangle(2, 2, 50, 50);
+ const trim = new PIXI.Rectangle(25, 0, 50, 50);
- var trimmedTexture = new PIXI.Texture(baseTexture, frame, orig, trim);
+ const trimmedTexture = new PIXI.Texture(baseTexture, frame, orig, trim);
- var sprite = new PIXI.Sprite(trimmedTexture);
+ const sprite = new PIXI.Sprite(trimmedTexture);
sprite.position.x = 20;
sprite.position.y = 20;
parent.addChild(sprite);
- var bounds = sprite.getBounds();
+ const bounds = sprite.getBounds();
expect(bounds.x).to.equal(20);
expect(bounds.y).to.equal(20);
diff --git a/test/core/Sprite.js b/test/core/Sprite.js
index f176e3c..2a3d301 100755
--- a/test/core/Sprite.js
+++ b/test/core/Sprite.js
@@ -6,7 +6,7 @@
{
it('should not be negative for negative scale.x', function ()
{
- var sprite = new PIXI.Sprite();
+ const sprite = new PIXI.Sprite();
sprite.width = 100;
expect(sprite.width).to.be.at.least(0);
@@ -16,8 +16,8 @@
it('should not change sign of scale.x', function ()
{
- var texture = new PIXI.Texture(new PIXI.BaseTexture());
- var sprite = new PIXI.Sprite();
+ const texture = new PIXI.Texture(new PIXI.BaseTexture());
+ const sprite = new PIXI.Sprite();
texture.orig.width = 100;
sprite.scale.x = 1;
@@ -36,7 +36,7 @@
{
it('should not be negative for negative scale.y', function ()
{
- var sprite = new PIXI.Sprite();
+ const sprite = new PIXI.Sprite();
sprite.height = 100;
expect(sprite.height).to.be.at.least(0);
@@ -46,8 +46,8 @@
it('should not change sign of scale.y', function ()
{
- var texture = new PIXI.Texture(new PIXI.BaseTexture());
- var sprite = new PIXI.Sprite();
+ const texture = new PIXI.Texture(new PIXI.BaseTexture());
+ const sprite = new PIXI.Sprite();
texture.orig.height = 100;
sprite.scale.y = 1;
diff --git a/test/core/Text.js b/test/core/Text.js
index d818099..4f67752 100644
--- a/test/core/Text.js
+++ b/test/core/Text.js
@@ -6,7 +6,7 @@
{
it('should call through to Sprite.destroy', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
expect(text.anchor).to.not.equal(null);
text.destroy();
@@ -15,7 +15,7 @@
it('should set context to null', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
expect(text.style).to.not.equal(null);
text.destroy();
@@ -24,8 +24,8 @@
it('should destroy children if children flag is set', function ()
{
- var text = new PIXI.Text('foo');
- var child = new PIXI.DisplayObject();
+ const text = new PIXI.Text('foo');
+ const child = new PIXI.DisplayObject();
text.addChild(child);
text.destroy({ children: true });
@@ -35,8 +35,8 @@
it('should accept options correctly', function ()
{
- var text = new PIXI.Text('foo');
- var child = new PIXI.DisplayObject();
+ const text = new PIXI.Text('foo');
+ const child = new PIXI.DisplayObject();
text.addChild(child);
text.destroy(true);
@@ -46,8 +46,8 @@
it('should pass opts on to children if children flag is set', function ()
{
- var text = new PIXI.Text('foo');
- var child = new PIXI.DisplayObject();
+ const text = new PIXI.Text('foo');
+ const child = new PIXI.DisplayObject();
var childDestroyOpts;
child.destroy = function (opts)
@@ -62,7 +62,7 @@
it('should modify the height of the object when setting height', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
text.height = 300;
@@ -71,7 +71,7 @@
it('should modify the width of the object when setting width', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
text.width = 300;
diff --git a/test/core/getGlobalPosition.js b/test/core/getGlobalPosition.js
index cb0cd29..c108d72 100644
--- a/test/core/getGlobalPosition.js
+++ b/test/core/getGlobalPosition.js
@@ -4,9 +4,9 @@
{
it('should return correct global coordinates of a displayObject, without depending on its pivot', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();
+ const container = new PIXI.Container();
parent.addChild(container);
@@ -16,9 +16,7 @@
container.position.set(10, -30);
container.pivot.set(1000, 1000);
- var globalPoint;
-
- globalPoint = container.getGlobalPosition(globalPoint, false);
+ let globalPoint = container.getGlobalPosition();
expect(globalPoint.x).to.equal(80);
expect(globalPoint.y).to.equal(160);
diff --git a/test/core/Bounds.js b/test/core/Bounds.js
index a4a3351..d2893a6 100644
--- a/test/core/Bounds.js
+++ b/test/core/Bounds.js
@@ -4,16 +4,14 @@
{
it('should register correct width/height with a LOADED Sprite', function ()
{
- var parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const parent = new PIXI.Container();
+ const texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const sprite = new PIXI.Sprite(texture);
parent.addChild(sprite);
- var bounds;
-
- bounds = sprite.getBounds();
+ let bounds = sprite.getBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -43,20 +41,17 @@
it('should register correct width/height with Graphics', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
+ const graphics = new PIXI.Graphics();
- var graphics = new PIXI.Graphics();
-
- var bounds;
-
- bounds = graphics.getBounds();
+ let bounds = graphics.getBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
expect(bounds.width).to.equal(0);
expect(bounds.height).to.equal(0);
- graphics.beginFill(0xFF0000).drawCircle(0, 0, 10, 10);// texture);
+ graphics.beginFill(0xFF0000).drawCircle(0, 0, 10, 10);
parent.addChild(graphics);
@@ -90,15 +85,13 @@
it('should register correct width/height with an empty Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
parent.addChild(container);
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -121,14 +114,14 @@
it('should register correct width/height with a Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container(); // Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10); // texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
container.addChild(graphics);
@@ -140,9 +133,7 @@
graphics.position.x = 100;
graphics.position.y = 100;
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(30);
expect(bounds.y).to.equal(20);
@@ -168,11 +159,11 @@
it('should register correct width/height with an item that has already had its parent Container transformed', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);
parent.addChild(container);
container.addChild(graphics);
@@ -180,9 +171,7 @@
container.position.x = 100;
container.position.y = 100;
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(100);
expect(bounds.y).to.equal(100);
@@ -199,20 +188,18 @@
it('should register correct width/height with a Mesh', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const texture = PIXI.RenderTexture.create(10, 10);
- var plane = new PIXI.mesh.Plane(texture);
+ const plane = new PIXI.mesh.Plane(texture);
parent.addChild(plane);
plane.position.x = 20;
plane.position.y = 20;
- var bounds;
-
- bounds = plane.getBounds();
+ let bounds = plane.getBounds();
expect(bounds.x).to.equal(20);
expect(bounds.y).to.equal(20);
@@ -232,14 +219,14 @@
it('should register correct width/height with an a DisplayObject is visible false', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
container.addChild(graphics);
@@ -253,9 +240,7 @@
graphics.visible = false;
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(30);
expect(bounds.y).to.equal(20);
@@ -281,12 +266,12 @@
it('should register correct bounds of invisible Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container(); // Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
parent.addChild(container);
@@ -295,9 +280,7 @@
container.visible = false;
container.position.set(100, 100);
- var bounds;
-
- bounds = container.getBounds();
+ const bounds = container.getBounds();
expect(bounds.x).to.equal(130);
expect(bounds.y).to.equal(120);
@@ -307,14 +290,14 @@
it('should register correct width/height with Container masked child', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
container.addChild(graphics);
@@ -327,9 +310,7 @@
graphics.position.x = 32;
graphics.position.y = 23;
- var bounds;
-
- bounds = graphics.getBounds();
+ let bounds = graphics.getBounds();
expect(bounds.x).to.equal(32);
expect(bounds.y).to.equal(23);
@@ -346,11 +327,11 @@
it('should register correct width/height with an a DisplayObject parent has moved', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10);
container.addChild(graphics);
@@ -361,7 +342,7 @@
container.position.x -= 100;
container.position.y -= 100;
- var bounds = graphics.getBounds();
+ const bounds = graphics.getBounds();
expect(bounds.x).to.equal(-110);
expect(bounds.y).to.equal(-110);
@@ -371,20 +352,18 @@
it('should register correct width/height with an a Text Object', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var text = new PIXI.Text('i am some text');
+ const text = new PIXI.Text('i am some text');
container.addChild(text);
parent.addChild(container);
- var bounds;
-
- bounds = text.getBounds();
- var bx = bounds.width;
+ let bounds = text.getBounds();
+ const bx = bounds.width;
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -401,9 +380,9 @@
it('should return a different rectangle if getting local bounds after global bounds ', function ()
{
- var parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const parent = new PIXI.Container();
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
sprite.position.x = 20;
sprite.position.y = 20;
@@ -413,14 +392,14 @@
parent.addChild(sprite);
- var bounds = sprite.getBounds();
+ const bounds = sprite.getBounds();
expect(bounds.x).to.equal(20);
expect(bounds.y).to.equal(20);
expect(bounds.width).to.equal(20);
expect(bounds.height).to.equal(20);
- var localBounds = sprite.getLocalBounds();
+ const localBounds = sprite.getLocalBounds();
expect(localBounds.x).to.equal(0);
expect(localBounds.y).to.equal(0);
@@ -430,23 +409,23 @@
it('should ensure bounds respect the trim of a texture ', function ()
{
- var parent = new PIXI.Container();
- var baseTexture = new PIXI.BaseRenderTexture(100, 100);
+ const parent = new PIXI.Container();
+ const baseTexture = new PIXI.BaseRenderTexture(100, 100);
- var orig = new PIXI.Rectangle(0, 0, 100, 50);
- var frame = new PIXI.Rectangle(2, 2, 50, 50);
- var trim = new PIXI.Rectangle(25, 0, 50, 50);
+ const orig = new PIXI.Rectangle(0, 0, 100, 50);
+ const frame = new PIXI.Rectangle(2, 2, 50, 50);
+ const trim = new PIXI.Rectangle(25, 0, 50, 50);
- var trimmedTexture = new PIXI.Texture(baseTexture, frame, orig, trim);
+ const trimmedTexture = new PIXI.Texture(baseTexture, frame, orig, trim);
- var sprite = new PIXI.Sprite(trimmedTexture);
+ const sprite = new PIXI.Sprite(trimmedTexture);
sprite.position.x = 20;
sprite.position.y = 20;
parent.addChild(sprite);
- var bounds = sprite.getBounds();
+ const bounds = sprite.getBounds();
expect(bounds.x).to.equal(20);
expect(bounds.y).to.equal(20);
diff --git a/test/core/Sprite.js b/test/core/Sprite.js
index f176e3c..2a3d301 100755
--- a/test/core/Sprite.js
+++ b/test/core/Sprite.js
@@ -6,7 +6,7 @@
{
it('should not be negative for negative scale.x', function ()
{
- var sprite = new PIXI.Sprite();
+ const sprite = new PIXI.Sprite();
sprite.width = 100;
expect(sprite.width).to.be.at.least(0);
@@ -16,8 +16,8 @@
it('should not change sign of scale.x', function ()
{
- var texture = new PIXI.Texture(new PIXI.BaseTexture());
- var sprite = new PIXI.Sprite();
+ const texture = new PIXI.Texture(new PIXI.BaseTexture());
+ const sprite = new PIXI.Sprite();
texture.orig.width = 100;
sprite.scale.x = 1;
@@ -36,7 +36,7 @@
{
it('should not be negative for negative scale.y', function ()
{
- var sprite = new PIXI.Sprite();
+ const sprite = new PIXI.Sprite();
sprite.height = 100;
expect(sprite.height).to.be.at.least(0);
@@ -46,8 +46,8 @@
it('should not change sign of scale.y', function ()
{
- var texture = new PIXI.Texture(new PIXI.BaseTexture());
- var sprite = new PIXI.Sprite();
+ const texture = new PIXI.Texture(new PIXI.BaseTexture());
+ const sprite = new PIXI.Sprite();
texture.orig.height = 100;
sprite.scale.y = 1;
diff --git a/test/core/Text.js b/test/core/Text.js
index d818099..4f67752 100644
--- a/test/core/Text.js
+++ b/test/core/Text.js
@@ -6,7 +6,7 @@
{
it('should call through to Sprite.destroy', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
expect(text.anchor).to.not.equal(null);
text.destroy();
@@ -15,7 +15,7 @@
it('should set context to null', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
expect(text.style).to.not.equal(null);
text.destroy();
@@ -24,8 +24,8 @@
it('should destroy children if children flag is set', function ()
{
- var text = new PIXI.Text('foo');
- var child = new PIXI.DisplayObject();
+ const text = new PIXI.Text('foo');
+ const child = new PIXI.DisplayObject();
text.addChild(child);
text.destroy({ children: true });
@@ -35,8 +35,8 @@
it('should accept options correctly', function ()
{
- var text = new PIXI.Text('foo');
- var child = new PIXI.DisplayObject();
+ const text = new PIXI.Text('foo');
+ const child = new PIXI.DisplayObject();
text.addChild(child);
text.destroy(true);
@@ -46,8 +46,8 @@
it('should pass opts on to children if children flag is set', function ()
{
- var text = new PIXI.Text('foo');
- var child = new PIXI.DisplayObject();
+ const text = new PIXI.Text('foo');
+ const child = new PIXI.DisplayObject();
var childDestroyOpts;
child.destroy = function (opts)
@@ -62,7 +62,7 @@
it('should modify the height of the object when setting height', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
text.height = 300;
@@ -71,7 +71,7 @@
it('should modify the width of the object when setting width', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
text.width = 300;
diff --git a/test/core/getGlobalPosition.js b/test/core/getGlobalPosition.js
index cb0cd29..c108d72 100644
--- a/test/core/getGlobalPosition.js
+++ b/test/core/getGlobalPosition.js
@@ -4,9 +4,9 @@
{
it('should return correct global coordinates of a displayObject, without depending on its pivot', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();
+ const container = new PIXI.Container();
parent.addChild(container);
@@ -16,9 +16,7 @@
container.position.set(10, -30);
container.pivot.set(1000, 1000);
- var globalPoint;
-
- globalPoint = container.getGlobalPosition(globalPoint, false);
+ let globalPoint = container.getGlobalPosition();
expect(globalPoint.x).to.equal(80);
expect(globalPoint.y).to.equal(160);
diff --git a/test/core/getLocalBounds.js b/test/core/getLocalBounds.js
index d1838db..5835b9f 100644
--- a/test/core/getLocalBounds.js
+++ b/test/core/getLocalBounds.js
@@ -4,16 +4,14 @@
{
it('should register correct local-bounds with a LOADED Sprite', function ()
{
- var parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const parent = new PIXI.Container();
+ const texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const sprite = new PIXI.Sprite(texture);
parent.addChild(sprite);
- var bounds;
-
- bounds = sprite.getLocalBounds();
+ let bounds = sprite.getLocalBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -36,9 +34,9 @@
it('should register correct local-bounds with Graphics', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var graphics = new PIXI.Graphics();
+ const graphics = new PIXI.Graphics();
graphics.beginFill(0xFF0000).drawCircle(0, 0, 10);// texture);
@@ -46,7 +44,7 @@
parent.addChild(graphics);
- var bounds = graphics.getLocalBounds();
+ const bounds = graphics.getLocalBounds();
expect(bounds.x).to.equal(-10);
expect(bounds.y).to.equal(-10);
@@ -56,13 +54,13 @@
it('should register correct local-bounds with an empty Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
parent.addChild(container);
- var bounds = container.getLocalBounds();
+ const bounds = container.getLocalBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -72,11 +70,11 @@
it('should register correct local-bounds with an item that has already had its parent Container transformed', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
parent.addChild(container);
container.addChild(graphics);
@@ -84,7 +82,7 @@
container.position.x = 100;
container.position.y = 100;
- var bounds = container.getLocalBounds();
+ const bounds = container.getLocalBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -94,18 +92,18 @@
it('should register correct local-bounds with a Mesh', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const texture = PIXI.RenderTexture.create(10, 10);
- var plane = new PIXI.mesh.Plane(texture);
+ const plane = new PIXI.mesh.Plane(texture);
parent.addChild(plane);
plane.position.x = 20;
plane.position.y = 20;
- var bounds = plane.getLocalBounds();
+ const bounds = plane.getLocalBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -115,9 +113,9 @@
it('should register correct local-bounds with a cachAsBitmap item inside after a render', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var graphic = new PIXI.Graphics();
+ const graphic = new PIXI.Graphics();
graphic.beginFill(0xffffff);
graphic.drawRect(0, 0, 100, 100);
@@ -126,12 +124,12 @@
parent.addChild(graphic);
- var renderer = new PIXI.CanvasRenderer(100, 100);
+ const renderer = new PIXI.CanvasRenderer(100, 100);
- renderer.sayHello = function () { /* empty */ };
+ renderer.sayHello = () => { /* empty */ };
renderer.render(parent);
- var bounds = parent.getLocalBounds();
+ const bounds = parent.getLocalBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
diff --git a/test/core/Bounds.js b/test/core/Bounds.js
index a4a3351..d2893a6 100644
--- a/test/core/Bounds.js
+++ b/test/core/Bounds.js
@@ -4,16 +4,14 @@
{
it('should register correct width/height with a LOADED Sprite', function ()
{
- var parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const parent = new PIXI.Container();
+ const texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const sprite = new PIXI.Sprite(texture);
parent.addChild(sprite);
- var bounds;
-
- bounds = sprite.getBounds();
+ let bounds = sprite.getBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -43,20 +41,17 @@
it('should register correct width/height with Graphics', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
+ const graphics = new PIXI.Graphics();
- var graphics = new PIXI.Graphics();
-
- var bounds;
-
- bounds = graphics.getBounds();
+ let bounds = graphics.getBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
expect(bounds.width).to.equal(0);
expect(bounds.height).to.equal(0);
- graphics.beginFill(0xFF0000).drawCircle(0, 0, 10, 10);// texture);
+ graphics.beginFill(0xFF0000).drawCircle(0, 0, 10, 10);
parent.addChild(graphics);
@@ -90,15 +85,13 @@
it('should register correct width/height with an empty Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
parent.addChild(container);
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -121,14 +114,14 @@
it('should register correct width/height with a Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container(); // Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10); // texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
container.addChild(graphics);
@@ -140,9 +133,7 @@
graphics.position.x = 100;
graphics.position.y = 100;
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(30);
expect(bounds.y).to.equal(20);
@@ -168,11 +159,11 @@
it('should register correct width/height with an item that has already had its parent Container transformed', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);
parent.addChild(container);
container.addChild(graphics);
@@ -180,9 +171,7 @@
container.position.x = 100;
container.position.y = 100;
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(100);
expect(bounds.y).to.equal(100);
@@ -199,20 +188,18 @@
it('should register correct width/height with a Mesh', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const texture = PIXI.RenderTexture.create(10, 10);
- var plane = new PIXI.mesh.Plane(texture);
+ const plane = new PIXI.mesh.Plane(texture);
parent.addChild(plane);
plane.position.x = 20;
plane.position.y = 20;
- var bounds;
-
- bounds = plane.getBounds();
+ let bounds = plane.getBounds();
expect(bounds.x).to.equal(20);
expect(bounds.y).to.equal(20);
@@ -232,14 +219,14 @@
it('should register correct width/height with an a DisplayObject is visible false', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
container.addChild(graphics);
@@ -253,9 +240,7 @@
graphics.visible = false;
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(30);
expect(bounds.y).to.equal(20);
@@ -281,12 +266,12 @@
it('should register correct bounds of invisible Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container(); // Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
parent.addChild(container);
@@ -295,9 +280,7 @@
container.visible = false;
container.position.set(100, 100);
- var bounds;
-
- bounds = container.getBounds();
+ const bounds = container.getBounds();
expect(bounds.x).to.equal(130);
expect(bounds.y).to.equal(120);
@@ -307,14 +290,14 @@
it('should register correct width/height with Container masked child', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
container.addChild(graphics);
@@ -327,9 +310,7 @@
graphics.position.x = 32;
graphics.position.y = 23;
- var bounds;
-
- bounds = graphics.getBounds();
+ let bounds = graphics.getBounds();
expect(bounds.x).to.equal(32);
expect(bounds.y).to.equal(23);
@@ -346,11 +327,11 @@
it('should register correct width/height with an a DisplayObject parent has moved', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10);
container.addChild(graphics);
@@ -361,7 +342,7 @@
container.position.x -= 100;
container.position.y -= 100;
- var bounds = graphics.getBounds();
+ const bounds = graphics.getBounds();
expect(bounds.x).to.equal(-110);
expect(bounds.y).to.equal(-110);
@@ -371,20 +352,18 @@
it('should register correct width/height with an a Text Object', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var text = new PIXI.Text('i am some text');
+ const text = new PIXI.Text('i am some text');
container.addChild(text);
parent.addChild(container);
- var bounds;
-
- bounds = text.getBounds();
- var bx = bounds.width;
+ let bounds = text.getBounds();
+ const bx = bounds.width;
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -401,9 +380,9 @@
it('should return a different rectangle if getting local bounds after global bounds ', function ()
{
- var parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const parent = new PIXI.Container();
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
sprite.position.x = 20;
sprite.position.y = 20;
@@ -413,14 +392,14 @@
parent.addChild(sprite);
- var bounds = sprite.getBounds();
+ const bounds = sprite.getBounds();
expect(bounds.x).to.equal(20);
expect(bounds.y).to.equal(20);
expect(bounds.width).to.equal(20);
expect(bounds.height).to.equal(20);
- var localBounds = sprite.getLocalBounds();
+ const localBounds = sprite.getLocalBounds();
expect(localBounds.x).to.equal(0);
expect(localBounds.y).to.equal(0);
@@ -430,23 +409,23 @@
it('should ensure bounds respect the trim of a texture ', function ()
{
- var parent = new PIXI.Container();
- var baseTexture = new PIXI.BaseRenderTexture(100, 100);
+ const parent = new PIXI.Container();
+ const baseTexture = new PIXI.BaseRenderTexture(100, 100);
- var orig = new PIXI.Rectangle(0, 0, 100, 50);
- var frame = new PIXI.Rectangle(2, 2, 50, 50);
- var trim = new PIXI.Rectangle(25, 0, 50, 50);
+ const orig = new PIXI.Rectangle(0, 0, 100, 50);
+ const frame = new PIXI.Rectangle(2, 2, 50, 50);
+ const trim = new PIXI.Rectangle(25, 0, 50, 50);
- var trimmedTexture = new PIXI.Texture(baseTexture, frame, orig, trim);
+ const trimmedTexture = new PIXI.Texture(baseTexture, frame, orig, trim);
- var sprite = new PIXI.Sprite(trimmedTexture);
+ const sprite = new PIXI.Sprite(trimmedTexture);
sprite.position.x = 20;
sprite.position.y = 20;
parent.addChild(sprite);
- var bounds = sprite.getBounds();
+ const bounds = sprite.getBounds();
expect(bounds.x).to.equal(20);
expect(bounds.y).to.equal(20);
diff --git a/test/core/Sprite.js b/test/core/Sprite.js
index f176e3c..2a3d301 100755
--- a/test/core/Sprite.js
+++ b/test/core/Sprite.js
@@ -6,7 +6,7 @@
{
it('should not be negative for negative scale.x', function ()
{
- var sprite = new PIXI.Sprite();
+ const sprite = new PIXI.Sprite();
sprite.width = 100;
expect(sprite.width).to.be.at.least(0);
@@ -16,8 +16,8 @@
it('should not change sign of scale.x', function ()
{
- var texture = new PIXI.Texture(new PIXI.BaseTexture());
- var sprite = new PIXI.Sprite();
+ const texture = new PIXI.Texture(new PIXI.BaseTexture());
+ const sprite = new PIXI.Sprite();
texture.orig.width = 100;
sprite.scale.x = 1;
@@ -36,7 +36,7 @@
{
it('should not be negative for negative scale.y', function ()
{
- var sprite = new PIXI.Sprite();
+ const sprite = new PIXI.Sprite();
sprite.height = 100;
expect(sprite.height).to.be.at.least(0);
@@ -46,8 +46,8 @@
it('should not change sign of scale.y', function ()
{
- var texture = new PIXI.Texture(new PIXI.BaseTexture());
- var sprite = new PIXI.Sprite();
+ const texture = new PIXI.Texture(new PIXI.BaseTexture());
+ const sprite = new PIXI.Sprite();
texture.orig.height = 100;
sprite.scale.y = 1;
diff --git a/test/core/Text.js b/test/core/Text.js
index d818099..4f67752 100644
--- a/test/core/Text.js
+++ b/test/core/Text.js
@@ -6,7 +6,7 @@
{
it('should call through to Sprite.destroy', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
expect(text.anchor).to.not.equal(null);
text.destroy();
@@ -15,7 +15,7 @@
it('should set context to null', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
expect(text.style).to.not.equal(null);
text.destroy();
@@ -24,8 +24,8 @@
it('should destroy children if children flag is set', function ()
{
- var text = new PIXI.Text('foo');
- var child = new PIXI.DisplayObject();
+ const text = new PIXI.Text('foo');
+ const child = new PIXI.DisplayObject();
text.addChild(child);
text.destroy({ children: true });
@@ -35,8 +35,8 @@
it('should accept options correctly', function ()
{
- var text = new PIXI.Text('foo');
- var child = new PIXI.DisplayObject();
+ const text = new PIXI.Text('foo');
+ const child = new PIXI.DisplayObject();
text.addChild(child);
text.destroy(true);
@@ -46,8 +46,8 @@
it('should pass opts on to children if children flag is set', function ()
{
- var text = new PIXI.Text('foo');
- var child = new PIXI.DisplayObject();
+ const text = new PIXI.Text('foo');
+ const child = new PIXI.DisplayObject();
var childDestroyOpts;
child.destroy = function (opts)
@@ -62,7 +62,7 @@
it('should modify the height of the object when setting height', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
text.height = 300;
@@ -71,7 +71,7 @@
it('should modify the width of the object when setting width', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
text.width = 300;
diff --git a/test/core/getGlobalPosition.js b/test/core/getGlobalPosition.js
index cb0cd29..c108d72 100644
--- a/test/core/getGlobalPosition.js
+++ b/test/core/getGlobalPosition.js
@@ -4,9 +4,9 @@
{
it('should return correct global coordinates of a displayObject, without depending on its pivot', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();
+ const container = new PIXI.Container();
parent.addChild(container);
@@ -16,9 +16,7 @@
container.position.set(10, -30);
container.pivot.set(1000, 1000);
- var globalPoint;
-
- globalPoint = container.getGlobalPosition(globalPoint, false);
+ let globalPoint = container.getGlobalPosition();
expect(globalPoint.x).to.equal(80);
expect(globalPoint.y).to.equal(160);
diff --git a/test/core/getLocalBounds.js b/test/core/getLocalBounds.js
index d1838db..5835b9f 100644
--- a/test/core/getLocalBounds.js
+++ b/test/core/getLocalBounds.js
@@ -4,16 +4,14 @@
{
it('should register correct local-bounds with a LOADED Sprite', function ()
{
- var parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const parent = new PIXI.Container();
+ const texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const sprite = new PIXI.Sprite(texture);
parent.addChild(sprite);
- var bounds;
-
- bounds = sprite.getLocalBounds();
+ let bounds = sprite.getLocalBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -36,9 +34,9 @@
it('should register correct local-bounds with Graphics', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var graphics = new PIXI.Graphics();
+ const graphics = new PIXI.Graphics();
graphics.beginFill(0xFF0000).drawCircle(0, 0, 10);// texture);
@@ -46,7 +44,7 @@
parent.addChild(graphics);
- var bounds = graphics.getLocalBounds();
+ const bounds = graphics.getLocalBounds();
expect(bounds.x).to.equal(-10);
expect(bounds.y).to.equal(-10);
@@ -56,13 +54,13 @@
it('should register correct local-bounds with an empty Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
parent.addChild(container);
- var bounds = container.getLocalBounds();
+ const bounds = container.getLocalBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -72,11 +70,11 @@
it('should register correct local-bounds with an item that has already had its parent Container transformed', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
parent.addChild(container);
container.addChild(graphics);
@@ -84,7 +82,7 @@
container.position.x = 100;
container.position.y = 100;
- var bounds = container.getLocalBounds();
+ const bounds = container.getLocalBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -94,18 +92,18 @@
it('should register correct local-bounds with a Mesh', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const texture = PIXI.RenderTexture.create(10, 10);
- var plane = new PIXI.mesh.Plane(texture);
+ const plane = new PIXI.mesh.Plane(texture);
parent.addChild(plane);
plane.position.x = 20;
plane.position.y = 20;
- var bounds = plane.getLocalBounds();
+ const bounds = plane.getLocalBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -115,9 +113,9 @@
it('should register correct local-bounds with a cachAsBitmap item inside after a render', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var graphic = new PIXI.Graphics();
+ const graphic = new PIXI.Graphics();
graphic.beginFill(0xffffff);
graphic.drawRect(0, 0, 100, 100);
@@ -126,12 +124,12 @@
parent.addChild(graphic);
- var renderer = new PIXI.CanvasRenderer(100, 100);
+ const renderer = new PIXI.CanvasRenderer(100, 100);
- renderer.sayHello = function () { /* empty */ };
+ renderer.sayHello = () => { /* empty */ };
renderer.render(parent);
- var bounds = parent.getLocalBounds();
+ const bounds = parent.getLocalBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
diff --git a/test/core/toGlobal.js b/test/core/toGlobal.js
index 24ba48a..ad36be8 100644
--- a/test/core/toGlobal.js
+++ b/test/core/toGlobal.js
@@ -4,17 +4,15 @@
{
it('should return correct global cordinates of a point from within a displayObject', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();
+ const container = new PIXI.Container();
parent.addChild(container);
- var point = new PIXI.Point(100, 100);
+ const point = new PIXI.Point(100, 100);
- var globalPoint;
-
- globalPoint = container.toGlobal(point);
+ let globalPoint = container.toGlobal(point);
expect(globalPoint.x).to.equal(100);
expect(globalPoint.y).to.equal(100);
diff --git a/test/core/Bounds.js b/test/core/Bounds.js
index a4a3351..d2893a6 100644
--- a/test/core/Bounds.js
+++ b/test/core/Bounds.js
@@ -4,16 +4,14 @@
{
it('should register correct width/height with a LOADED Sprite', function ()
{
- var parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const parent = new PIXI.Container();
+ const texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const sprite = new PIXI.Sprite(texture);
parent.addChild(sprite);
- var bounds;
-
- bounds = sprite.getBounds();
+ let bounds = sprite.getBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -43,20 +41,17 @@
it('should register correct width/height with Graphics', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
+ const graphics = new PIXI.Graphics();
- var graphics = new PIXI.Graphics();
-
- var bounds;
-
- bounds = graphics.getBounds();
+ let bounds = graphics.getBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
expect(bounds.width).to.equal(0);
expect(bounds.height).to.equal(0);
- graphics.beginFill(0xFF0000).drawCircle(0, 0, 10, 10);// texture);
+ graphics.beginFill(0xFF0000).drawCircle(0, 0, 10, 10);
parent.addChild(graphics);
@@ -90,15 +85,13 @@
it('should register correct width/height with an empty Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
parent.addChild(container);
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -121,14 +114,14 @@
it('should register correct width/height with a Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container(); // Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10); // texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
container.addChild(graphics);
@@ -140,9 +133,7 @@
graphics.position.x = 100;
graphics.position.y = 100;
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(30);
expect(bounds.y).to.equal(20);
@@ -168,11 +159,11 @@
it('should register correct width/height with an item that has already had its parent Container transformed', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);
parent.addChild(container);
container.addChild(graphics);
@@ -180,9 +171,7 @@
container.position.x = 100;
container.position.y = 100;
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(100);
expect(bounds.y).to.equal(100);
@@ -199,20 +188,18 @@
it('should register correct width/height with a Mesh', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const texture = PIXI.RenderTexture.create(10, 10);
- var plane = new PIXI.mesh.Plane(texture);
+ const plane = new PIXI.mesh.Plane(texture);
parent.addChild(plane);
plane.position.x = 20;
plane.position.y = 20;
- var bounds;
-
- bounds = plane.getBounds();
+ let bounds = plane.getBounds();
expect(bounds.x).to.equal(20);
expect(bounds.y).to.equal(20);
@@ -232,14 +219,14 @@
it('should register correct width/height with an a DisplayObject is visible false', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
container.addChild(graphics);
@@ -253,9 +240,7 @@
graphics.visible = false;
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(30);
expect(bounds.y).to.equal(20);
@@ -281,12 +266,12 @@
it('should register correct bounds of invisible Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container(); // Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
parent.addChild(container);
@@ -295,9 +280,7 @@
container.visible = false;
container.position.set(100, 100);
- var bounds;
-
- bounds = container.getBounds();
+ const bounds = container.getBounds();
expect(bounds.x).to.equal(130);
expect(bounds.y).to.equal(120);
@@ -307,14 +290,14 @@
it('should register correct width/height with Container masked child', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
container.addChild(graphics);
@@ -327,9 +310,7 @@
graphics.position.x = 32;
graphics.position.y = 23;
- var bounds;
-
- bounds = graphics.getBounds();
+ let bounds = graphics.getBounds();
expect(bounds.x).to.equal(32);
expect(bounds.y).to.equal(23);
@@ -346,11 +327,11 @@
it('should register correct width/height with an a DisplayObject parent has moved', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10);
container.addChild(graphics);
@@ -361,7 +342,7 @@
container.position.x -= 100;
container.position.y -= 100;
- var bounds = graphics.getBounds();
+ const bounds = graphics.getBounds();
expect(bounds.x).to.equal(-110);
expect(bounds.y).to.equal(-110);
@@ -371,20 +352,18 @@
it('should register correct width/height with an a Text Object', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var text = new PIXI.Text('i am some text');
+ const text = new PIXI.Text('i am some text');
container.addChild(text);
parent.addChild(container);
- var bounds;
-
- bounds = text.getBounds();
- var bx = bounds.width;
+ let bounds = text.getBounds();
+ const bx = bounds.width;
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -401,9 +380,9 @@
it('should return a different rectangle if getting local bounds after global bounds ', function ()
{
- var parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const parent = new PIXI.Container();
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
sprite.position.x = 20;
sprite.position.y = 20;
@@ -413,14 +392,14 @@
parent.addChild(sprite);
- var bounds = sprite.getBounds();
+ const bounds = sprite.getBounds();
expect(bounds.x).to.equal(20);
expect(bounds.y).to.equal(20);
expect(bounds.width).to.equal(20);
expect(bounds.height).to.equal(20);
- var localBounds = sprite.getLocalBounds();
+ const localBounds = sprite.getLocalBounds();
expect(localBounds.x).to.equal(0);
expect(localBounds.y).to.equal(0);
@@ -430,23 +409,23 @@
it('should ensure bounds respect the trim of a texture ', function ()
{
- var parent = new PIXI.Container();
- var baseTexture = new PIXI.BaseRenderTexture(100, 100);
+ const parent = new PIXI.Container();
+ const baseTexture = new PIXI.BaseRenderTexture(100, 100);
- var orig = new PIXI.Rectangle(0, 0, 100, 50);
- var frame = new PIXI.Rectangle(2, 2, 50, 50);
- var trim = new PIXI.Rectangle(25, 0, 50, 50);
+ const orig = new PIXI.Rectangle(0, 0, 100, 50);
+ const frame = new PIXI.Rectangle(2, 2, 50, 50);
+ const trim = new PIXI.Rectangle(25, 0, 50, 50);
- var trimmedTexture = new PIXI.Texture(baseTexture, frame, orig, trim);
+ const trimmedTexture = new PIXI.Texture(baseTexture, frame, orig, trim);
- var sprite = new PIXI.Sprite(trimmedTexture);
+ const sprite = new PIXI.Sprite(trimmedTexture);
sprite.position.x = 20;
sprite.position.y = 20;
parent.addChild(sprite);
- var bounds = sprite.getBounds();
+ const bounds = sprite.getBounds();
expect(bounds.x).to.equal(20);
expect(bounds.y).to.equal(20);
diff --git a/test/core/Sprite.js b/test/core/Sprite.js
index f176e3c..2a3d301 100755
--- a/test/core/Sprite.js
+++ b/test/core/Sprite.js
@@ -6,7 +6,7 @@
{
it('should not be negative for negative scale.x', function ()
{
- var sprite = new PIXI.Sprite();
+ const sprite = new PIXI.Sprite();
sprite.width = 100;
expect(sprite.width).to.be.at.least(0);
@@ -16,8 +16,8 @@
it('should not change sign of scale.x', function ()
{
- var texture = new PIXI.Texture(new PIXI.BaseTexture());
- var sprite = new PIXI.Sprite();
+ const texture = new PIXI.Texture(new PIXI.BaseTexture());
+ const sprite = new PIXI.Sprite();
texture.orig.width = 100;
sprite.scale.x = 1;
@@ -36,7 +36,7 @@
{
it('should not be negative for negative scale.y', function ()
{
- var sprite = new PIXI.Sprite();
+ const sprite = new PIXI.Sprite();
sprite.height = 100;
expect(sprite.height).to.be.at.least(0);
@@ -46,8 +46,8 @@
it('should not change sign of scale.y', function ()
{
- var texture = new PIXI.Texture(new PIXI.BaseTexture());
- var sprite = new PIXI.Sprite();
+ const texture = new PIXI.Texture(new PIXI.BaseTexture());
+ const sprite = new PIXI.Sprite();
texture.orig.height = 100;
sprite.scale.y = 1;
diff --git a/test/core/Text.js b/test/core/Text.js
index d818099..4f67752 100644
--- a/test/core/Text.js
+++ b/test/core/Text.js
@@ -6,7 +6,7 @@
{
it('should call through to Sprite.destroy', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
expect(text.anchor).to.not.equal(null);
text.destroy();
@@ -15,7 +15,7 @@
it('should set context to null', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
expect(text.style).to.not.equal(null);
text.destroy();
@@ -24,8 +24,8 @@
it('should destroy children if children flag is set', function ()
{
- var text = new PIXI.Text('foo');
- var child = new PIXI.DisplayObject();
+ const text = new PIXI.Text('foo');
+ const child = new PIXI.DisplayObject();
text.addChild(child);
text.destroy({ children: true });
@@ -35,8 +35,8 @@
it('should accept options correctly', function ()
{
- var text = new PIXI.Text('foo');
- var child = new PIXI.DisplayObject();
+ const text = new PIXI.Text('foo');
+ const child = new PIXI.DisplayObject();
text.addChild(child);
text.destroy(true);
@@ -46,8 +46,8 @@
it('should pass opts on to children if children flag is set', function ()
{
- var text = new PIXI.Text('foo');
- var child = new PIXI.DisplayObject();
+ const text = new PIXI.Text('foo');
+ const child = new PIXI.DisplayObject();
var childDestroyOpts;
child.destroy = function (opts)
@@ -62,7 +62,7 @@
it('should modify the height of the object when setting height', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
text.height = 300;
@@ -71,7 +71,7 @@
it('should modify the width of the object when setting width', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
text.width = 300;
diff --git a/test/core/getGlobalPosition.js b/test/core/getGlobalPosition.js
index cb0cd29..c108d72 100644
--- a/test/core/getGlobalPosition.js
+++ b/test/core/getGlobalPosition.js
@@ -4,9 +4,9 @@
{
it('should return correct global coordinates of a displayObject, without depending on its pivot', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();
+ const container = new PIXI.Container();
parent.addChild(container);
@@ -16,9 +16,7 @@
container.position.set(10, -30);
container.pivot.set(1000, 1000);
- var globalPoint;
-
- globalPoint = container.getGlobalPosition(globalPoint, false);
+ let globalPoint = container.getGlobalPosition();
expect(globalPoint.x).to.equal(80);
expect(globalPoint.y).to.equal(160);
diff --git a/test/core/getLocalBounds.js b/test/core/getLocalBounds.js
index d1838db..5835b9f 100644
--- a/test/core/getLocalBounds.js
+++ b/test/core/getLocalBounds.js
@@ -4,16 +4,14 @@
{
it('should register correct local-bounds with a LOADED Sprite', function ()
{
- var parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const parent = new PIXI.Container();
+ const texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const sprite = new PIXI.Sprite(texture);
parent.addChild(sprite);
- var bounds;
-
- bounds = sprite.getLocalBounds();
+ let bounds = sprite.getLocalBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -36,9 +34,9 @@
it('should register correct local-bounds with Graphics', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var graphics = new PIXI.Graphics();
+ const graphics = new PIXI.Graphics();
graphics.beginFill(0xFF0000).drawCircle(0, 0, 10);// texture);
@@ -46,7 +44,7 @@
parent.addChild(graphics);
- var bounds = graphics.getLocalBounds();
+ const bounds = graphics.getLocalBounds();
expect(bounds.x).to.equal(-10);
expect(bounds.y).to.equal(-10);
@@ -56,13 +54,13 @@
it('should register correct local-bounds with an empty Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
parent.addChild(container);
- var bounds = container.getLocalBounds();
+ const bounds = container.getLocalBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -72,11 +70,11 @@
it('should register correct local-bounds with an item that has already had its parent Container transformed', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
parent.addChild(container);
container.addChild(graphics);
@@ -84,7 +82,7 @@
container.position.x = 100;
container.position.y = 100;
- var bounds = container.getLocalBounds();
+ const bounds = container.getLocalBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -94,18 +92,18 @@
it('should register correct local-bounds with a Mesh', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const texture = PIXI.RenderTexture.create(10, 10);
- var plane = new PIXI.mesh.Plane(texture);
+ const plane = new PIXI.mesh.Plane(texture);
parent.addChild(plane);
plane.position.x = 20;
plane.position.y = 20;
- var bounds = plane.getLocalBounds();
+ const bounds = plane.getLocalBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -115,9 +113,9 @@
it('should register correct local-bounds with a cachAsBitmap item inside after a render', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var graphic = new PIXI.Graphics();
+ const graphic = new PIXI.Graphics();
graphic.beginFill(0xffffff);
graphic.drawRect(0, 0, 100, 100);
@@ -126,12 +124,12 @@
parent.addChild(graphic);
- var renderer = new PIXI.CanvasRenderer(100, 100);
+ const renderer = new PIXI.CanvasRenderer(100, 100);
- renderer.sayHello = function () { /* empty */ };
+ renderer.sayHello = () => { /* empty */ };
renderer.render(parent);
- var bounds = parent.getLocalBounds();
+ const bounds = parent.getLocalBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
diff --git a/test/core/toGlobal.js b/test/core/toGlobal.js
index 24ba48a..ad36be8 100644
--- a/test/core/toGlobal.js
+++ b/test/core/toGlobal.js
@@ -4,17 +4,15 @@
{
it('should return correct global cordinates of a point from within a displayObject', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();
+ const container = new PIXI.Container();
parent.addChild(container);
- var point = new PIXI.Point(100, 100);
+ const point = new PIXI.Point(100, 100);
- var globalPoint;
-
- globalPoint = container.toGlobal(point);
+ let globalPoint = container.toGlobal(point);
expect(globalPoint.x).to.equal(100);
expect(globalPoint.y).to.equal(100);
diff --git a/test/core/toLocal.js b/test/core/toLocal.js
index 781caeb..01b78d4 100644
--- a/test/core/toLocal.js
+++ b/test/core/toLocal.js
@@ -4,17 +4,15 @@
{
it('should return correct local cordinates of a displayObject', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();
+ const container = new PIXI.Container();
parent.addChild(container);
- var point = new PIXI.Point(100, 100);
+ const point = new PIXI.Point(100, 100);
- var localPoint;
-
- localPoint = container.toLocal(point);
+ let localPoint = container.toLocal(point);
expect(localPoint.x).to.equal(100);
expect(localPoint.y).to.equal(100);
@@ -33,10 +31,10 @@
it('should map the correct local cordinates of a displayObject to another', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();
- var container2 = new PIXI.Container();
+ const container = new PIXI.Container();
+ const container2 = new PIXI.Container();
parent.addChild(container);
parent.addChild(container2);
@@ -44,12 +42,12 @@
container2.position.x = 100;
container2.position.y = 100;
- var point = new PIXI.Point(100, 100);
+ const point = new PIXI.Point(100, 100);
container.scale.x = 2;
container.scale.y = 2;
- var localPoint = container.toLocal(point, container2);
+ const localPoint = container.toLocal(point, container2);
expect(localPoint.x).to.equal(100);
expect(localPoint.y).to.equal(100);
diff --git a/test/core/Bounds.js b/test/core/Bounds.js
index a4a3351..d2893a6 100644
--- a/test/core/Bounds.js
+++ b/test/core/Bounds.js
@@ -4,16 +4,14 @@
{
it('should register correct width/height with a LOADED Sprite', function ()
{
- var parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const parent = new PIXI.Container();
+ const texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const sprite = new PIXI.Sprite(texture);
parent.addChild(sprite);
- var bounds;
-
- bounds = sprite.getBounds();
+ let bounds = sprite.getBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -43,20 +41,17 @@
it('should register correct width/height with Graphics', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
+ const graphics = new PIXI.Graphics();
- var graphics = new PIXI.Graphics();
-
- var bounds;
-
- bounds = graphics.getBounds();
+ let bounds = graphics.getBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
expect(bounds.width).to.equal(0);
expect(bounds.height).to.equal(0);
- graphics.beginFill(0xFF0000).drawCircle(0, 0, 10, 10);// texture);
+ graphics.beginFill(0xFF0000).drawCircle(0, 0, 10, 10);
parent.addChild(graphics);
@@ -90,15 +85,13 @@
it('should register correct width/height with an empty Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
parent.addChild(container);
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -121,14 +114,14 @@
it('should register correct width/height with a Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container(); // Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10); // texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
container.addChild(graphics);
@@ -140,9 +133,7 @@
graphics.position.x = 100;
graphics.position.y = 100;
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(30);
expect(bounds.y).to.equal(20);
@@ -168,11 +159,11 @@
it('should register correct width/height with an item that has already had its parent Container transformed', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);
parent.addChild(container);
container.addChild(graphics);
@@ -180,9 +171,7 @@
container.position.x = 100;
container.position.y = 100;
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(100);
expect(bounds.y).to.equal(100);
@@ -199,20 +188,18 @@
it('should register correct width/height with a Mesh', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const texture = PIXI.RenderTexture.create(10, 10);
- var plane = new PIXI.mesh.Plane(texture);
+ const plane = new PIXI.mesh.Plane(texture);
parent.addChild(plane);
plane.position.x = 20;
plane.position.y = 20;
- var bounds;
-
- bounds = plane.getBounds();
+ let bounds = plane.getBounds();
expect(bounds.x).to.equal(20);
expect(bounds.y).to.equal(20);
@@ -232,14 +219,14 @@
it('should register correct width/height with an a DisplayObject is visible false', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
container.addChild(graphics);
@@ -253,9 +240,7 @@
graphics.visible = false;
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(30);
expect(bounds.y).to.equal(20);
@@ -281,12 +266,12 @@
it('should register correct bounds of invisible Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container(); // Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
parent.addChild(container);
@@ -295,9 +280,7 @@
container.visible = false;
container.position.set(100, 100);
- var bounds;
-
- bounds = container.getBounds();
+ const bounds = container.getBounds();
expect(bounds.x).to.equal(130);
expect(bounds.y).to.equal(120);
@@ -307,14 +290,14 @@
it('should register correct width/height with Container masked child', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
container.addChild(graphics);
@@ -327,9 +310,7 @@
graphics.position.x = 32;
graphics.position.y = 23;
- var bounds;
-
- bounds = graphics.getBounds();
+ let bounds = graphics.getBounds();
expect(bounds.x).to.equal(32);
expect(bounds.y).to.equal(23);
@@ -346,11 +327,11 @@
it('should register correct width/height with an a DisplayObject parent has moved', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10);
container.addChild(graphics);
@@ -361,7 +342,7 @@
container.position.x -= 100;
container.position.y -= 100;
- var bounds = graphics.getBounds();
+ const bounds = graphics.getBounds();
expect(bounds.x).to.equal(-110);
expect(bounds.y).to.equal(-110);
@@ -371,20 +352,18 @@
it('should register correct width/height with an a Text Object', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var text = new PIXI.Text('i am some text');
+ const text = new PIXI.Text('i am some text');
container.addChild(text);
parent.addChild(container);
- var bounds;
-
- bounds = text.getBounds();
- var bx = bounds.width;
+ let bounds = text.getBounds();
+ const bx = bounds.width;
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -401,9 +380,9 @@
it('should return a different rectangle if getting local bounds after global bounds ', function ()
{
- var parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const parent = new PIXI.Container();
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
sprite.position.x = 20;
sprite.position.y = 20;
@@ -413,14 +392,14 @@
parent.addChild(sprite);
- var bounds = sprite.getBounds();
+ const bounds = sprite.getBounds();
expect(bounds.x).to.equal(20);
expect(bounds.y).to.equal(20);
expect(bounds.width).to.equal(20);
expect(bounds.height).to.equal(20);
- var localBounds = sprite.getLocalBounds();
+ const localBounds = sprite.getLocalBounds();
expect(localBounds.x).to.equal(0);
expect(localBounds.y).to.equal(0);
@@ -430,23 +409,23 @@
it('should ensure bounds respect the trim of a texture ', function ()
{
- var parent = new PIXI.Container();
- var baseTexture = new PIXI.BaseRenderTexture(100, 100);
+ const parent = new PIXI.Container();
+ const baseTexture = new PIXI.BaseRenderTexture(100, 100);
- var orig = new PIXI.Rectangle(0, 0, 100, 50);
- var frame = new PIXI.Rectangle(2, 2, 50, 50);
- var trim = new PIXI.Rectangle(25, 0, 50, 50);
+ const orig = new PIXI.Rectangle(0, 0, 100, 50);
+ const frame = new PIXI.Rectangle(2, 2, 50, 50);
+ const trim = new PIXI.Rectangle(25, 0, 50, 50);
- var trimmedTexture = new PIXI.Texture(baseTexture, frame, orig, trim);
+ const trimmedTexture = new PIXI.Texture(baseTexture, frame, orig, trim);
- var sprite = new PIXI.Sprite(trimmedTexture);
+ const sprite = new PIXI.Sprite(trimmedTexture);
sprite.position.x = 20;
sprite.position.y = 20;
parent.addChild(sprite);
- var bounds = sprite.getBounds();
+ const bounds = sprite.getBounds();
expect(bounds.x).to.equal(20);
expect(bounds.y).to.equal(20);
diff --git a/test/core/Sprite.js b/test/core/Sprite.js
index f176e3c..2a3d301 100755
--- a/test/core/Sprite.js
+++ b/test/core/Sprite.js
@@ -6,7 +6,7 @@
{
it('should not be negative for negative scale.x', function ()
{
- var sprite = new PIXI.Sprite();
+ const sprite = new PIXI.Sprite();
sprite.width = 100;
expect(sprite.width).to.be.at.least(0);
@@ -16,8 +16,8 @@
it('should not change sign of scale.x', function ()
{
- var texture = new PIXI.Texture(new PIXI.BaseTexture());
- var sprite = new PIXI.Sprite();
+ const texture = new PIXI.Texture(new PIXI.BaseTexture());
+ const sprite = new PIXI.Sprite();
texture.orig.width = 100;
sprite.scale.x = 1;
@@ -36,7 +36,7 @@
{
it('should not be negative for negative scale.y', function ()
{
- var sprite = new PIXI.Sprite();
+ const sprite = new PIXI.Sprite();
sprite.height = 100;
expect(sprite.height).to.be.at.least(0);
@@ -46,8 +46,8 @@
it('should not change sign of scale.y', function ()
{
- var texture = new PIXI.Texture(new PIXI.BaseTexture());
- var sprite = new PIXI.Sprite();
+ const texture = new PIXI.Texture(new PIXI.BaseTexture());
+ const sprite = new PIXI.Sprite();
texture.orig.height = 100;
sprite.scale.y = 1;
diff --git a/test/core/Text.js b/test/core/Text.js
index d818099..4f67752 100644
--- a/test/core/Text.js
+++ b/test/core/Text.js
@@ -6,7 +6,7 @@
{
it('should call through to Sprite.destroy', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
expect(text.anchor).to.not.equal(null);
text.destroy();
@@ -15,7 +15,7 @@
it('should set context to null', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
expect(text.style).to.not.equal(null);
text.destroy();
@@ -24,8 +24,8 @@
it('should destroy children if children flag is set', function ()
{
- var text = new PIXI.Text('foo');
- var child = new PIXI.DisplayObject();
+ const text = new PIXI.Text('foo');
+ const child = new PIXI.DisplayObject();
text.addChild(child);
text.destroy({ children: true });
@@ -35,8 +35,8 @@
it('should accept options correctly', function ()
{
- var text = new PIXI.Text('foo');
- var child = new PIXI.DisplayObject();
+ const text = new PIXI.Text('foo');
+ const child = new PIXI.DisplayObject();
text.addChild(child);
text.destroy(true);
@@ -46,8 +46,8 @@
it('should pass opts on to children if children flag is set', function ()
{
- var text = new PIXI.Text('foo');
- var child = new PIXI.DisplayObject();
+ const text = new PIXI.Text('foo');
+ const child = new PIXI.DisplayObject();
var childDestroyOpts;
child.destroy = function (opts)
@@ -62,7 +62,7 @@
it('should modify the height of the object when setting height', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
text.height = 300;
@@ -71,7 +71,7 @@
it('should modify the width of the object when setting width', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
text.width = 300;
diff --git a/test/core/getGlobalPosition.js b/test/core/getGlobalPosition.js
index cb0cd29..c108d72 100644
--- a/test/core/getGlobalPosition.js
+++ b/test/core/getGlobalPosition.js
@@ -4,9 +4,9 @@
{
it('should return correct global coordinates of a displayObject, without depending on its pivot', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();
+ const container = new PIXI.Container();
parent.addChild(container);
@@ -16,9 +16,7 @@
container.position.set(10, -30);
container.pivot.set(1000, 1000);
- var globalPoint;
-
- globalPoint = container.getGlobalPosition(globalPoint, false);
+ let globalPoint = container.getGlobalPosition();
expect(globalPoint.x).to.equal(80);
expect(globalPoint.y).to.equal(160);
diff --git a/test/core/getLocalBounds.js b/test/core/getLocalBounds.js
index d1838db..5835b9f 100644
--- a/test/core/getLocalBounds.js
+++ b/test/core/getLocalBounds.js
@@ -4,16 +4,14 @@
{
it('should register correct local-bounds with a LOADED Sprite', function ()
{
- var parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const parent = new PIXI.Container();
+ const texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const sprite = new PIXI.Sprite(texture);
parent.addChild(sprite);
- var bounds;
-
- bounds = sprite.getLocalBounds();
+ let bounds = sprite.getLocalBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -36,9 +34,9 @@
it('should register correct local-bounds with Graphics', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var graphics = new PIXI.Graphics();
+ const graphics = new PIXI.Graphics();
graphics.beginFill(0xFF0000).drawCircle(0, 0, 10);// texture);
@@ -46,7 +44,7 @@
parent.addChild(graphics);
- var bounds = graphics.getLocalBounds();
+ const bounds = graphics.getLocalBounds();
expect(bounds.x).to.equal(-10);
expect(bounds.y).to.equal(-10);
@@ -56,13 +54,13 @@
it('should register correct local-bounds with an empty Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
parent.addChild(container);
- var bounds = container.getLocalBounds();
+ const bounds = container.getLocalBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -72,11 +70,11 @@
it('should register correct local-bounds with an item that has already had its parent Container transformed', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
parent.addChild(container);
container.addChild(graphics);
@@ -84,7 +82,7 @@
container.position.x = 100;
container.position.y = 100;
- var bounds = container.getLocalBounds();
+ const bounds = container.getLocalBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -94,18 +92,18 @@
it('should register correct local-bounds with a Mesh', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const texture = PIXI.RenderTexture.create(10, 10);
- var plane = new PIXI.mesh.Plane(texture);
+ const plane = new PIXI.mesh.Plane(texture);
parent.addChild(plane);
plane.position.x = 20;
plane.position.y = 20;
- var bounds = plane.getLocalBounds();
+ const bounds = plane.getLocalBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -115,9 +113,9 @@
it('should register correct local-bounds with a cachAsBitmap item inside after a render', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var graphic = new PIXI.Graphics();
+ const graphic = new PIXI.Graphics();
graphic.beginFill(0xffffff);
graphic.drawRect(0, 0, 100, 100);
@@ -126,12 +124,12 @@
parent.addChild(graphic);
- var renderer = new PIXI.CanvasRenderer(100, 100);
+ const renderer = new PIXI.CanvasRenderer(100, 100);
- renderer.sayHello = function () { /* empty */ };
+ renderer.sayHello = () => { /* empty */ };
renderer.render(parent);
- var bounds = parent.getLocalBounds();
+ const bounds = parent.getLocalBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
diff --git a/test/core/toGlobal.js b/test/core/toGlobal.js
index 24ba48a..ad36be8 100644
--- a/test/core/toGlobal.js
+++ b/test/core/toGlobal.js
@@ -4,17 +4,15 @@
{
it('should return correct global cordinates of a point from within a displayObject', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();
+ const container = new PIXI.Container();
parent.addChild(container);
- var point = new PIXI.Point(100, 100);
+ const point = new PIXI.Point(100, 100);
- var globalPoint;
-
- globalPoint = container.toGlobal(point);
+ let globalPoint = container.toGlobal(point);
expect(globalPoint.x).to.equal(100);
expect(globalPoint.y).to.equal(100);
diff --git a/test/core/toLocal.js b/test/core/toLocal.js
index 781caeb..01b78d4 100644
--- a/test/core/toLocal.js
+++ b/test/core/toLocal.js
@@ -4,17 +4,15 @@
{
it('should return correct local cordinates of a displayObject', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();
+ const container = new PIXI.Container();
parent.addChild(container);
- var point = new PIXI.Point(100, 100);
+ const point = new PIXI.Point(100, 100);
- var localPoint;
-
- localPoint = container.toLocal(point);
+ let localPoint = container.toLocal(point);
expect(localPoint.x).to.equal(100);
expect(localPoint.y).to.equal(100);
@@ -33,10 +31,10 @@
it('should map the correct local cordinates of a displayObject to another', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();
- var container2 = new PIXI.Container();
+ const container = new PIXI.Container();
+ const container2 = new PIXI.Container();
parent.addChild(container);
parent.addChild(container2);
@@ -44,12 +42,12 @@
container2.position.x = 100;
container2.position.y = 100;
- var point = new PIXI.Point(100, 100);
+ const point = new PIXI.Point(100, 100);
container.scale.x = 2;
container.scale.y = 2;
- var localPoint = container.toLocal(point, container2);
+ const localPoint = container.toLocal(point, container2);
expect(localPoint.x).to.equal(100);
expect(localPoint.y).to.equal(100);
diff --git a/test/core/util.js b/test/core/util.js
index 45d424a..6f0686b 100755
--- a/test/core/util.js
+++ b/test/core/util.js
@@ -71,7 +71,7 @@
it('should decompose a data URI', function ()
{
- var dataUri = PIXI.utils.decomposeDataUri('data:image/png;base64,94Z9RWUN77ZW');
+ const dataUri = PIXI.utils.decomposeDataUri('data:image/png;base64,94Z9RWUN77ZW');
expect(dataUri)
.to.be.an('object');
@@ -87,7 +87,7 @@
it('should return undefined for anything else', function ()
{
- var dataUri = PIXI.utils.decomposeDataUri('foo');
+ const dataUri = PIXI.utils.decomposeDataUri('foo');
expect(dataUri)
.to.be.an('undefined');
@@ -96,7 +96,7 @@
describe('getUrlFileExtension', function ()
{
- it('should exist', function ()
+ it('should exist', () =>
{
expect(PIXI.utils.getUrlFileExtension)
.to.be.a('function');
@@ -104,7 +104,7 @@
it('should return extension of URL in lower case', function ()
{
- var imageType = PIXI.utils.getUrlFileExtension('http://foo.bar/baz.PNG');
+ const imageType = PIXI.utils.getUrlFileExtension('http://foo.bar/baz.PNG');
expect(imageType)
.to.equal('png');
@@ -112,7 +112,7 @@
it('should return extension of URL when absolute', function ()
{
- var imageType = PIXI.utils.getUrlFileExtension('/you/baz.PNG');
+ const imageType = PIXI.utils.getUrlFileExtension('/you/baz.PNG');
expect(imageType)
.to.equal('png');
@@ -120,7 +120,7 @@
it('should return extension of URL when relative', function ()
{
- var imageType = PIXI.utils.getUrlFileExtension('me/baz.PNG');
+ const imageType = PIXI.utils.getUrlFileExtension('me/baz.PNG');
expect(imageType)
.to.equal('png');
@@ -128,7 +128,7 @@
it('should return extension of URL when just an extension', function ()
{
- var imageType = PIXI.utils.getUrlFileExtension('.PNG');
+ const imageType = PIXI.utils.getUrlFileExtension('.PNG');
expect(imageType)
.to.equal('png');
@@ -136,7 +136,7 @@
it('should work with a hash on the url', function ()
{
- var imageType = PIXI.utils.getUrlFileExtension('http://foo.bar/baz.PNG#derp');
+ const imageType = PIXI.utils.getUrlFileExtension('http://foo.bar/baz.PNG#derp');
expect(imageType)
.to.equal('png');
@@ -144,7 +144,7 @@
it('should work with a hash path on the url', function ()
{
- var imageType = PIXI.utils.getUrlFileExtension('http://foo.bar/baz.PNG#derp/this/is/a/path/me.jpg');
+ const imageType = PIXI.utils.getUrlFileExtension('http://foo.bar/baz.PNG#derp/this/is/a/path/me.jpg');
expect(imageType)
.to.equal('png');
@@ -152,7 +152,7 @@
it('should work with a query string on the url', function ()
{
- var imageType = PIXI.utils.getUrlFileExtension('http://foo.bar/baz.PNG?v=1&file=me.jpg');
+ const imageType = PIXI.utils.getUrlFileExtension('http://foo.bar/baz.PNG?v=1&file=me.jpg');
expect(imageType)
.to.equal('png');
@@ -160,7 +160,7 @@
it('should work with a hash and query string on the url', function ()
{
- var imageType = PIXI.utils.getUrlFileExtension('http://foo.bar/baz.PNG?v=1&file=me.jpg#not-today');
+ const imageType = PIXI.utils.getUrlFileExtension('http://foo.bar/baz.PNG?v=1&file=me.jpg#not-today');
expect(imageType)
.to.equal('png');
@@ -168,7 +168,7 @@
it('should work with a hash path and query string on the url', function ()
{
- var imageType = PIXI.utils.getUrlFileExtension('http://foo.bar/baz.PNG?v=1&file=me.jpg#path/self/not-today.svg');
+ const imageType = PIXI.utils.getUrlFileExtension('http://foo.bar/baz.PNG?v=1&file=me.jpg#path/s/not-today.svg');
expect(imageType)
.to.equal('png');
@@ -185,7 +185,7 @@
it('should return a size object with width and height from an SVG string', function ()
{
- var svgSize = PIXI.utils.getSvgSize('');
+ const svgSize = PIXI.utils.getSvgSize('');
expect(svgSize)
.to.be.an('object');
@@ -209,7 +209,7 @@
it('should work with px values', function ()
{
- var svgSize = PIXI.utils.getSvgSize('');
+ const svgSize = PIXI.utils.getSvgSize('');
expect(svgSize)
.to.be.an('object');
@@ -221,7 +221,7 @@
it('should return an empty object when width and/or height is missing', function ()
{
- var svgSize = PIXI.utils.getSvgSize('');
+ const svgSize = PIXI.utils.getSvgSize('');
expect(Object.keys(svgSize).length)
.to.equal(0);
@@ -256,7 +256,7 @@
it('should return -1 for negative numbers', function ()
{
- for (var i = 0; i < 10; i += 1)
+ for (let i = 0; i < 10; i += 1)
{
expect(PIXI.utils.sign(-Math.random()))
.to.be.equal(-1);
@@ -265,7 +265,7 @@
it('should return 1 for positive numbers', function ()
{
- for (var i = 0; i < 10; i += 1)
+ for (let i = 0; i < 10; i += 1)
{
expect(PIXI.utils.sign(Math.random() + 0.000001))
.to.be.equal(1);
@@ -277,7 +277,7 @@
{
var arr;
- beforeEach(function ()
+ beforeEach(() =>
{
arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
});
@@ -296,7 +296,7 @@
it('should remove the number of elements specified from the array, starting from the start index', function ()
{
- var res = [1, 2, 3, 8, 9, 10];
+ const res = [1, 2, 3, 8, 9, 10];
PIXI.utils.removeItems(arr, 3, 4);
expect(arr).to.be.deep.equal(res);
@@ -304,7 +304,7 @@
it('should remove other elements if delete count is > than the number of elements after start index', function ()
{
- var res = [1, 2, 3, 4, 5, 6, 7];
+ const res = [1, 2, 3, 4, 5, 6, 7];
PIXI.utils.removeItems(arr, 7, 10);
expect(arr).to.be.deep.equal(res);
diff --git a/test/core/Bounds.js b/test/core/Bounds.js
index a4a3351..d2893a6 100644
--- a/test/core/Bounds.js
+++ b/test/core/Bounds.js
@@ -4,16 +4,14 @@
{
it('should register correct width/height with a LOADED Sprite', function ()
{
- var parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const parent = new PIXI.Container();
+ const texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const sprite = new PIXI.Sprite(texture);
parent.addChild(sprite);
- var bounds;
-
- bounds = sprite.getBounds();
+ let bounds = sprite.getBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -43,20 +41,17 @@
it('should register correct width/height with Graphics', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
+ const graphics = new PIXI.Graphics();
- var graphics = new PIXI.Graphics();
-
- var bounds;
-
- bounds = graphics.getBounds();
+ let bounds = graphics.getBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
expect(bounds.width).to.equal(0);
expect(bounds.height).to.equal(0);
- graphics.beginFill(0xFF0000).drawCircle(0, 0, 10, 10);// texture);
+ graphics.beginFill(0xFF0000).drawCircle(0, 0, 10, 10);
parent.addChild(graphics);
@@ -90,15 +85,13 @@
it('should register correct width/height with an empty Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
parent.addChild(container);
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -121,14 +114,14 @@
it('should register correct width/height with a Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container(); // Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10); // texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
container.addChild(graphics);
@@ -140,9 +133,7 @@
graphics.position.x = 100;
graphics.position.y = 100;
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(30);
expect(bounds.y).to.equal(20);
@@ -168,11 +159,11 @@
it('should register correct width/height with an item that has already had its parent Container transformed', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);
parent.addChild(container);
container.addChild(graphics);
@@ -180,9 +171,7 @@
container.position.x = 100;
container.position.y = 100;
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(100);
expect(bounds.y).to.equal(100);
@@ -199,20 +188,18 @@
it('should register correct width/height with a Mesh', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const texture = PIXI.RenderTexture.create(10, 10);
- var plane = new PIXI.mesh.Plane(texture);
+ const plane = new PIXI.mesh.Plane(texture);
parent.addChild(plane);
plane.position.x = 20;
plane.position.y = 20;
- var bounds;
-
- bounds = plane.getBounds();
+ let bounds = plane.getBounds();
expect(bounds.x).to.equal(20);
expect(bounds.y).to.equal(20);
@@ -232,14 +219,14 @@
it('should register correct width/height with an a DisplayObject is visible false', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
container.addChild(graphics);
@@ -253,9 +240,7 @@
graphics.visible = false;
- var bounds;
-
- bounds = container.getBounds();
+ let bounds = container.getBounds();
expect(bounds.x).to.equal(30);
expect(bounds.y).to.equal(20);
@@ -281,12 +266,12 @@
it('should register correct bounds of invisible Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container(); // Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
parent.addChild(container);
@@ -295,9 +280,7 @@
container.visible = false;
container.position.set(100, 100);
- var bounds;
-
- bounds = container.getBounds();
+ const bounds = container.getBounds();
expect(bounds.x).to.equal(130);
expect(bounds.y).to.equal(120);
@@ -307,14 +290,14 @@
it('should register correct width/height with Container masked child', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);
container.addChild(graphics);
@@ -327,9 +310,7 @@
graphics.position.x = 32;
graphics.position.y = 23;
- var bounds;
-
- bounds = graphics.getBounds();
+ let bounds = graphics.getBounds();
expect(bounds.x).to.equal(32);
expect(bounds.y).to.equal(23);
@@ -346,11 +327,11 @@
it('should register correct width/height with an a DisplayObject parent has moved', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10);
container.addChild(graphics);
@@ -361,7 +342,7 @@
container.position.x -= 100;
container.position.y -= 100;
- var bounds = graphics.getBounds();
+ const bounds = graphics.getBounds();
expect(bounds.x).to.equal(-110);
expect(bounds.y).to.equal(-110);
@@ -371,20 +352,18 @@
it('should register correct width/height with an a Text Object', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();
- var text = new PIXI.Text('i am some text');
+ const text = new PIXI.Text('i am some text');
container.addChild(text);
parent.addChild(container);
- var bounds;
-
- bounds = text.getBounds();
- var bx = bounds.width;
+ let bounds = text.getBounds();
+ const bx = bounds.width;
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -401,9 +380,9 @@
it('should return a different rectangle if getting local bounds after global bounds ', function ()
{
- var parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const parent = new PIXI.Container();
+ const texture = PIXI.RenderTexture.create(10, 10);
+ const sprite = new PIXI.Sprite(texture);
sprite.position.x = 20;
sprite.position.y = 20;
@@ -413,14 +392,14 @@
parent.addChild(sprite);
- var bounds = sprite.getBounds();
+ const bounds = sprite.getBounds();
expect(bounds.x).to.equal(20);
expect(bounds.y).to.equal(20);
expect(bounds.width).to.equal(20);
expect(bounds.height).to.equal(20);
- var localBounds = sprite.getLocalBounds();
+ const localBounds = sprite.getLocalBounds();
expect(localBounds.x).to.equal(0);
expect(localBounds.y).to.equal(0);
@@ -430,23 +409,23 @@
it('should ensure bounds respect the trim of a texture ', function ()
{
- var parent = new PIXI.Container();
- var baseTexture = new PIXI.BaseRenderTexture(100, 100);
+ const parent = new PIXI.Container();
+ const baseTexture = new PIXI.BaseRenderTexture(100, 100);
- var orig = new PIXI.Rectangle(0, 0, 100, 50);
- var frame = new PIXI.Rectangle(2, 2, 50, 50);
- var trim = new PIXI.Rectangle(25, 0, 50, 50);
+ const orig = new PIXI.Rectangle(0, 0, 100, 50);
+ const frame = new PIXI.Rectangle(2, 2, 50, 50);
+ const trim = new PIXI.Rectangle(25, 0, 50, 50);
- var trimmedTexture = new PIXI.Texture(baseTexture, frame, orig, trim);
+ const trimmedTexture = new PIXI.Texture(baseTexture, frame, orig, trim);
- var sprite = new PIXI.Sprite(trimmedTexture);
+ const sprite = new PIXI.Sprite(trimmedTexture);
sprite.position.x = 20;
sprite.position.y = 20;
parent.addChild(sprite);
- var bounds = sprite.getBounds();
+ const bounds = sprite.getBounds();
expect(bounds.x).to.equal(20);
expect(bounds.y).to.equal(20);
diff --git a/test/core/Sprite.js b/test/core/Sprite.js
index f176e3c..2a3d301 100755
--- a/test/core/Sprite.js
+++ b/test/core/Sprite.js
@@ -6,7 +6,7 @@
{
it('should not be negative for negative scale.x', function ()
{
- var sprite = new PIXI.Sprite();
+ const sprite = new PIXI.Sprite();
sprite.width = 100;
expect(sprite.width).to.be.at.least(0);
@@ -16,8 +16,8 @@
it('should not change sign of scale.x', function ()
{
- var texture = new PIXI.Texture(new PIXI.BaseTexture());
- var sprite = new PIXI.Sprite();
+ const texture = new PIXI.Texture(new PIXI.BaseTexture());
+ const sprite = new PIXI.Sprite();
texture.orig.width = 100;
sprite.scale.x = 1;
@@ -36,7 +36,7 @@
{
it('should not be negative for negative scale.y', function ()
{
- var sprite = new PIXI.Sprite();
+ const sprite = new PIXI.Sprite();
sprite.height = 100;
expect(sprite.height).to.be.at.least(0);
@@ -46,8 +46,8 @@
it('should not change sign of scale.y', function ()
{
- var texture = new PIXI.Texture(new PIXI.BaseTexture());
- var sprite = new PIXI.Sprite();
+ const texture = new PIXI.Texture(new PIXI.BaseTexture());
+ const sprite = new PIXI.Sprite();
texture.orig.height = 100;
sprite.scale.y = 1;
diff --git a/test/core/Text.js b/test/core/Text.js
index d818099..4f67752 100644
--- a/test/core/Text.js
+++ b/test/core/Text.js
@@ -6,7 +6,7 @@
{
it('should call through to Sprite.destroy', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
expect(text.anchor).to.not.equal(null);
text.destroy();
@@ -15,7 +15,7 @@
it('should set context to null', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
expect(text.style).to.not.equal(null);
text.destroy();
@@ -24,8 +24,8 @@
it('should destroy children if children flag is set', function ()
{
- var text = new PIXI.Text('foo');
- var child = new PIXI.DisplayObject();
+ const text = new PIXI.Text('foo');
+ const child = new PIXI.DisplayObject();
text.addChild(child);
text.destroy({ children: true });
@@ -35,8 +35,8 @@
it('should accept options correctly', function ()
{
- var text = new PIXI.Text('foo');
- var child = new PIXI.DisplayObject();
+ const text = new PIXI.Text('foo');
+ const child = new PIXI.DisplayObject();
text.addChild(child);
text.destroy(true);
@@ -46,8 +46,8 @@
it('should pass opts on to children if children flag is set', function ()
{
- var text = new PIXI.Text('foo');
- var child = new PIXI.DisplayObject();
+ const text = new PIXI.Text('foo');
+ const child = new PIXI.DisplayObject();
var childDestroyOpts;
child.destroy = function (opts)
@@ -62,7 +62,7 @@
it('should modify the height of the object when setting height', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
text.height = 300;
@@ -71,7 +71,7 @@
it('should modify the width of the object when setting width', function ()
{
- var text = new PIXI.Text('foo');
+ const text = new PIXI.Text('foo');
text.width = 300;
diff --git a/test/core/getGlobalPosition.js b/test/core/getGlobalPosition.js
index cb0cd29..c108d72 100644
--- a/test/core/getGlobalPosition.js
+++ b/test/core/getGlobalPosition.js
@@ -4,9 +4,9 @@
{
it('should return correct global coordinates of a displayObject, without depending on its pivot', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();
+ const container = new PIXI.Container();
parent.addChild(container);
@@ -16,9 +16,7 @@
container.position.set(10, -30);
container.pivot.set(1000, 1000);
- var globalPoint;
-
- globalPoint = container.getGlobalPosition(globalPoint, false);
+ let globalPoint = container.getGlobalPosition();
expect(globalPoint.x).to.equal(80);
expect(globalPoint.y).to.equal(160);
diff --git a/test/core/getLocalBounds.js b/test/core/getLocalBounds.js
index d1838db..5835b9f 100644
--- a/test/core/getLocalBounds.js
+++ b/test/core/getLocalBounds.js
@@ -4,16 +4,14 @@
{
it('should register correct local-bounds with a LOADED Sprite', function ()
{
- var parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const parent = new PIXI.Container();
+ const texture = PIXI.RenderTexture.create(10, 10);
- var sprite = new PIXI.Sprite(texture);
+ const sprite = new PIXI.Sprite(texture);
parent.addChild(sprite);
- var bounds;
-
- bounds = sprite.getLocalBounds();
+ let bounds = sprite.getLocalBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -36,9 +34,9 @@
it('should register correct local-bounds with Graphics', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var graphics = new PIXI.Graphics();
+ const graphics = new PIXI.Graphics();
graphics.beginFill(0xFF0000).drawCircle(0, 0, 10);// texture);
@@ -46,7 +44,7 @@
parent.addChild(graphics);
- var bounds = graphics.getLocalBounds();
+ const bounds = graphics.getLocalBounds();
expect(bounds.x).to.equal(-10);
expect(bounds.y).to.equal(-10);
@@ -56,13 +54,13 @@
it('should register correct local-bounds with an empty Container', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
parent.addChild(container);
- var bounds = container.getLocalBounds();
+ const bounds = container.getLocalBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -72,11 +70,11 @@
it('should register correct local-bounds with an item that has already had its parent Container transformed', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
+ const container = new PIXI.Container();// Graphics().beginFill(0xFF0000).drawCircle(0, 0, 10, 10);//texture);
- var graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
+ const graphics = new PIXI.Graphics().beginFill(0xFF0000).drawRect(0, 0, 10, 10);// texture);
parent.addChild(container);
container.addChild(graphics);
@@ -84,7 +82,7 @@
container.position.x = 100;
container.position.y = 100;
- var bounds = container.getLocalBounds();
+ const bounds = container.getLocalBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -94,18 +92,18 @@
it('should register correct local-bounds with a Mesh', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var texture = PIXI.RenderTexture.create(10, 10);
+ const texture = PIXI.RenderTexture.create(10, 10);
- var plane = new PIXI.mesh.Plane(texture);
+ const plane = new PIXI.mesh.Plane(texture);
parent.addChild(plane);
plane.position.x = 20;
plane.position.y = 20;
- var bounds = plane.getLocalBounds();
+ const bounds = plane.getLocalBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
@@ -115,9 +113,9 @@
it('should register correct local-bounds with a cachAsBitmap item inside after a render', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var graphic = new PIXI.Graphics();
+ const graphic = new PIXI.Graphics();
graphic.beginFill(0xffffff);
graphic.drawRect(0, 0, 100, 100);
@@ -126,12 +124,12 @@
parent.addChild(graphic);
- var renderer = new PIXI.CanvasRenderer(100, 100);
+ const renderer = new PIXI.CanvasRenderer(100, 100);
- renderer.sayHello = function () { /* empty */ };
+ renderer.sayHello = () => { /* empty */ };
renderer.render(parent);
- var bounds = parent.getLocalBounds();
+ const bounds = parent.getLocalBounds();
expect(bounds.x).to.equal(0);
expect(bounds.y).to.equal(0);
diff --git a/test/core/toGlobal.js b/test/core/toGlobal.js
index 24ba48a..ad36be8 100644
--- a/test/core/toGlobal.js
+++ b/test/core/toGlobal.js
@@ -4,17 +4,15 @@
{
it('should return correct global cordinates of a point from within a displayObject', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();
+ const container = new PIXI.Container();
parent.addChild(container);
- var point = new PIXI.Point(100, 100);
+ const point = new PIXI.Point(100, 100);
- var globalPoint;
-
- globalPoint = container.toGlobal(point);
+ let globalPoint = container.toGlobal(point);
expect(globalPoint.x).to.equal(100);
expect(globalPoint.y).to.equal(100);
diff --git a/test/core/toLocal.js b/test/core/toLocal.js
index 781caeb..01b78d4 100644
--- a/test/core/toLocal.js
+++ b/test/core/toLocal.js
@@ -4,17 +4,15 @@
{
it('should return correct local cordinates of a displayObject', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();
+ const container = new PIXI.Container();
parent.addChild(container);
- var point = new PIXI.Point(100, 100);
+ const point = new PIXI.Point(100, 100);
- var localPoint;
-
- localPoint = container.toLocal(point);
+ let localPoint = container.toLocal(point);
expect(localPoint.x).to.equal(100);
expect(localPoint.y).to.equal(100);
@@ -33,10 +31,10 @@
it('should map the correct local cordinates of a displayObject to another', function ()
{
- var parent = new PIXI.Container();
+ const parent = new PIXI.Container();
- var container = new PIXI.Container();
- var container2 = new PIXI.Container();
+ const container = new PIXI.Container();
+ const container2 = new PIXI.Container();
parent.addChild(container);
parent.addChild(container2);
@@ -44,12 +42,12 @@
container2.position.x = 100;
container2.position.y = 100;
- var point = new PIXI.Point(100, 100);
+ const point = new PIXI.Point(100, 100);
container.scale.x = 2;
container.scale.y = 2;
- var localPoint = container.toLocal(point, container2);
+ const localPoint = container.toLocal(point, container2);
expect(localPoint.x).to.equal(100);
expect(localPoint.y).to.equal(100);
diff --git a/test/core/util.js b/test/core/util.js
index 45d424a..6f0686b 100755
--- a/test/core/util.js
+++ b/test/core/util.js
@@ -71,7 +71,7 @@
it('should decompose a data URI', function ()
{
- var dataUri = PIXI.utils.decomposeDataUri('data:image/png;base64,94Z9RWUN77ZW');
+ const dataUri = PIXI.utils.decomposeDataUri('data:image/png;base64,94Z9RWUN77ZW');
expect(dataUri)
.to.be.an('object');
@@ -87,7 +87,7 @@
it('should return undefined for anything else', function ()
{
- var dataUri = PIXI.utils.decomposeDataUri('foo');
+ const dataUri = PIXI.utils.decomposeDataUri('foo');
expect(dataUri)
.to.be.an('undefined');
@@ -96,7 +96,7 @@
describe('getUrlFileExtension', function ()
{
- it('should exist', function ()
+ it('should exist', () =>
{
expect(PIXI.utils.getUrlFileExtension)
.to.be.a('function');
@@ -104,7 +104,7 @@
it('should return extension of URL in lower case', function ()
{
- var imageType = PIXI.utils.getUrlFileExtension('http://foo.bar/baz.PNG');
+ const imageType = PIXI.utils.getUrlFileExtension('http://foo.bar/baz.PNG');
expect(imageType)
.to.equal('png');
@@ -112,7 +112,7 @@
it('should return extension of URL when absolute', function ()
{
- var imageType = PIXI.utils.getUrlFileExtension('/you/baz.PNG');
+ const imageType = PIXI.utils.getUrlFileExtension('/you/baz.PNG');
expect(imageType)
.to.equal('png');
@@ -120,7 +120,7 @@
it('should return extension of URL when relative', function ()
{
- var imageType = PIXI.utils.getUrlFileExtension('me/baz.PNG');
+ const imageType = PIXI.utils.getUrlFileExtension('me/baz.PNG');
expect(imageType)
.to.equal('png');
@@ -128,7 +128,7 @@
it('should return extension of URL when just an extension', function ()
{
- var imageType = PIXI.utils.getUrlFileExtension('.PNG');
+ const imageType = PIXI.utils.getUrlFileExtension('.PNG');
expect(imageType)
.to.equal('png');
@@ -136,7 +136,7 @@
it('should work with a hash on the url', function ()
{
- var imageType = PIXI.utils.getUrlFileExtension('http://foo.bar/baz.PNG#derp');
+ const imageType = PIXI.utils.getUrlFileExtension('http://foo.bar/baz.PNG#derp');
expect(imageType)
.to.equal('png');
@@ -144,7 +144,7 @@
it('should work with a hash path on the url', function ()
{
- var imageType = PIXI.utils.getUrlFileExtension('http://foo.bar/baz.PNG#derp/this/is/a/path/me.jpg');
+ const imageType = PIXI.utils.getUrlFileExtension('http://foo.bar/baz.PNG#derp/this/is/a/path/me.jpg');
expect(imageType)
.to.equal('png');
@@ -152,7 +152,7 @@
it('should work with a query string on the url', function ()
{
- var imageType = PIXI.utils.getUrlFileExtension('http://foo.bar/baz.PNG?v=1&file=me.jpg');
+ const imageType = PIXI.utils.getUrlFileExtension('http://foo.bar/baz.PNG?v=1&file=me.jpg');
expect(imageType)
.to.equal('png');
@@ -160,7 +160,7 @@
it('should work with a hash and query string on the url', function ()
{
- var imageType = PIXI.utils.getUrlFileExtension('http://foo.bar/baz.PNG?v=1&file=me.jpg#not-today');
+ const imageType = PIXI.utils.getUrlFileExtension('http://foo.bar/baz.PNG?v=1&file=me.jpg#not-today');
expect(imageType)
.to.equal('png');
@@ -168,7 +168,7 @@
it('should work with a hash path and query string on the url', function ()
{
- var imageType = PIXI.utils.getUrlFileExtension('http://foo.bar/baz.PNG?v=1&file=me.jpg#path/self/not-today.svg');
+ const imageType = PIXI.utils.getUrlFileExtension('http://foo.bar/baz.PNG?v=1&file=me.jpg#path/s/not-today.svg');
expect(imageType)
.to.equal('png');
@@ -185,7 +185,7 @@
it('should return a size object with width and height from an SVG string', function ()
{
- var svgSize = PIXI.utils.getSvgSize('');
+ const svgSize = PIXI.utils.getSvgSize('');
expect(svgSize)
.to.be.an('object');
@@ -209,7 +209,7 @@
it('should work with px values', function ()
{
- var svgSize = PIXI.utils.getSvgSize('');
+ const svgSize = PIXI.utils.getSvgSize('');
expect(svgSize)
.to.be.an('object');
@@ -221,7 +221,7 @@
it('should return an empty object when width and/or height is missing', function ()
{
- var svgSize = PIXI.utils.getSvgSize('');
+ const svgSize = PIXI.utils.getSvgSize('');
expect(Object.keys(svgSize).length)
.to.equal(0);
@@ -256,7 +256,7 @@
it('should return -1 for negative numbers', function ()
{
- for (var i = 0; i < 10; i += 1)
+ for (let i = 0; i < 10; i += 1)
{
expect(PIXI.utils.sign(-Math.random()))
.to.be.equal(-1);
@@ -265,7 +265,7 @@
it('should return 1 for positive numbers', function ()
{
- for (var i = 0; i < 10; i += 1)
+ for (let i = 0; i < 10; i += 1)
{
expect(PIXI.utils.sign(Math.random() + 0.000001))
.to.be.equal(1);
@@ -277,7 +277,7 @@
{
var arr;
- beforeEach(function ()
+ beforeEach(() =>
{
arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
});
@@ -296,7 +296,7 @@
it('should remove the number of elements specified from the array, starting from the start index', function ()
{
- var res = [1, 2, 3, 8, 9, 10];
+ const res = [1, 2, 3, 8, 9, 10];
PIXI.utils.removeItems(arr, 3, 4);
expect(arr).to.be.deep.equal(res);
@@ -304,7 +304,7 @@
it('should remove other elements if delete count is > than the number of elements after start index', function ()
{
- var res = [1, 2, 3, 4, 5, 6, 7];
+ const res = [1, 2, 3, 4, 5, 6, 7];
PIXI.utils.removeItems(arr, 7, 10);
expect(arr).to.be.deep.equal(res);
diff --git a/test/interaction/InteractionData.js b/test/interaction/InteractionData.js
index 7a5f94f..240ba4b 100755
--- a/test/interaction/InteractionData.js
+++ b/test/interaction/InteractionData.js
@@ -6,10 +6,10 @@
{
it('should populate second parameter with result', function ()
{
- var data = new PIXI.interaction.InteractionData();
- var stage = new PIXI.DisplayObject();
- var displayObject = new PIXI.DisplayObject();
- var point = new PIXI.Point();
+ const data = new PIXI.interaction.InteractionData();
+ const stage = new PIXI.DisplayObject();
+ const displayObject = new PIXI.DisplayObject();
+ const point = new PIXI.Point();
data.global.set(10, 10);
displayObject.position.set(5, 3);