diff options
-rwxr-xr-x | CHANGELOG.md | 2 | ||||
-rwxr-xr-x | dist/svg.js | 2 | ||||
-rwxr-xr-x | spec/index.html | 17 | ||||
-rw-r--r-- | spec/spec/adopter.js | 21 |
4 files changed, 40 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 06e4d5c..2454b6b 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ - added support to clone manually built text elements -> __TODO!__ - using `CustomEvent` instead of `Event` to be able to fire events with a `detail` object [thanks @Fuzzyma] - added polyfill for IE9 and IE10 custom events [thanks @Fuzzyma] -- added DOM query selector with the `select()` method on parent elements +- added DOM query selector with the `select()` method globally or on parent elements # 1.0.0-rc.9 (17/06/2014) diff --git a/dist/svg.js b/dist/svg.js index deafcfb..70f1693 100755 --- a/dist/svg.js +++ b/dist/svg.js @@ -1,4 +1,4 @@ -/* svg.js 1.0.0-rc.10-8-g0bb294a - svg inventor adopter regex utilities default color array pointarray patharray number viewbox bbox rbox element parent container fx relative event defs group arrange mask clip gradient pattern doc spof shape symbol use rect ellipse line poly path image text textpath nested hyperlink marker sugar set data memory selector loader helpers polyfill - svgjs.com/license */ +/* svg.js 1.0.0-rc.10-9-g1953dbc - svg inventor adopter regex utilities default color array pointarray patharray number viewbox bbox rbox element parent container fx relative event defs group arrange mask clip gradient pattern doc spof shape symbol use rect ellipse line poly path image text textpath nested hyperlink marker sugar set data memory selector loader helpers polyfill - svgjs.com/license */ ;(function() { var SVG = this.SVG = function(element) { 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 |