mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -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",
|
"jest": "jest --notify --watch",
|
||||||
"api-tests": "jest --notify --watch --config=tests/api/jest.js",
|
"api-tests": "jest --notify --watch --config=tests/api/jest.js",
|
||||||
"storybook": "cd packages/grafana-ui && yarn storybook",
|
"storybook": "cd packages/grafana-ui && yarn storybook",
|
||||||
"prettier:check": "prettier -- --list-different \"**/*.{ts,tsx,scss}\""
|
"prettier:check": "prettier --list-different \"**/*.{ts,tsx,scss}\""
|
||||||
},
|
},
|
||||||
"husky": {
|
"husky": {
|
||||||
"hooks": {
|
"hooks": {
|
||||||
|
@ -16,9 +16,21 @@ describe('<LogMessageAnsi />', () => {
|
|||||||
const wrapper = shallow(<LogMessageAnsi value={value} />);
|
const wrapper = shallow(<LogMessageAnsi value={value} />);
|
||||||
|
|
||||||
expect(wrapper.find('span')).toHaveLength(1);
|
expect(wrapper.find('span')).toHaveLength(1);
|
||||||
expect(wrapper.find('span').first().prop('style')).toMatchObject(expect.objectContaining({
|
expect(
|
||||||
color: expect.any(String)
|
wrapper
|
||||||
}));
|
.find('span')
|
||||||
expect(wrapper.find('span').first().text()).toBe('ipsum');
|
.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);
|
const parsed = ansicolor.parse(props.value);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
chunks: parsed.spans.map((span) => {
|
chunks: parsed.spans.map(span => {
|
||||||
return span.css ?
|
return span.css
|
||||||
{
|
? {
|
||||||
style: convertCSSToStyle(span.css),
|
style: convertCSSToStyle(span.css),
|
||||||
text: span.text
|
text: span.text,
|
||||||
} :
|
}
|
||||||
{ 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;
|
const { chunks } = this.state;
|
||||||
|
|
||||||
return chunks.map(
|
return chunks.map(
|
||||||
(chunk, index) => chunk.style ?
|
(chunk, index) =>
|
||||||
<span key={index} style={chunk.style}>{chunk.text}</span> :
|
chunk.style ? (
|
||||||
chunk.text
|
<span key={index} style={chunk.style}>
|
||||||
|
{chunk.text}
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
|
chunk.text
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user