From 6cafed8db9588c0b6b3b367aa822d9a0547e8e27 Mon Sep 17 00:00:00 2001 From: Ulrich-Matthias Schäfer Date: Thu, 8 Nov 2018 12:34:31 +0100 Subject: add test for array getter of attr --- CHANGELOG.md | 1 + spec/spec/element.js | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 695052f..7e4a8cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -77,6 +77,7 @@ The document follows the conventions described in [“Keep a CHANGELOG”](http: - `ungroup()` now breaks off one container and not more - `clone()` does not add the clone to the dom anymore - `SVG.Text.textPath()` returns only the first textpath child +- `attr()` excepts array now to get multiple values at once ### Fixed - fixed a bug in clipping and masking where empty nodes persists after removal -> __TODO!__ diff --git a/spec/spec/element.js b/spec/spec/element.js index 07fe624..6ac74c4 100644 --- a/spec/spec/element.js +++ b/spec/spec/element.js @@ -93,6 +93,19 @@ describe('Element', function() { rect.attr('x', '69%') expect(rect.attr().x).toBe('69%') }) + it('acts as getter for an array of values passed', function () { + rect.attr({ + x: 1, + y: 2, + width: 20, + "fill-opacity": 0.5 + }) + + expect(rect.attr(["x", "fill-opacity"])).toEqual(jasmine.objectContaining({ + x: 1, + "fill-opacity": 0.5 + })) + }) it('creates an image in defs when image path is specified for fill', function() { rect.attr('fill', imageUrl) expect(draw.defs().find('pattern').length).toBe(1) -- cgit v1.2.3