Skip to content

Commit

Permalink
Added tests for recent changes from contributors (#5697)
Browse files Browse the repository at this point in the history
  • Loading branch information
asturur authored May 19, 2019
1 parent 4f972cf commit 05591f2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/unit/canvas_static.js
Original file line number Diff line number Diff line change
Expand Up @@ -1257,6 +1257,16 @@
});
});

QUnit.test('loadFromJSON with clipPath', function(assert) {
var done = assert.async();
var json = '{"clipPath": {"type":"text","left":150,"top":200,"width":128,"height":64.32,"fill":"#000000","stroke":"","strokeWidth":"","scaleX":0.8,"scaleY":0.8,"angle":0,"flipX":false,"flipY":false,"opacity":1,"text":"NAME HERE","fontSize":24,"fontWeight":"","fontFamily":"Delicious_500","fontStyle":"","lineHeight":"","textDecoration":"","textAlign":"center","path":"","strokeStyle":"","backgroundColor":""}}';
canvas.loadFromJSON(json, function() {
canvas.renderAll();
assert.equal('text', canvas.clipPath.type);
done();
});
});

QUnit.test('sendToBack', function(assert) {
assert.ok(typeof canvas.sendToBack === 'function');

Expand Down
15 changes: 15 additions & 0 deletions test/unit/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,21 @@
}, 1000);
});

QUnit.test('on off fire are chainable', function(assert) {
var object = new fabric.Object({ left: 20, top: 30, width: 40, height: 50, angle: 43 });
var ret;
ret = object.fire('');
assert.equal(ret, object, 'fire is chainable when no events are registered at all');
ret = object.on('hi', function() {});
assert.equal(ret, object, 'on is chainable');
ret = object.fire('bye');
assert.equal(ret, object, 'fire is chainable when firing a non registerd event');
ret = object.fire('hi');
assert.equal(ret, object, 'fire is chainable when firing a registerd event');
ret = object.off('hi');
assert.equal(ret, object, 'off is chainable');
});

QUnit.test('observable', function(assert) {
var object = new fabric.Object({ left: 20, top: 30, width: 40, height: 50, angle: 43 });

Expand Down

0 comments on commit 05591f2

Please sign in to comment.