aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/spec/sugar.js22
1 files changed, 20 insertions, 2 deletions
diff --git a/spec/spec/sugar.js b/spec/spec/sugar.js
index 2b9aa4c..0aef812 100644
--- a/spec/spec/sugar.js
+++ b/spec/spec/sugar.js
@@ -237,8 +237,26 @@ describe('Sugar', function() {
it('redirects to x() / y() with adding the current value', function() {
rect.dx(5)
rect.dy(5)
- expect(rect.x).toHaveBeenCalledWith(5, true)
- expect(rect.y).toHaveBeenCalledWith(5, true)
+ expect(rect.x).toHaveBeenCalledWith(jasmine.objectContaining(new SVG.Number('5')), true)
+ expect(rect.y).toHaveBeenCalledWith(jasmine.objectContaining(new SVG.Number('5')), true)
+ })
+
+ it('allows to add a percentage value', function() {
+ rect.move('5%', '5%')
+
+ rect.dx('5%')
+ rect.dy('5%')
+
+ expect(rect.x).toHaveBeenCalledWith(jasmine.objectContaining(new SVG.Number('10%')), true)
+ expect(rect.y).toHaveBeenCalledWith(jasmine.objectContaining(new SVG.Number('10%')), true)
+ })
+
+ it('allows to add a percentage value when no x/y is set', function() {
+ rect.dx('5%')
+ rect.dy('5%')
+
+ expect(rect.x).toHaveBeenCalledWith(jasmine.objectContaining(new SVG.Number('5%')), true)
+ expect(rect.y).toHaveBeenCalledWith(jasmine.objectContaining(new SVG.Number('5%')), true)
})
})