diff options
author | wout <wout@impinc.co.uk> | 2014-06-21 22:30:49 +0200 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2014-06-21 22:30:49 +0200 |
commit | c168777a82c9dd81af36cb7f7d4948c148403ea0 (patch) | |
tree | f13880f41ceb4bc583b772886bf6ebb2fc4a9ad0 /spec | |
parent | 1953dbcdb44c6ae94e18501e8c1168e8fb8d71d8 (diff) | |
download | svg.js-c168777a82c9dd81af36cb7f7d4948c148403ea0.tar.gz svg.js-c168777a82c9dd81af36cb7f7d4948c148403ea0.zip |
Speccing adopter module
Diffstat (limited to 'spec')
-rwxr-xr-x | spec/index.html | 17 | ||||
-rw-r--r-- | spec/spec/adopter.js | 21 |
2 files changed, 38 insertions, 0 deletions
diff --git a/spec/index.html b/spec/index.html index 2dd41b2..7932214 100755 --- a/spec/index.html +++ b/spec/index.html @@ -19,6 +19,22 @@ </head> <body> + <svg height="0" width="0"> + <path id="lineAB" d="M 100 350 l 150 -300" stroke="red" stroke-width="3" fill="none" /> + <path id="lineBC" d="M 250 50 l 150 300" stroke="red" stroke-width="3" fill="none" /> + <path d="M 175 200 l 150 0" stroke="green" stroke-width="3" fill="none" /> + <path d="M 100 350 q 150 -300 300 0" stroke="blue" stroke-width="5" fill="none" /> + <g stroke="black" stroke-width="3" fill="black"> + <circle id="pointA" cx="100" cy="350" r="3" /> + <circle id="pointB" cx="250" cy="50" r="3" /> + <circle id="pointC" cx="400" cy="350" r="3" /> + </g> + <g font-size="30" font="sans-serif" fill="black" stroke="none" text-anchor="middle"> + <text x="100" y="350" dx="-30">A</text> + <text x="250" y="50" dy="-10">B</text> + <text x="400" y="350" dx="30">C</text> + </g> + </svg> </body> <script type="text/javascript" src="lib/jasmine-1.3.1/jasmine.js"></script> @@ -30,6 +46,7 @@ <!-- include spec files here... --> <script type="text/javascript" src="spec/svg.js"></script> <script type="text/javascript" src="spec/selector.js"></script> +<script type="text/javascript" src="spec/adopter.js"></script> <script type="text/javascript" src="spec/regex.js"></script> <script type="text/javascript" src="spec/container.js"></script> <script type="text/javascript" src="spec/element.js"></script> diff --git a/spec/spec/adopter.js b/spec/spec/adopter.js new file mode 100644 index 0000000..efdb806 --- /dev/null +++ b/spec/spec/adopter.js @@ -0,0 +1,21 @@ +describe('Adopter', function() { + var path + + beforeEach(function() { + path = SVG.get('lineAB') + }) + + it('adopts an exiting path element', function() { + expect(path instanceof SVG.Path).toBe(true) + }) + + it('modifies an adopted element', function() { + path.fill('#f06') + expect(path.node.getAttribute('fill')).toBe('#ff0066') + }) + + it('adopts a parent when parent() method is called', function() { + expect(path.parent() instanceof SVG.Doc).toBe(true) + }) + +})
\ No newline at end of file |