mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-14 00:33:09 +00:00
fabric.Polygon.fromElement() shouldn't throw an error.
It can just return `null`.
This commit is contained in:
parent
818ab118b3
commit
9b74583532
1 changed files with 6 additions and 8 deletions
|
|
@ -128,14 +128,12 @@
|
|||
|
||||
var elPolygonWithoutPoints = fabric.document.createElement('polygon');
|
||||
|
||||
var error;
|
||||
try {
|
||||
fabric.Polygon.fromElement(elPolygonWithoutPoints);
|
||||
}
|
||||
catch(err) {
|
||||
error = err;
|
||||
}
|
||||
ok(error, 'missing points attribute should result in error');
|
||||
equal(fabric.Polygon.fromElement(elPolygonWithoutPoints), null);
|
||||
|
||||
var elPolygonWithEmptyPoints = fabric.document.createElement('polygon');
|
||||
elPolygonWithEmptyPoints.setAttribute('points', '');
|
||||
|
||||
equal(fabric.Polygon.fromElement(elPolygonWithEmptyPoints), null);
|
||||
|
||||
equal(fabric.Polygon.fromElement(), null);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue