forked from enviPath/enviPy
Current Dev State
This commit is contained in:
44
static/js/ketcher2/node_modules/svg-pathdata/tests/transformer.mocha.js
generated
vendored
Normal file
44
static/js/ketcher2/node_modules/svg-pathdata/tests/transformer.mocha.js
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
var assert = (
|
||||
global && global.chai
|
||||
? global.chai.assert
|
||||
: require('chai').assert
|
||||
)
|
||||
, SVGPathData = (
|
||||
global && global.SVGPathData
|
||||
? global.SVGPathData
|
||||
: require(__dirname + '/../src/SVGPathData.js')
|
||||
)
|
||||
;
|
||||
|
||||
describe("SVGPathDataTransformer", function() {
|
||||
it("should fail with bad args", function() {
|
||||
assert.throws(function() {
|
||||
new SVGPathData.Transformer();
|
||||
}, 'Please provide a transform callback to receive commands.');
|
||||
});
|
||||
|
||||
it("should fail with bad transform function", function() {
|
||||
assert.throws(function() {
|
||||
new SVGPathData.Transformer(function() {});
|
||||
}, 'Please provide a valid transform (returning a function).');
|
||||
});
|
||||
|
||||
it("should still work when the new operator is forgotten", function() {
|
||||
assert.doesNotThrow(function() {
|
||||
SVGPathData.Transformer(SVGPathData.Transformer.SCALE, 1, 1);
|
||||
});
|
||||
});
|
||||
|
||||
it("should work in streaming mode", function() {
|
||||
var encoder = new SVGPathData.Transformer(SVGPathData.Transformer.SCALE, 1, 1);
|
||||
encoder.write({
|
||||
type: SVGPathData.Parser.LINE_TO,
|
||||
relative: true,
|
||||
x: 10,
|
||||
y: 10
|
||||
});
|
||||
encoder.end();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user