diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2023-09-03 08:07:53 +0200 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2023-09-03 08:07:53 +0200 |
commit | dd884bc205e1b476497af3fd8cabcdf85c95125e (patch) | |
tree | a863cb7a2a906bcd0d7824d98c8f47738b32399c /spec | |
parent | 9ed85cff5eb3783efc25c070f07b6bcf71c44e07 (diff) | |
download | svg.js-dd884bc205e1b476497af3fd8cabcdf85c95125e.tar.gz svg.js-dd884bc205e1b476497af3fd8cabcdf85c95125e.zip |
only apply color conversion to attributes that can take a color (fixes #1241)
Diffstat (limited to 'spec')
-rw-r--r-- | spec/spec/modules/core/attr.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/spec/spec/modules/core/attr.js b/spec/spec/modules/core/attr.js index b47794a..9a52c56 100644 --- a/spec/spec/modules/core/attr.js +++ b/spec/spec/modules/core/attr.js @@ -1,6 +1,6 @@ /* globals describe, expect, it, beforeEach, spyOn, jasmine */ -import { Element, create, Text } from '../../../../src/main.js' +import { Element, create, Text, Rect } from '../../../../src/main.js' import { registerAttrHook } from '../../../../src/modules/core/attr.js' const { objectContaining } = jasmine @@ -105,6 +105,12 @@ describe('attr.js', () => { expect(frozen.attr('leading', 2)).toBe(frozen) }) + it('only applies transforms color values if the attribute is designed to take a color as input', () => { + const rect = new Rect().attr('id', '#ff0') + + expect(rect.attr('id')).toBe('#ff0') + }) + it('executes registered hooks', () => { registerAttrHook((attr, val, el) => { if (el.node.id === 'somethingVeryRandom' && attr === 'name') { |