Skip to content

Commit

Permalink
fix: svg color change
Browse files Browse the repository at this point in the history
  • Loading branch information
sirPixieJerry committed Feb 7, 2024
1 parent 3b58b58 commit 02adf9c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/modules/colorReflection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ describe('colorReflection', () => {

colorReflection('red');

expect(reflexOne!.style.backgroundColor).to.equal('red');
expect(reflexTwo!.style.backgroundColor).to.equal('red');
if (!reflexOne) throw new Error('reflexOne not found');
if (!reflexTwo) throw new Error('reflexTwo not found');

expect(reflexOne.style.backgroundColor).to.equal('red');
expect(reflexTwo.style.backgroundColor).to.equal('red');
});
});
7 changes: 5 additions & 2 deletions src/modules/colorSVG.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ describe('colorSVG', () => {

colorSVG('red');

expect(box!.style.backgroundColor).to.equal('red');
expect(path!.style.fill).to.equal('red');
if (!box) throw new Error('box not found');
if (!path) throw new Error('path not found');

expect(box.style.backgroundColor).to.equal('red');
expect(path.getAttribute('fill')).to.equal('red');
});
});
2 changes: 1 addition & 1 deletion src/modules/colorSVG.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ export const colorSVG = (color: string): void => {
if (box === null || path === null) return;

box.style.backgroundColor = color;
path.style.fill = color;
path.setAttribute('fill', color);
};

0 comments on commit 02adf9c

Please sign in to comment.