summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2017-03-10 14:57:00 +0100
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2017-03-10 14:57:00 +0100
commit3409a2150705f679238300c56c05ea144e9ad7bd (patch)
treefbe8d57ca2ba41f46ae99b4f23a8193990205300 /spec
parentc4d93783496e9a3e67c157d63c4a94dc654120bf (diff)
downloadsvg.js-3409a2150705f679238300c56c05ea144e9ad7bd.tar.gz
svg.js-3409a2150705f679238300c56c05ea144e9ad7bd.zip
update specs, fix mistakes, include flatten.js to dist
Diffstat (limited to 'spec')
-rw-r--r--spec/spec/clip.js12
-rw-r--r--spec/spec/element.js20
-rw-r--r--spec/spec/mask.js12
-rw-r--r--spec/spec/path.js2
4 files changed, 19 insertions, 27 deletions
diff --git a/spec/spec/clip.js b/spec/spec/clip.js
index c641c4c..43936bc 100644
--- a/spec/spec/clip.js
+++ b/spec/spec/clip.js
@@ -24,20 +24,20 @@ describe('ClipPath', function() {
})
it('references the clip element in the masked element', function() {
- expect(rect.clipper).toBe(circle.parent())
+ expect(rect.clipper()).toBe(circle.parent())
})
it('references the clipped element in the clipPath target list', function() {
- expect(rect.clipper.targets.indexOf(rect) > -1).toBe(true)
+ expect(rect.clipper().targets().index(rect) > -1).toBe(true)
})
it('reuses clip element when clip was given', function() {
- var clip = rect.clipper
- expect(draw.rect(100,100).clipWith(clip).clipper).toBe(clip)
+ var clip = rect.clipper()
+ expect(draw.rect(100,100).clipWith(clip).clipper()).toBe(clip)
})
it('unclips all clipped elements when being removed', function() {
- rect.clipper.remove()
+ rect.clipper().remove()
expect(rect.attr('clip-path')).toBe(undefined)
})
@@ -50,7 +50,7 @@ describe('ClipPath', function() {
it('removes the reference to the clipping element', function() {
rect.unclip()
- expect(rect.clipper).toBe(undefined)
+ expect(rect.clipper()).toBe(null)
})
it('returns the clipPath element', function() {
diff --git a/spec/spec/element.js b/spec/spec/element.js
index e20d69e..7f7cd95 100644
--- a/spec/spec/element.js
+++ b/spec/spec/element.js
@@ -422,7 +422,7 @@ describe('Element', function() {
})
})
- describe('ungroup()', function() {
+ describe('flatten()', function() {
var nested, g1, g2, rect1
beforeEach(function() {
@@ -439,12 +439,12 @@ describe('Element', function() {
})
it('returns itself when depths is 0 or this is SVG.Defs', function() {
- expect(draw.defs().ungroup()).toBe(draw.defs())
- expect(g1.ungroup(null, 0)).toBe(g1)
+ expect(draw.defs().flatten()).toBe(draw.defs())
+ expect(g1.flatten(null, 0)).toBe(g1)
})
it('breaks up all container and move the elements to the parent', function() {
- g1.ungroup()
+ g1.flatten()
expect(rect1.parent()).toBe(nested)
expect(rect2.parent()).toBe(nested)
@@ -459,8 +459,8 @@ describe('Element', function() {
}))
})
- it('ungroups everything to the doc root when called on SVG.Doc / does not ungroup defs', function() {
- draw.ungroup()
+ it('ungroups everything to the doc root when called on SVG.Doc / does not flatten defs', function() {
+ draw.flatten()
expect(rect1.parent()).toBe(draw)
expect(rect2.parent()).toBe(draw)
@@ -478,14 +478,6 @@ describe('Element', function() {
expect(draw.children().length).toBe(3) // 2 * rect + defs
})
})
-
- describe('flatten()', function() {
- it('redirects the call to ungroup()', function() {
- spyOn(draw, 'ungroup')
- draw.flatten()
- expect(draw.ungroup).toHaveBeenCalled()
- })
- })
describe('ctm()', function() {
var rect
diff --git a/spec/spec/mask.js b/spec/spec/mask.js
index a7cd6d1..10fadcd 100644
--- a/spec/spec/mask.js
+++ b/spec/spec/mask.js
@@ -24,20 +24,20 @@ describe('Mask', function() {
})
it('references the mask element in the masked element', function() {
- expect(rect.masker).toBe(circle.parent())
+ expect(rect.masker()).toBe(circle.parent())
})
it('references the masked element in the mask target list', function() {
- expect(rect.masker.targets.indexOf(rect) > -1).toBe(true)
+ expect(rect.masker().targets().index(rect) > -1).toBe(true)
})
it('reuses mask element when mask was given', function() {
- var mask = rect.masker
- expect(draw.rect(100,100).maskWith(mask).masker).toBe(mask)
+ var mask = rect.masker()
+ expect(draw.rect(100,100).maskWith(mask).masker()).toBe(mask)
})
it('unmasks all masked elements when being removed', function() {
- rect.masker.remove()
+ rect.masker().remove()
expect(rect.attr('mask')).toBe(undefined)
})
@@ -50,7 +50,7 @@ describe('Mask', function() {
it('removes the reference to the masking element', function() {
rect.unmask()
- expect(rect.masker).toBe(undefined)
+ expect(rect.masker()).toBe(null)
})
it('returns the element itslef', function() {
diff --git a/spec/spec/path.js b/spec/spec/path.js
index 86db90d..e458b63 100644
--- a/spec/spec/path.js
+++ b/spec/spec/path.js
@@ -224,7 +224,7 @@ describe('Path', function() {
describe('pointAt()', function() {
it('gets a point at given length', function() {
- expect(path.pointAt(100)).toEqual(path.node.getPointAtLength(100))
+ expect(path.pointAt(100)).toEqual(new SVG.Point(path.node.getPointAtLength(100)))
})
})
})