})
})
- describe('targets()', () => {
- it('gets all targets of this path', () => {
- const canvas = SVG().addTo(container)
- const path = canvas.path('M0 0 50, 50')
- const textPath = canvas.text('Hello World').path(path)
- expect(path.targets()).toEqual([ textPath ])
- })
- })
-
describe('width()', () => {
it('gets the width of the path', () => {
const canvas = SVG().addTo(container)
import { registerMethods } from '../utils/methods.js'
import PathArray from '../types/PathArray.js'
import Shape from './Shape.js'
-import baseFind from '../modules/core/selector.js'
export default class Path extends Shape {
// Initialize node
return this.attr('d', this.array().size(p.width, p.height))
}
- targets () {
- return baseFind('svg textpath [href*="' + this.id() + '"]')
- }
-
// Set width of element
width (width) {
return width == null ? this.bbox().width : this.size(width, this.bbox().height)
}),
targets () {
- return baseFind('svg [*|href*="' + this.id() + '"]')
+ return baseFind('svg textPath[*|href*="' + this.id() + '"]')
}
}
})