mirror of
https://github.com/grafana/grafana.git
synced 2025-02-09 23:16:16 -06:00
Fixed prettier issue (#15471)
Fixed prettier CI issue that caused build failures
This commit is contained in:
parent
1adc1a6097
commit
2d5fd7fdfd
@ -121,7 +121,7 @@
|
||||
"jest": "jest --notify --watch",
|
||||
"api-tests": "jest --notify --watch --config=tests/api/jest.js",
|
||||
"storybook": "cd packages/grafana-ui && yarn storybook",
|
||||
"prettier:check": "prettier -- --list-different \"**/*.{ts,tsx,scss}\""
|
||||
"prettier:check": "prettier --list-different \"**/*.{ts,tsx,scss}\""
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
|
@ -16,9 +16,21 @@ describe('<LogMessageAnsi />', () => {
|
||||
const wrapper = shallow(<LogMessageAnsi value={value} />);
|
||||
|
||||
expect(wrapper.find('span')).toHaveLength(1);
|
||||
expect(wrapper.find('span').first().prop('style')).toMatchObject(expect.objectContaining({
|
||||
color: expect.any(String)
|
||||
}));
|
||||
expect(wrapper.find('span').first().text()).toBe('ipsum');
|
||||
expect(
|
||||
wrapper
|
||||
.find('span')
|
||||
.first()
|
||||
.prop('style')
|
||||
).toMatchObject(
|
||||
expect.objectContaining({
|
||||
color: expect.any(String),
|
||||
})
|
||||
);
|
||||
expect(
|
||||
wrapper
|
||||
.find('span')
|
||||
.first()
|
||||
.text()
|
||||
).toBe('ipsum');
|
||||
});
|
||||
});
|
||||
|
@ -46,15 +46,15 @@ export class LogMessageAnsi extends PureComponent<Props, State> {
|
||||
const parsed = ansicolor.parse(props.value);
|
||||
|
||||
return {
|
||||
chunks: parsed.spans.map((span) => {
|
||||
return span.css ?
|
||||
{
|
||||
style: convertCSSToStyle(span.css),
|
||||
text: span.text
|
||||
} :
|
||||
{ text: span.text };
|
||||
chunks: parsed.spans.map(span => {
|
||||
return span.css
|
||||
? {
|
||||
style: convertCSSToStyle(span.css),
|
||||
text: span.text,
|
||||
}
|
||||
: { text: span.text };
|
||||
}),
|
||||
prevValue: props.value
|
||||
prevValue: props.value,
|
||||
};
|
||||
}
|
||||
|
||||
@ -62,9 +62,14 @@ export class LogMessageAnsi extends PureComponent<Props, State> {
|
||||
const { chunks } = this.state;
|
||||
|
||||
return chunks.map(
|
||||
(chunk, index) => chunk.style ?
|
||||
<span key={index} style={chunk.style}>{chunk.text}</span> :
|
||||
chunk.text
|
||||
(chunk, index) =>
|
||||
chunk.style ? (
|
||||
<span key={index} style={chunk.style}>
|
||||
{chunk.text}
|
||||
</span>
|
||||
) : (
|
||||
chunk.text
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user