diff options
author | wout <wout@impinc.co.uk> | 2013-06-09 11:37:26 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2013-06-09 11:37:26 +0100 |
commit | 8f03d84e43681ecca20ac028071e51a2e2bbc0c8 (patch) | |
tree | f5c11dc6c429e8459c20731ba775fa6ca794400f /spec | |
parent | ec75128ec31aa055aca2ae7f95ad4f5cf38d12e0 (diff) | |
download | svg.js-8f03d84e43681ecca20ac028071e51a2e2bbc0c8.tar.gz svg.js-8f03d84e43681ecca20ac028071e51a2e2bbc0c8.zip |
Added deep traversing, reorganizd modules
Diffstat (limited to 'spec')
-rw-r--r-- | spec/spec/color.js | 4 | ||||
-rw-r--r-- | spec/spec/container.js | 17 | ||||
-rw-r--r-- | spec/spec/gradient.js | 4 |
3 files changed, 23 insertions, 2 deletions
diff --git a/spec/spec/color.js b/spec/spec/color.js index 0b510c3..1980600 100644 --- a/spec/spec/color.js +++ b/spec/spec/color.js @@ -7,14 +7,14 @@ describe('Color', function() { expect(color.b).toBe(128) }) - it('should correclty parse a 3-based hex string', function() { + it('should correclty parse a 3 digit hex string', function() { var color = new SVG.Color('#f06') expect(color.r).toBe(255) expect(color.g).toBe(0) expect(color.b).toBe(102) }) - it('should correclty parse a 6-based hex string', function() { + it('should correclty parse a 6 digit hex string', function() { var color = new SVG.Color('#0066ff') expect(color.r).toBe(0) expect(color.g).toBe(102) diff --git a/spec/spec/container.js b/spec/spec/container.js index 24feb00..217e2e2 100644 --- a/spec/spec/container.js +++ b/spec/spec/container.js @@ -225,6 +225,23 @@ describe('Container', function() { expect(children).toEqual(group.children()) }) + it('should traverse recursively when set to deep', function() { + var children = [] + , group = draw.group() + + draw.rect(100,200) + draw.circle(300) + + group.rect(100,100) + group.ellipse(100, 100) + group.polygon() + + draw.each(function() { + children.push(this) + }, true) + + expect(children.length).toEqual(draw.children().length + group.children().length) + }) }) describe('viewbox()', function() { diff --git a/spec/spec/gradient.js b/spec/spec/gradient.js index db16e92..f07a7e8 100644 --- a/spec/spec/gradient.js +++ b/spec/spec/gradient.js @@ -13,6 +13,10 @@ describe('Gradient', function() { it('should return the id of the gradient wrapped in url()', function() { expect(gradient.fill()).toBe('url(#' + gradient.attr('id') + ')') }) + it('should be called when instance is passed as an attribute value', function() { + rect.attr('fill', gradient) + expect(rect.attr('fill')).toBe('url(#' + gradient.attr('id') + ')') + }) }) })
\ No newline at end of file |