aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/spec/modules/optional/css.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/spec/modules/optional/css.js b/spec/spec/modules/optional/css.js
index 8a42acf..a0fa701 100644
--- a/spec/spec/modules/optional/css.js
+++ b/spec/spec/modules/optional/css.js
@@ -34,6 +34,13 @@ describe('css.js', () => {
expect(rect.css('fill')).toBe('none')
})
+ it('correctly returns css vars', () => {
+ const rect = new Rect({
+ style: '--foo: red;'
+ })
+ expect(rect.css('--foo')).toBe('red')
+ })
+
it('returns undefined if css property is not set', () => {
const rect = new Rect({
style: 'fill: none; outline-width: 1px; stroke: none'
@@ -94,6 +101,22 @@ describe('css.js', () => {
})
expect(rect.css({ fill: null, stroke: 'black' }).css('fill')).toBe('')
})
+
+ it('allows single set of css vars', () => {
+ const rect = new Rect().css('--foo', 'red').css('--foo', 'green')
+ expect(rect.css()).toEqual({
+ '--foo': 'green'
+ })
+ })
+
+ it('allows multiple set of css vars via object', () => {
+ const rect = new Rect().css({ '--foo': 'red', '--bar': 'green' })
+
+ expect(rect.css()).toEqual({
+ '--foo': 'red',
+ '--bar': 'green'
+ })
+ })
})
})