Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BREAKING changing objectCaching #5567

Merged
merged 10 commits into from
Mar 16, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
added test for hasStroke and hasFill
asturur committed Mar 16, 2019
commit 3a3460a84cd932469d79c9042afa1aec4dcb6337
19 changes: 19 additions & 0 deletions test/unit/object.js
Original file line number Diff line number Diff line change
@@ -1321,4 +1321,23 @@
object.shadow = {};
assert.equal(object.needsItsOwnCache(), false, 'if stroke first will return false if no fill');
});
QUnit.test('hasStroke', function(assert) {
var object = new fabric.Object({ fill: 'blue', width: 100, height: 100, strokeWidth: 3, stroke: 'black' });
assert.equal(object.hasStroke(), true, 'if strokeWidth is present and stroke is black hasStroke is true');
object.stroke = '';
assert.equal(object.hasStroke(), false, 'if strokeWidth is present and stroke is empty string hasStroke is false');
object.stroke = 'transparent';
assert.equal(object.hasStroke(), false, 'if strokeWidth is present and stroke is transparent hasStroke is false');
object.stroke = 'black';
object.strokeWidth = 0;
assert.equal(object.hasStroke(), false, 'if strokeWidth is 0 and stroke is a color hasStroke is false');
});
QUnit.test('hasFill', function(assert) {
var object = new fabric.Object({ fill: 'blue', width: 100, height: 100 });
assert.equal(object.hasFill(), true, 'with a color that is not transparent, hasFill is true');
object.fill = '';
assert.equal(object.hasFill(), false, 'without a color, hasFill is false');
object.fill = 'transparent';
assert.equal(object.hasFill(), false, 'with a color that is transparent, hasFill is true');
});
})();