Skip to content

Commit

Permalink
Merge pull request #654 from brightlayer-ui/dev
Browse files Browse the repository at this point in the history
Publish v6.1.2
  • Loading branch information
daileytj authored Dec 7, 2022
2 parents 0b9a70f + 039c345 commit 73b4ea3
Show file tree
Hide file tree
Showing 175 changed files with 3,448 additions and 3,682 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2.1
orbs:
codecov: codecov/codecov@1.1.3
codecov: codecov/codecov@3.2.2
gh: circleci/[email protected]
browser-tools: circleci/[email protected]
jobs:
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
at: .
- codecov/upload:
file: './components/coverage/clover.xml'
token: 5e6faafe-eaf0-4d71-a931-22f279d3e446
token: CODECOV_TOKEN

# Builds the Showcase app using @brightlayer-ui/react-components persisted in /dist folder.
build_showcase:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v6.1.2 (December 7, 2022)

### Updated

- Remove dependency on @mui/styles ([#633](https://github.com/brightlayer-ui/react-component-library/issues/633)).

## v6.1.1 (November 1, 2022)

### Fixed
Expand Down
1 change: 1 addition & 0 deletions components/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = {
parser: '@typescript-eslint/parser',
plugins: ["jest-dom", "testing-library"],
extends: ['@brightlayer-ui/eslint-config/tsx'],
parserOptions: {
project: './tsconfig.json',
Expand Down
44 changes: 21 additions & 23 deletions components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@brightlayer-ui/react-components",
"version": "6.1.1",
"version": "6.1.2",
"description": "React components for Brightlayer UI applications",
"scripts": {
"test": "jest src",
Expand All @@ -13,49 +13,47 @@
"prettier": "@brightlayer-ui/prettier-config",
"dependencies": {
"@brightlayer-ui/colors": "^3.1.1",
"@emotion/css": "^11.9.0",
"@emotion/css": "^11.10.5",
"@seznam/compose-react-refs": "^1.0.6",
"color": "^4.2.1"
"color": "^4.2.3"
},
"devDependencies": {
"@brightlayer-ui/eslint-config": "^3.0.0",
"@brightlayer-ui/prettier-config": "^1.0.2",
"@brightlayer-ui/react-themes": "^7.0.0",
"@emotion/react": "^11.7.1",
"@emotion/styled": "^11.6.0",
"@mui/icons-material": "^5.3.1",
"@mui/material": "^5.4.1",
"@mui/styles": "^5.4.1",
"@types/node": "^16.11.63",
"@types/color": "^3.0.1",
"@types/enzyme": "^3.10.4",
"@types/enzyme-adapter-react-16": "^1.0.5",
"@brightlayer-ui/eslint-config": "^3.0.1",
"@brightlayer-ui/prettier-config": "^1.0.3",
"@brightlayer-ui/react-themes": "^7.1.0",
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@mui/icons-material": "^5.10.9",
"@mui/material": "^5.10.13",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@types/color": "^3.0.3",
"@types/jest": "^27.0.0",
"@types/node": "^16.11.63",
"@types/react-dom": "^18.0.5",
"@typescript-eslint/eslint-plugin": "^5.14.0",
"@typescript-eslint/parser": "^5.14.0",
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.0",
"enzyme": "^3.5.0",
"enzyme-adapter-react-16": "^1.8.0",
"eslint": "^8.15.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-jest-dom": "^4.0.3",
"eslint-plugin-react": "^7.29.4",
"eslint-plugin-testing-library": "^5.9.1",
"i": "^0.3.7",
"jest": "^27.0.0",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"npm": "^8.12.1",
"prettier": "^2.2.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"ts-jest": "^28.0.4",
"typescript": "^4.2.3"
"typescript": "^4.8.4"
},
"peerDependencies": {
"@brightlayer-ui/colors": "^3.0.0",
"@emotion/react": "^11.7.1",
"@emotion/styled": "^11.6.0",
"@mui/icons-material": "^5.3.1",
"@mui/material": "^5.4.0",
"@mui/styles": "^5.3.0",
"react": "^16.0.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0"
},
Expand Down
90 changes: 38 additions & 52 deletions components/src/core/AppBar/AppBar.test.tsx
Original file line number Diff line number Diff line change
@@ -1,74 +1,60 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
import * as Enzyme from 'enzyme';
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
import { mountWithTheme } from '../test-utils';
import { render, screen, cleanup } from '@testing-library/react';
import '@testing-library/jest-dom';
import { AppBar } from './AppBar';
import MuiAppBar from '@mui/material/AppBar';
import { createTheme, ThemeProvider } from '@mui/material/styles';
import * as BLUIThemes from '@brightlayer-ui/react-themes';
import Typography from '@mui/material/Typography';

const theme = createTheme(BLUIThemes.blue);

Enzyme.configure({ adapter: new Adapter() });
afterEach(cleanup);

describe('AppBar', () => {
it('should render without crashing', () => {
const div = document.createElement('div');
const root = createRoot(div);
root.render(
render(
<ThemeProvider theme={theme}>
<AppBar />
</ThemeProvider>
);
});

it('should render at the correct default sizes', () => {
// Dynamic
let appbar = mountWithTheme(<AppBar />, theme);
let muiAppbar = appbar.find(MuiAppBar);
let height = muiAppbar.props().style.height;
expect(height).toEqual(200);

// Collapsed
appbar = mountWithTheme(<AppBar variant={'collapsed'} />, theme);
muiAppbar = appbar.find(MuiAppBar);
height = muiAppbar.props().style.height;
expect(height).toEqual('4rem');

// Expanded
appbar = mountWithTheme(<AppBar variant={'expanded'} />, theme);
muiAppbar = appbar.find(MuiAppBar);
height = muiAppbar.props().style.height;
expect(height).toEqual(200);
it('should render Typography title', () => {
render(
<ThemeProvider theme={theme}>
<AppBar>
<Typography variant="h6">AppBar</Typography>
</AppBar>
</ThemeProvider>
);
const divElement = screen.getByText(/AppBar/i);
expect(divElement).toBeTruthy();
});

it('should render at the correct custom sizes', () => {
// Dynamic
let appbar = mountWithTheme(<AppBar expandedHeight={300} collapsedHeight={100} />, theme);
let muiAppbar = appbar.find(MuiAppBar);
let height = muiAppbar.props().style.height;
expect(height).toEqual(300);

// Collapsed
appbar = mountWithTheme(<AppBar variant={'collapsed'} expandedHeight={300} collapsedHeight={100} />, theme);
muiAppbar = appbar.find(MuiAppBar);
height = muiAppbar.props().style.height;
expect(height).toEqual(100);
it('should render at the correct default size', () => {
render(
<ThemeProvider theme={theme}>
<AppBar variant="snap"></AppBar>
</ThemeProvider>
);
expect(screen.getByTestId('blui-appbar-root')).toHaveStyle(`height: 200px`);
});

// Expanded
appbar = mountWithTheme(<AppBar variant={'expanded'} expandedHeight={300} collapsedHeight={100} />, theme);
muiAppbar = appbar.find(MuiAppBar);
height = muiAppbar.props().style.height;
expect(height).toEqual(300);
it('should render at the correct collapsed height size', () => {
render(
<ThemeProvider theme={theme}>
<AppBar variant="collapsed"></AppBar>
</ThemeProvider>
);
expect(screen.getByTestId('blui-appbar-root')).toHaveStyle(`height: 4rem`);
});

// TESTS FOR CYPRESS
// 1. should be the correct size on underscroll
// 1a: underscrolled should be min height
// 1b. with custom size
// 2. should be the correect size on overscroll
// 2a. overscrolled should be max height
// 2b. with custom size
// 3. should be the correct size on partial scroll
it('should render at the correct expanded height size', () => {
render(
<ThemeProvider theme={theme}>
<AppBar variant="expanded"></AppBar>
</ThemeProvider>
);
expect(screen.getByTestId('blui-appbar-root')).toHaveStyle(`height: 200px`);
});
});
1 change: 1 addition & 0 deletions components/src/core/AppBar/AppBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ const AppBarRender: React.ForwardRefRenderFunction<unknown, AppBarProps> = (prop
<Root
ref={ref}
{...muiAppBarProps}
data-testid={'blui-appbar-root'}
className={cx(
defaultClasses.root,
classes.root,
Expand Down
3 changes: 2 additions & 1 deletion components/src/core/AppBar/AppBarClasses.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { generateUtilityClass, generateUtilityClasses } from '@mui/base';
import generateUtilityClass from '@mui/material/generateUtilityClass';
import generateUtilityClasses from '@mui/material/generateUtilityClasses';

export type AppBarClasses = {
root?: string;
Expand Down
51 changes: 25 additions & 26 deletions components/src/core/ChannelValue/ChannelValue.test.tsx
Original file line number Diff line number Diff line change
@@ -1,49 +1,48 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
import { findByTestId, mountWithTheme } from '../test-utils';
import { render, screen, cleanup } from '@testing-library/react';
import '@testing-library/jest-dom';
import { ChannelValue } from './ChannelValue';
import * as Enzyme from 'enzyme';
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
import Menu from '@mui/icons-material/Menu';
import { createTheme, ThemeProvider } from '@mui/material/styles';
import * as BLUIThemes from '@brightlayer-ui/react-themes';

const theme = createTheme(BLUIThemes.blue);

Enzyme.configure({ adapter: new Adapter() });
afterEach(cleanup);

describe('ChannelValue', () => {
it('renders without crashing', () => {
const div = document.createElement('div');
const root = createRoot(div);
root.render(
render(
<ThemeProvider theme={theme}>
<ChannelValue value={'test'} />
</ThemeProvider>
);
});
it('should render with the wrapper class', () => {
const wrapper = mountWithTheme(<ChannelValue value={1} />, theme);
expect(findByTestId('wrapper', wrapper)).toBeTruthy();
wrapper.unmount();
expect(screen.getByText('test')).toBeTruthy();
});
it('should render value properly', () => {
const wrapper = mountWithTheme(<ChannelValue value={1} />, theme);
expect(findByTestId('value', wrapper).length).toEqual(1);
wrapper.unmount();
render(
<ThemeProvider theme={theme}>
<ChannelValue value={1} />
</ThemeProvider>
);
expect(screen.getByText('1')).toBeTruthy();
});
it('should render icon properly', () => {
let wrapper = mountWithTheme(<ChannelValue icon={<Menu />} value={1} />, theme);
expect(findByTestId('icon', wrapper).length).toEqual(1);
wrapper = mountWithTheme(<ChannelValue value={1} />, theme);
expect(findByTestId('icon', wrapper).length).toEqual(0);
wrapper.unmount();
render(
<ThemeProvider theme={theme}>
<ChannelValue icon={<Menu />} value={1} />
</ThemeProvider>
);
expect(screen.getByTestId('MenuIcon')).toBeTruthy();
expect(screen.getByText('1')).toBeTruthy();
});
it('should render units properly', () => {
let wrapper = mountWithTheme(<ChannelValue value={1} units={'X'} />, theme);
expect(findByTestId('units', wrapper).length).toEqual(1);
wrapper = mountWithTheme(<ChannelValue value={1} />, theme);
expect(findByTestId('units', wrapper).length).toEqual(0);
wrapper.unmount();
render(
<ThemeProvider theme={theme}>
<ChannelValue value={1} units={'X'} />
</ThemeProvider>
);
expect(screen.getByTestId('blui-channel-value-units')).toBeTruthy();
expect(screen.getByText('1')).toBeTruthy();
});
});
12 changes: 6 additions & 6 deletions components/src/core/ChannelValue/ChannelValue.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React, { useCallback } from 'react';
import Typography from '@mui/material/Typography';
import Typography, { TypographyProps } from '@mui/material/Typography';
import { cx } from '@emotion/css';
import PropTypes from 'prop-types';
import { Box, BoxProps, TypographyProps } from '@mui/material';
import { styled } from '@mui/material/styles';
import channelValueClasses, {
ChannelValueClasses,
ChannelValueClassKey,
getChannelValueUtilityClass,
} from './ChannelValueClasses';
import { unstable_composeClasses as composeClasses } from '@mui/base';
import Box, { BoxProps } from '@mui/material/Box';

const useUtilityClasses = (ownerState: ChannelValueProps): Record<ChannelValueClassKey, string> => {
const { classes } = ownerState;
Expand Down Expand Up @@ -145,7 +145,7 @@ const ChannelValueRender: React.ForwardRefRenderFunction<unknown, ChannelValuePr
color={'inherit'}
className={cx(defaultClasses.text, classes.text, defaultClasses.units, classes.units)}
isSuffix={applySuffix()}
data-test={'units'}
data-testid={'blui-channel-value-units'}
>
{units}
</Unit>
Expand All @@ -160,13 +160,13 @@ const ChannelValueRender: React.ForwardRefRenderFunction<unknown, ChannelValuePr
component="span"
ref={ref}
className={cx(defaultClasses.root, classes.root, userClassName)}
data-test={'wrapper'}
data-testid={'blui-channel-value-root'}
fontSize={fontSize}
color={color}
{...otherProps}
>
{icon && (
<IconSpan className={cx(defaultClasses.icon, classes.icon)} data-test={'icon'}>
<IconSpan className={cx(defaultClasses.icon, classes.icon)} data-testid={'blui-channel-value-icon'}>
{changeIconDisplay(icon)}
</IconSpan>
)}
Expand All @@ -175,7 +175,7 @@ const ChannelValueRender: React.ForwardRefRenderFunction<unknown, ChannelValuePr
variant={'h6'}
color={'inherit'}
className={cx(defaultClasses.text, classes.text, defaultClasses.value, classes.value)}
data-test={'value'}
data-testid={'blui-channel-value-value'}
isPrefix={applyPrefix()}
>
{value}
Expand Down
3 changes: 2 additions & 1 deletion components/src/core/ChannelValue/ChannelValueClasses.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { generateUtilityClass, generateUtilityClasses } from '@mui/base';
import generateUtilityClass from '@mui/material/generateUtilityClass';
import generateUtilityClasses from '@mui/material/generateUtilityClasses';

export type ChannelValueClasses = {
/** Styles applied to the root element. */
Expand Down
Loading

0 comments on commit 73b4ea3

Please sign in to comment.