summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--spec/spec/fx.js16
-rw-r--r--src/fx.js8
2 files changed, 24 insertions, 0 deletions
diff --git a/spec/spec/fx.js b/spec/spec/fx.js
index edf2081..17fbcc8 100644
--- a/spec/spec/fx.js
+++ b/spec/spec/fx.js
@@ -2556,6 +2556,22 @@ describe('FX', function() {
expect(fx.add).toHaveBeenCalledWith('height', jasmine.objectContaining({value:60}))
})
})
+
+ describe('width()', function() {
+ it('should set width with add()', function() {
+ spyOn(fx, 'add').and.callThrough()
+ fx.width(20)
+ expect(fx.add).toHaveBeenCalledWith('width', jasmine.objectContaining({value:20}))
+ })
+ })
+
+ describe('height()', function() {
+ it('should set height with add()', function() {
+ spyOn(fx, 'add').and.callThrough()
+ fx.height(20)
+ expect(fx.add).toHaveBeenCalledWith('height', jasmine.objectContaining({value:20}))
+ })
+ })
describe('plot()', function() {
it('should call add with plot as method', function() {
diff --git a/src/fx.js b/src/fx.js
index 3d8d6fe..36535b1 100644
--- a/src/fx.js
+++ b/src/fx.js
@@ -862,6 +862,14 @@ SVG.extend(SVG.FX, {
return this
}
+ // Add animatable width
+, width: function(width) {
+ return this.add('width', new SVG.Number(width))
+ }
+ // Add animatable height
+, height: function(height) {
+ return this.add('height', new SVG.Number(height))
+ }
// Add animatable plot
, plot: function(a, b, c, d) {
// Lines can be plotted with 4 arguments