Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text - Reusable make-styles rules #18778

Merged
merged 14 commits into from
Jul 15, 2021
Prev Previous commit
Cleanup test
  • Loading branch information
andrefcdias committed Jul 15, 2021
commit 9e4e6169797ec4463ef43d5d4da722ce6b87d926
10 changes: 4 additions & 6 deletions packages/react-text/src/components/Text/Text.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// For non-exported types
/* eslint-disable @typescript-eslint/no-explicit-any */
import * as React from 'react';
import { render } from '@testing-library/react';
import { Text } from './Text';
Expand Down Expand Up @@ -110,7 +108,7 @@ describe('Text', () => {
[800, 'hero', '800'],
[900, 'hero', '900'],
[1000, 'hero', '1000'],
])('applies the %s token sizing styles', (sizeToken: any, expectedPrefix, expectedValue) => {
] as const)('applies the %s token sizing styles', (sizeToken, expectedPrefix, expectedValue) => {
const { getByText } = render(<Text size={sizeToken}>Test</Text>);

const textElement = getByText('Test');
Expand All @@ -124,7 +122,7 @@ describe('Text', () => {
['base', 'base'],
['monospace', 'monospace'],
['numeric', 'numeric'],
])('applies %s font', (input: any, expectedValue) => {
] as const)('applies %s font', (input, expectedValue) => {
const { getByText } = render(<Text font={input}>Test</Text>);

const textElement = getByText('Test');
Expand All @@ -137,7 +135,7 @@ describe('Text', () => {
['regular', 'regular'],
['medium', 'medium'],
['semibold', 'semibold'],
])('applies %s weight', (input: any, expectedValue) => {
] as const)('applies %s weight', (input, expectedValue) => {
const { getByText } = render(<Text weight={input}>Test</Text>);

const textElement = getByText('Test');
Expand All @@ -151,7 +149,7 @@ describe('Text', () => {
['center', 'center'],
['end', 'end'],
['justify', 'justify'],
])('applies a %s alignment', (input: any, expectedValue) => {
] as const)('applies a %s alignment', (input, expectedValue) => {
const { getByText } = render(<Text align={input}>Test</Text>);

const textElement = getByText('Test');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ test.each([
['title1', 'base', '800', '800', weightsMock.semibold],
['largeTitle', 'base', '900', '900', weightsMock.semibold],
['display', 'base', '1000', '1000', weightsMock.semibold],
])('Uses the right tokens for %s', (ruleName, fontFamily, fontSize, lineHeight, fontWeight) => {
const ruleFunction = typographyStyles[ruleName as keyof typeof typographyStyles];
] as const)('Uses the right tokens for %s', (ruleName, fontFamily, fontSize, lineHeight, fontWeight) => {
const ruleFunction = typographyStyles[ruleName];

const rules = ruleFunction(themeMock as Theme);

Expand Down