-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #654 from brightlayer-ui/dev
Publish v6.1.2
- Loading branch information
Showing
175 changed files
with
3,448 additions
and
3,682 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | ||
|
@@ -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: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.