Test and lint fixes.

This commit is contained in:
Karishma Chadha committed 2018-05-16 16:00:50 -04:00
1 parent 67b114b9c9
commit e2ce047fa1
3 files changed
+10 -4

No files matched your search

+2
View File
@@ -156,6 +156,8 @@ class RenderedTarget extends Target {
/**
* Create a drawable with the this.renderer.
* @param {boolean} isStage Whether the drawable should be initialized as
* the stage or a sprite
*/
initDrawable (isStage) {
if (this.renderer) {
+3 -1
View File
@@ -42,7 +42,7 @@ FakeRenderer.prototype.getBounds = function (d) { // eslint-disable-line no-unus
return {left: this.x, right: this.x, top: this.y, bottom: this.y};
};
FakeRenderer.prototype.setDrawableOrder = function (d, a, optA, optB) { // eslint-disable-line no-unused-vars
FakeRenderer.prototype.setDrawableOrder = function (d, a, optG, optA, optB) { // eslint-disable-line no-unused-vars
if (d === 999) return 1; // fake for test case
if (optA) {
a += this.order;
@@ -63,4 +63,6 @@ FakeRenderer.prototype.isTouchingColor = function (a, b) { // eslint-disable-lin
return false;
};
FakeRenderer.prototype.setLayerGroupOrdering = function (a) {}; // eslint-disable-line no-unused-vars
module.exports = FakeRenderer;
+5 -3
View File
@@ -302,7 +302,7 @@ test('colorIsTouchingColor', t => {
t.end();
});
test('layers', t => {
test('layers', t => { // TODO this tests fake functionality. Move layering tests into Render.
const s = new Sprite();
const r = new Runtime();
const renderer = new FakeRenderer();
@@ -315,9 +315,11 @@ test('layers', t => {
a.goBackwardLayers(2);
t.equals(a.renderer.order, 3);
a.goToBack();
t.equals(a.renderer.order, 1);
// Note, there are only sprites in this test, no stage, and the addition
// of layer groups, goToBack no longer specifies a minimum order number
t.equals(a.renderer.order, 0);
a.goForwardLayers(1);
t.equals(a.renderer.order, 2);
t.equals(a.renderer.order, 1);
o.drawableID = 999;
a.goBehindOther(o);
t.equals(a.renderer.order, 1);