mirror of
https://github.com/konvajs/konva.git
synced 2025-04-05 03:13:41 +08:00
fix tests in node.js
This commit is contained in:
parent
a94b63f3ec
commit
c23e8f9b6b
@ -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",
|
||||
|
@ -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();
|
||||
});
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user