it('creates element in called parent', function() {
expect(element.parent()).toBe(draw)
})
+ it('inherits from given parent', function() {
+ expect(draw.element('g', SVG.Container).rect).toBeTruthy()
+ expect(draw.element('g', SVG.Container).group).toBeTruthy()
+ })
})
describe('words()', function() {
var element = draw.element('title').words('These are some words.').id(null)
expect(element.svg()).toBe('<title>These are some words.</title>')
})
+ it('removes all nodes before adding words', function() {
+ var element = draw.element('title').words('These are some words.').id(null)
+ element.words('These are some words.')
+ expect(element.svg()).toBe('<title>These are some words.</title>')
+ })
})
-})
\ No newline at end of file
+})
rect.remove()
gradient.remove()
})
-
+
it('is an instance of SVG.Gradient', function() {
expect(gradient instanceof SVG.Gradient).toBe(true)
})
gradient = draw.gradient('linear')
expect(gradient.children().length).toBe(0)
})
-
+
describe('fill()', function() {
it('returns the id of the gradient wrapped in url()', function() {
expect(gradient.fill()).toBe('url(#' + gradient.attr('id') + ')')
})
})
+ describe('attr()', function() {
+ it('will catch transform attribues and convert them to gradientTransform', function() {
+ expect(gradient.translate(100,100).attr('gradientTransform')).toBe('matrix(1,0,0,1,100,100)')
+ })
+ })
+
describe('toString()', function() {
it('returns the id of the gradient wrapped in url()', function() {
expect(gradient + '').toBe('url(#' + gradient.attr('id') + ')')
expect(s2.attr('stop-color')).toBe('#ffffff')
expect(s2.attr('stop-opacity')).toBe(0.5)
})
-
+
})
describe('get()', function() {
})
})
-
-})
\ No newline at end of file
+
+})
rect.remove()
pattern.remove()
})
-
+
it('is an instance of SVG.Pattern', function() {
expect(pattern instanceof SVG.Pattern).toBe(true)
})
pattern = draw.pattern(10,30)
expect(pattern.children().length).toBe(0)
})
-
+
describe('fill()', function() {
it('returns the id of the pattern wrapped in url()', function() {
expect(pattern.fill()).toBe('url(#' + pattern.attr('id') + ')')
})
})
+ describe('attr()', function() {
+ it('will catch transform attribues and convert them to patternTransform', function() {
+ expect(pattern.translate(100,100).attr('patternTransform')).toBe('matrix(1,0,0,1,100,100)')
+ })
+ })
+
describe('toString()', function() {
it('returns the id of the pattern wrapped in url()', function() {
expect(pattern + '').toBe('url(#' + pattern.attr('id') + ')')
})
})
-
-})
\ No newline at end of file
+
+})