summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2017-03-01 22:20:46 +0100
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2017-03-01 22:20:46 +0100
commitf6d15b07cff5be7cefea62ea874f2e7361108253 (patch)
tree59fa043819fca0789f6b63657c399ad29240edcc /spec
parent5a6a9148f84928980dfc0756fe6a36ef0f57481d (diff)
downloadsvg.js-f6d15b07cff5be7cefea62ea874f2e7361108253.tar.gz
svg.js-f6d15b07cff5be7cefea62ea874f2e7361108253.zip
added test cases to increase code coverage
Diffstat (limited to 'spec')
-rw-r--r--spec/spec/element.js9
-rw-r--r--spec/spec/fx.js16
2 files changed, 12 insertions, 13 deletions
diff --git a/spec/spec/element.js b/spec/spec/element.js
index 35f62b5..378505f 100644
--- a/spec/spec/element.js
+++ b/spec/spec/element.js
@@ -206,6 +206,15 @@ describe('Element', function() {
rect.transform({ scale: 3 })
expect(rect.node.getAttribute('transform')).toBe('matrix(3,0,0,3,-100,-100)')
})
+ it('also works with only skaleX', function() {
+ rect.transform({ scaleX: 3 })
+ expect(rect.node.getAttribute('transform')).toBe('matrix(3,0,0,1,-100,0)')
+ })
+ it('also works with only skaleY', function() {
+ rect.transform({ scaleY: 3 })
+ expect(rect.node.getAttribute('transform')).toBe('matrix(1,0,0,3,0,-100)')
+ })
+
it('performs an absolute scale by default', function() {
rect.transform({ scale: 3 }).transform({ scale: 0.5 })
expect(rect.node.getAttribute('transform')).toBe('matrix(0.5,0,0,0.5,25,25)')
diff --git a/spec/spec/fx.js b/spec/spec/fx.js
index 1c5fb16..a1106cb 100644
--- a/spec/spec/fx.js
+++ b/spec/spec/fx.js
@@ -903,15 +903,9 @@ describe('FX', function() {
it('toggles the direction of the animation without a parameter', function() {
expect(fx.reverse().situation.reversed).toBe(true)
})
- })
-
- describe('reverse()', function() {
it('sets the direction to backwards with true given', function() {
expect(fx.reverse(true).situation.reversed).toBe(true)
})
- })
-
- describe('reverse()', function() {
it('sets the direction to forwards with false given', function() {
expect(fx.reverse(false).situation.reversed).toBe(false)
})
@@ -1006,9 +1000,6 @@ describe('FX', function() {
expect(fx.active).toBe(false)
expect(fx.situations.length).toBe(1)
})
- })
-
- describe('stop()', function() {
it('stops the animation immediately and fullfill it if first parameter true', function() {
fx.animate(500).start()
expect(fx.stop(true).situation).toBeNull()
@@ -1016,9 +1007,6 @@ describe('FX', function() {
expect(fx.pos).toBe(1)
expect(fx.situations.length).toBe(1)
})
- })
-
- describe('stop()', function() {
it('stops the animation immediately and remove all items from queue when second parameter true', function() {
fx.animate(500).start()
expect(fx.stop(false, true).situation).toBeNull()
@@ -1715,7 +1703,6 @@ describe('FX', function() {
expect(called).toBe(true)
})
-
it('animates matrix', function() {
var ctm, called = false
@@ -2459,6 +2446,9 @@ describe('FX', function() {
})
describe('transform()', function() {
+ it('returns itself when no valid transformation was found', function() {
+ expect(fx.transform({})).toBe(fx)
+ })
it('gets the current transforms', function() {
expect(fx.transform()).toEqual(new SVG.Matrix(rect).extract())
})