Skip to content
Snippets Groups Projects
Commit ab890790 authored by HJ's avatar HJ :fire:
Browse files

add 'none' keyword to PISS shadow definiton that equals empty array

parent a8092de6
No related branches found
No related tags found
1 merge request!1946add 'none' keyword to PISS shadow definiton that equals empty array
Pipeline #50473 failed
This commit is part of merge request !1946. Comments created here will be created in the context of that merge request.
...@@ -16,7 +16,8 @@ export default { ...@@ -16,7 +16,8 @@ export default {
{ {
directives: { directives: {
background: '#ffffff', background: '#ffffff',
opacity: 0 opacity: 0,
shadow: []
} }
}, },
{ {
......
...@@ -16,7 +16,8 @@ export default { ...@@ -16,7 +16,8 @@ export default {
component: 'PanelHeader', component: 'PanelHeader',
directives: { directives: {
backgroundNoCssColor: 'yes', backgroundNoCssColor: 'yes',
background: '--fg' background: '--fg',
shadow: []
} }
} }
] ]
......
...@@ -138,7 +138,11 @@ export const deserialize = (input) => { ...@@ -138,7 +138,11 @@ export const deserialize = (input) => {
const [property, value] = d.split(':') const [property, value] = d.split(':')
let realValue = value.trim() let realValue = value.trim()
if (property === 'shadow') { if (property === 'shadow') {
realValue = value.split(',').map(v => parseShadow(v.trim())) if (realValue === 'none') {
realValue = []
} else {
realValue = value.split(',').map(v => parseShadow(v.trim()))
}
} if (!Number.isNaN(Number(value))) { } if (!Number.isNaN(Number(value))) {
realValue = Number(value) realValue = Number(value)
} }
......
...@@ -32,7 +32,11 @@ export const serialize = (ruleset) => { ...@@ -32,7 +32,11 @@ export const serialize = (ruleset) => {
} else { } else {
switch (directive) { switch (directive) {
case 'shadow': case 'shadow':
return ` ${directive}: ${value.map(serializeShadow).join(', ')}` if (value.length > 0) {
return ` ${directive}: ${value.map(serializeShadow).join(', ')}`
} else {
return ` ${directive}: none`
}
default: default:
return ` ${directive}: ${value}` return ` ${directive}: ${value}`
} }
......
...@@ -19,7 +19,7 @@ describe('ISS (de)serialization', () => { ...@@ -19,7 +19,7 @@ describe('ISS (de)serialization', () => {
/* /*
// Debug snippet // Debug snippet
const onlyComponent = componentsContext('./components/panel_header.style.js').default const onlyComponent = componentsContext('./components/panel_header.style.js').default
it(`(De)serialization of component ${onlyComponent.name} works`, () => { it.only(`(De)serialization of component ${onlyComponent.name} works`, () => {
const normalized = onlyComponent.defaultRules.map(x => ({ component: onlyComponent.name, ...x })) const normalized = onlyComponent.defaultRules.map(x => ({ component: onlyComponent.name, ...x }))
console.log('BEGIN INPUT ================') console.log('BEGIN INPUT ================')
console.log(normalized) console.log(normalized)
...@@ -36,5 +36,5 @@ describe('ISS (de)serialization', () => { ...@@ -36,5 +36,5 @@ describe('ISS (de)serialization', () => {
// for some reason comparing objects directly fails the assert // for some reason comparing objects directly fails the assert
expect(JSON.stringify(deserialized, null, 2)).to.equal(JSON.stringify(normalized, null, 2)) expect(JSON.stringify(deserialized, null, 2)).to.equal(JSON.stringify(normalized, null, 2))
}) })
*/ /* */
}) })
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment