diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/index.html | 1 | ||||
-rw-r--r-- | spec/spec/hyperlink.js | 39 |
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 |