Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('Typography Component', () => {

it('renders strong text', () => {
render(<Typography.Text strong>Strong Text</Typography.Text>);
expect(screen.getByText('Strong Text')).toHaveStyle('font-weight: 500');
expect(screen.getByText('Strong Text')).toHaveStyle('font-weight: 600');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why this test needed to change, from my understanding we just moved the default base theme from the frontend to the backend.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test changed because fontWeightStrong: 500 theme token was moved from the frontend (Theme.tsx) to the backend (config.py). During unit tests, the backend config isn't available, so Ant Design's default (600) is used instead. The test now reflects this fallback behavior.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, then I'm surprised we don't have more unit tests failing. Noting this test doesn't seem to use the spec/helpers/ render (which renders with a theme provider), it does import '@testing-library/jest-dom'; instead of @superset-ui/core/spec, wondering if it has something to do with it.

Sidetrack (outside the scope of this PR): It's a bit of a mess around this, might be good to not allow importing @testing-library directly so we're always providing a theme context. It's a bit confusing since each library might have slightly different helpers (useRedux:true in main app for instance).

Not sure what to do with all this, maybe it's just out-of-scope of this PR and this change is ok.

});

it('renders underlined text', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@
* specific language governing permissions and limitations
* under the License.
*/

// @fontsource/* v5.1+ doesn't play nice with eslint-import plugin v2.31+
/* eslint-disable import/extensions */
import '@fontsource/inter/200.css';
import '@fontsource/inter/400.css';
import '@fontsource/inter/500.css';
import '@fontsource/inter/600.css';
import '@fontsource/fira-code/400.css';
import '@fontsource/fira-code/500.css';
import '@fontsource/fira-code/600.css';
/* eslint-enable import/extensions */

import { css, useTheme, Global } from '@emotion/react';

export const GlobalStyles = () => {
Expand Down
Loading
Loading