Skip to content

Commit

Permalink
A multiple:true property that is not unitless does not have an accu…
Browse files Browse the repository at this point in the history
…rate `strValue` representation: The units are missing from each value.

Ref : cy.style().json() background-width/height misses "%" in value #2121
  • Loading branch information
maxkfranz committed Jun 7, 2018
1 parent bdedfd1 commit 0ef252b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/style/parse.js
Expand Up @@ -220,7 +220,7 @@ styfn.parseImpl = function( name, value, propIsBypass, propIsFlat ){
name: name,
value: valArr,
pfValue: pfValArr,
strValue: valArr.join( ' ' ),
strValue: valArr.map( (val, i) => val + (unitsArr[i] || '') ).join(' '),
bypass: propIsBypass,
units: unitsArr
};
Expand Down
21 changes: 20 additions & 1 deletion test/core-graph-manipulation.js
Expand Up @@ -33,7 +33,16 @@ describe('Core graph manipulation', function(){
{ data: { id: "n1n2", source: "n1", target: "n2", weight: 0.33 }, classes: "uh" },
{ data: { id: "n2n3", source: "n2", target: "n3", weight: 0.66 }, classes: "huh" }
]
}
},

style: [
{
selector: 'node',
style: {
'background-width': '50% 50%' // expected to be in first block for tests
}
}
]
});
});

Expand Down Expand Up @@ -459,4 +468,14 @@ describe('Core graph manipulation', function(){

});

describe('cy.style()', function(){
describe('cy.style.json()', function(){
it('property with multiple values is serialised including units', function(){
var json = cy.style().json();

expect( json[0].style['background-width'] === '50% 50%' );
});
});
});

});

0 comments on commit 0ef252b

Please sign in to comment.