diff --git a/package.json b/package.json index c18d8116..4f9e98e2 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "start": "npm run test:watch", "compile": "npm run clean && npm run tsc && cp ./src/index-types.d.ts ./lib/index-types.d.ts && npm run rollup", "build": "npm run compile && cp ./src/index-types.d.ts ./lib && gulp build && node ./rename-imports.mjs", - "test:import": "npm run build && node ./test/import-test.cjs &&node ./test/import-test.mjs", + "test:import": "npm run build && node ./test/import-test.cjs && node ./test/import-test.mjs", "test": "npm run test:browser && npm run test:node", "test:build": "parcel build ./test/unit-tests.html --dist-dir ./test-build --target none --public-url ./ --no-source-maps", "test:browser": "npm run test:build && mocha-headless-chrome -f ./test-build/unit-tests.html -a disable-web-security -a no-sandbox", diff --git a/test/unit/Image-test.ts b/test/unit/Image-test.ts index be9c9516..34ac6d87 100644 --- a/test/unit/Image-test.ts +++ b/test/unit/Image-test.ts @@ -107,17 +107,10 @@ describe('Image', function () { var trace = layer.getContext().getTrace(); - if (isBrowser) { - assert.equal( - trace, - 'clearRect(0,0,578,200);save();transform(1,0,0,1,150,30);drawImage([object HTMLImageElement],135,7,167,134,0,0,100,100);restore();clearRect(0,0,578,200);save();transform(1,0,0,1,150,30);drawImage([object HTMLImageElement],135,7,167,134,0,0,200,100);restore();clearRect(0,0,578,200);save();transform(1,0,0,1,150,30);drawImage([object HTMLImageElement],135,7,167,134,0,0,100,100);restore();' - ); - } else { - assert.equal( - trace, - 'clearRect(0,0,578,200);save();transform(1,0,0,1,150,30);drawImage([object Object],135,7,167,134,0,0,100,100);restore();clearRect(0,0,578,200);save();transform(1,0,0,1,150,30);drawImage([object Object],135,7,167,134,0,0,200,100);restore();clearRect(0,0,578,200);save();transform(1,0,0,1,150,30);drawImage([object Object],135,7,167,134,0,0,100,100);restore();' - ); - } + assert.equal( + trace, + 'clearRect(0,0,578,200);save();transform(1,0,0,1,150,30);drawImage([object HTMLImageElement],135,7,167,134,0,0,100,100);restore();clearRect(0,0,578,200);save();transform(1,0,0,1,150,30);drawImage([object HTMLImageElement],135,7,167,134,0,0,200,100);restore();clearRect(0,0,578,200);save();transform(1,0,0,1,150,30);drawImage([object HTMLImageElement],135,7,167,134,0,0,100,100);restore();' + ); done(); }); @@ -241,17 +234,10 @@ describe('Image', function () { var trace = layer.getContext().getTrace(); - if (isBrowser) { - assert.equal( - trace, - 'clearRect(0,0,578,200);save();transform(1,0,0,1,150,30);globalAlpha=0.5;shadowColor=rgba(0,0,0,0.1);shadowBlur=10;shadowOffsetX=20;shadowOffsetY=20;drawImage([object HTMLImageElement],0,0,100,100);restore();' - ); - } else { - assert.equal( - trace, - 'clearRect(0,0,578,200);save();transform(1,0,0,1,150,30);globalAlpha=0.5;shadowColor=rgba(0,0,0,0.1);shadowBlur=10;shadowOffsetX=20;shadowOffsetY=20;drawImage([object Object],0,0,100,100);restore();' - ); - } + assert.equal( + trace, + 'clearRect(0,0,578,200);save();transform(1,0,0,1,150,30);globalAlpha=0.5;shadowColor=rgba(0,0,0,0.1);shadowBlur=10;shadowOffsetX=20;shadowOffsetY=20;drawImage([object HTMLImageElement],0,0,100,100);restore();' + ); done(); }); @@ -285,17 +271,10 @@ describe('Image', function () { var trace = layer.getContext().getTrace(); - if (isBrowser) { - assert.equal( - trace, - 'clearRect(0,0,578,200);save();shadowColor=rgba(0,0,0,0.5);shadowBlur=10;shadowOffsetX=20;shadowOffsetY=20;globalAlpha=0.5;drawImage([object HTMLCanvasElement],0,0,578,200);restore();' - ); - } else { - assert.equal( - trace, - 'clearRect(0,0,578,200);save();shadowColor=rgba(0,0,0,0.5);shadowBlur=10;shadowOffsetX=20;shadowOffsetY=20;globalAlpha=0.5;drawImage([object Object],0,0,578,200);restore();' - ); - } + assert.equal( + trace, + 'clearRect(0,0,578,200);save();shadowColor=rgba(0,0,0,0.5);shadowBlur=10;shadowOffsetX=20;shadowOffsetY=20;globalAlpha=0.5;drawImage([object HTMLCanvasElement],0,0,578,200);restore();' + ); done(); }); diff --git a/test/unit/Node-test.ts b/test/unit/Node-test.ts index 599254b6..0fe1921c 100644 --- a/test/unit/Node-test.ts +++ b/test/unit/Node-test.ts @@ -2296,17 +2296,10 @@ describe('Node', function () { var bufferTrace = stage.bufferCanvas.getContext().getTrace(); - if (isBrowser) { - assert.equal( - sceneTrace, - 'clearRect(0,0,578,200);save();globalAlpha=0.5;drawImage([object HTMLCanvasElement],0,0,578,200);restore();' - ); - } else { - assert.equal( - sceneTrace, - 'clearRect(0,0,578,200);save();globalAlpha=0.5;drawImage([object Object],0,0,578,200);restore();' - ); - } + assert.equal( + sceneTrace, + 'clearRect(0,0,578,200);save();globalAlpha=0.5;drawImage([object HTMLCanvasElement],0,0,578,200);restore();' + ); assert.equal( bufferTrace,