summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-11-08 12:34:31 +0100
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-11-08 12:34:31 +0100
commit6cafed8db9588c0b6b3b367aa822d9a0547e8e27 (patch)
treefed3675f7eb12ea39fd01e31942708a0f3f12554
parent6cebf3bf0e5d3cade7b0a7dc9c8feb191b2eb91f (diff)
downloadsvg.js-6cafed8db9588c0b6b3b367aa822d9a0547e8e27.tar.gz
svg.js-6cafed8db9588c0b6b3b367aa822d9a0547e8e27.zip
add test for array getter of attr
-rw-r--r--CHANGELOG.md1
-rw-r--r--spec/spec/element.js13
2 files changed, 14 insertions, 0 deletions
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)