aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2014-01-23 21:18:43 +0100
committerwout <wout@impinc.co.uk>2014-01-23 21:18:43 +0100
commitaaaf8f1f3ee676e5733f50114aff5717481f3bcf (patch)
tree3371202c48a76d02e01267114c14f7f65ad47e96 /spec
parent820b56214181b561212e2b7ef2a3c636bcb836c8 (diff)
downloadsvg.js-aaaf8f1f3ee676e5733f50114aff5717481f3bcf.tar.gz
svg.js-aaaf8f1f3ee676e5733f50114aff5717481f3bcf.zip
Added the hyperlink element
Diffstat (limited to 'spec')
-rw-r--r--spec/index.html1
-rw-r--r--spec/spec/hyperlink.js39
2 files changed, 40 insertions, 0 deletions
diff --git a/spec/index.html b/spec/index.html
index 7ea6f56..b5e4d99 100644
--- a/spec/index.html
+++ b/spec/index.html
@@ -53,6 +53,7 @@
<script type="text/javascript" src="spec/color.js"></script>
<script type="text/javascript" src="spec/number.js"></script>
<script type="text/javascript" src="spec/array.js"></script>
+<script type="text/javascript" src="spec/hyperlink.js"></script>
<script type="text/javascript">
(function() {
diff --git a/spec/spec/hyperlink.js b/spec/spec/hyperlink.js
new file mode 100644
index 0000000..1449f76
--- /dev/null
+++ b/spec/spec/hyperlink.js
@@ -0,0 +1,39 @@
+describe('Hyperlink', function() {
+ var link
+ , url = 'http://svgjs.com'
+
+ beforeEach(function() {
+ link = draw.link(url)
+ link.rect(100,100)
+ })
+
+ afterEach(function() {
+ draw.clear()
+ })
+
+ it('creates a link', function() {
+ expect(link.attr('href')).toBe(url)
+ })
+
+ describe('to()', function() {
+ it('creates xlink:href attribute', function() {
+ link.to('http://apple.com')
+ expect(link.attr('href')).toBe('http://apple.com')
+ })
+ })
+
+ describe('show()', function() {
+ it('creates xlink:show attribute', function() {
+ link.show('replace')
+ expect(link.attr('show')).toBe('replace')
+ })
+ })
+
+ describe('target()', function() {
+ it('creates target attribute', function() {
+ link.target('_blank')
+ expect(link.attr('target')).toBe('_blank')
+ })
+ })
+
+}) \ No newline at end of file