summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2013-07-22 13:52:20 +0100
committerwout <wout@impinc.co.uk>2013-07-22 13:52:20 +0100
commit9773661d9321927b5b86feef007fabba68eccf32 (patch)
treea45461b0a574017f6b6933b1ae2a73233e711e8f /spec
parentf5c28a74a55501982d5c76d4155170f569937465 (diff)
downloadsvg.js-9773661d9321927b5b86feef007fabba68eccf32.tar.gz
svg.js-9773661d9321927b5b86feef007fabba68eccf32.zip
Namespace fixes and added textPath and bumped to v0.270.28
Diffstat (limited to 'spec')
-rw-r--r--spec/index.html1
-rw-r--r--spec/spec/textpath.js34
-rw-r--r--spec/spec/use.js2
3 files changed, 36 insertions, 1 deletions
diff --git a/spec/index.html b/spec/index.html
index 7411d9c..c1e4c25 100644
--- a/spec/index.html
+++ b/spec/index.html
@@ -42,6 +42,7 @@
<script type="text/javascript" src="spec/path.js"></script>
<script type="text/javascript" src="spec/image.js"></script>
<script type="text/javascript" src="spec/text.js"></script>
+<script type="text/javascript" src="spec/textpath.js"></script>
<script type="text/javascript" src="spec/doc.js"></script>
<script type="text/javascript" src="spec/group.js"></script>
<script type="text/javascript" src="spec/set.js"></script>
diff --git a/spec/spec/textpath.js b/spec/spec/textpath.js
new file mode 100644
index 0000000..4645e37
--- /dev/null
+++ b/spec/spec/textpath.js
@@ -0,0 +1,34 @@
+describe('TextPath', function() {
+ var text
+ , data = 'M 100 200 C 200 100 300 0 400 100 C 500 200 600 300 700 200 C 800 100 900 100 900 100'
+
+ beforeEach(function() {
+ text = draw.text('We go up, then we go down, then up again')
+ })
+
+ afterEach(function() {
+ draw.clear()
+ })
+
+ describe('path()', function() {
+ it('returns the text element', function() {
+ expect(text.path(data)).toBe(text)
+ })
+ it('stores a reference to the path', function() {
+ expect(text.path(data).track instanceof SVG.Path).toBe(true)
+ })
+ it('creates a textPath node in th text element', function() {
+ text.path(data)
+ expect(text.node.firstChild.nodeName).toBe('textPath')
+ })
+ it('stores a reference to the textPath', function() {
+ expect(text.path(data).textPath instanceof SVG.TextPath).toBe(true)
+ })
+ it('creates a plot() method on the text object', function() {
+ expect(typeof text.plot).toBe('undefined')
+ text.path(data)
+ expect(typeof text.plot).toBe('function')
+ })
+ })
+
+}) \ No newline at end of file
diff --git a/spec/spec/use.js b/spec/spec/use.js
index 5a6bbd6..ed0d567 100644
--- a/spec/spec/use.js
+++ b/spec/spec/use.js
@@ -11,7 +11,7 @@ describe('Use', function() {
})
it('sets the target element id to its href attribute', function() {
- expect(use.attr('xlink:href')).toBe('#' + rect)
+ expect(use.node.getAttributeNS(SVG.xlink, 'href')).toBe('#' + rect)
})
it('stores a reference to the target element', function() {