Skip to content

Commit

Permalink
refactor: return styles as array
Browse files Browse the repository at this point in the history
  • Loading branch information
James Duffy committed Jan 29, 2021
1 parent b99c21e commit bfd2ae0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion spec/WarningSpec.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ describe('#highlightStyles', () => {
const parentNode = parent;
const rangeToHighlight = range;

expect(highlightStyles(parentNode, rangeToHighlight)).toEqual({
const styles = highlightStyles(parentNode, rangeToHighlight);
expect(styles.length).toEqual(1);
expect(styles[0]).toEqual({
top: '62px',
left: '0px',
width: '39px',
Expand Down
2 changes: 1 addition & 1 deletion src/components/Warning.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const highlightStyles = (parentNode, rangeToHighlight) => {
for (let i = 0; i < rectsToHighlight.length; i++) {
styles.push(getNodeStyle(rectsToHighlight[i], coords[i]));
}
return styles[0];
return styles;
}
return undefined;
};
Expand Down

0 comments on commit bfd2ae0

Please sign in to comment.