Skip to content

Commit

Permalink
make ColorRampItem more generic by removing locale logic
Browse files Browse the repository at this point in the history
  • Loading branch information
kasongoyo committed Jul 12, 2019
1 parent 59f6b69 commit a2f9f44
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const ColorRampItem = ({ item }) => {
{ramp.map(cell => <div className="color-cell" key={item && item.name + "-" + cell} style={{ backgroundColor: cell }} />)}
<div className="colorname-cell">
{item && item.name
? <Message msgId={item.name.includes('global.colors') ? item.name : `global.colors.${item.name}`} msgParams={{ number: ramp.length }} />
? <Message msgId={item.name} msgParams={{ number: ramp.length }} />
: item}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,11 @@ describe("Test the ColorRampItem", () => {
const colorRamp = container.querySelector('.colorname-cell');
expect(colorRamp.innerHTML).toEqual('blue');
});
it('colorrampitem with object item contain name equal to full INTL path', () => {
it('colorrampitem with object item contain name', () => {
const color = 'global.colors.blue';
ReactDOM.render(<ColorRampItem item={{name: color}} />, document.getElementById("container"));
const container = document.getElementById('container');
const colorRamp = container.querySelector('span');
expect(colorRamp.innerHTML).toEqual(color);
});
it('colorrampitem with object item contain name without full INTL path', () => {
const color = 'blue';
ReactDOM.render(<ColorRampItem item={{name: color}} />, document.getElementById("container"));
const container = document.getElementById('container');
const colorRamp = container.querySelector('span');
expect(colorRamp.innerHTML).toEqual(`global.colors.${color}`);
});
});

0 comments on commit a2f9f44

Please sign in to comment.