sadpandajoe commented on code in PR #44554:
URL: https://github.com/apache/superset/pull/44554#discussion_r4159674200
##########
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberViz.test.tsx:
##########
@@ -246,3 +250,107 @@ describe('BigNumberViz trendline context menu', () => {
expect(onContextMenu).not.toHaveBeenCalled();
});
});
+
+describe('BigNumberViz alignment', () => {
+ const renderViz = (headerAlignment?: HeaderAlignment) =>
+ render(
+ <BigNumberVis
+ width={200}
+ height={100}
+ bigNumber={42}
+ headerFormatter={getNumberFormatter()}
+ headerFontSize={0.3}
+ subheaderFontSize={0.125}
+ subtitleFontSize={0.125}
+ subtitle=""
+ refs={{}}
+ headerAlignment={headerAlignment}
+ />,
+ ).container;
+
+ test('defaults to left alignment', () => {
+ const container = renderViz();
+
+ const textContainer = container.querySelector('.text-container');
+ expect(textContainer).toHaveStyle({ alignItems: 'flex-start' });
+ const headerLine = container.querySelector('.header-line');
+ expect(headerLine).toHaveStyle({ justifyContent: 'flex-start' });
+ });
+
+ test('centers content when headerAlignment is "center"', () => {
+ const container = renderViz('center');
+
+ const textContainer = container.querySelector('.text-container');
Review Comment:
These assertions still pass if the outer chart's alignment override is
removed, leaving Center/Right text at the left edge in the non-overflow layout.
Could we also assert the outer chart alignment for both the plain and trendline
variants?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]