Skip to content

Commit d82e8c9

Browse files
atvaneksophia-buirachelk585
committed
Changed text color of hidden display tab
Co-authored-by: Sophia Bui <[email protected]> Co-authored-by: rachelk585 <[email protected]>
1 parent 0a025c3 commit d82e8c9

File tree

5 files changed

+74
-38
lines changed

5 files changed

+74
-38
lines changed

__tests__/BottomTabs.test.tsx

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import ContextManager from '../app/src/components/ContextAPIManager/ContextManag
77
import store from '../app/src/redux/store';
88
import ComponentPanel from '../app/src/components/right/ComponentPanel';
99
import HTMLPanel from '../app/src/components/left/HTMLPanel';
10+
import StateManager from '../app/src/components/StateManagement/StateManagement';
1011

1112
describe('Bottom Panel Render Test', () => {
1213
test('should render all seven tabs', () => {
@@ -109,13 +110,38 @@ describe('Creation Panel', () => {
109110
});
110111

111112
describe('Context Manager', () => {
112-
test('should contain all buttons and input fields', () => {
113+
test('Create/Edit Tab should contain all buttons and input fields', () => {
113114
render(
114115
<Provider store={store}>
115116
<ContextManager />
116117
</Provider>
117118
);
118119
expect(screen.getAllByRole('textbox')).toHaveLength(2);
119120
expect(screen.getAllByRole('button')).toHaveLength(3);
121+
expect(screen.getByText('Context Name')).toBeInTheDocument();
122+
});
123+
test('Create/Edit Tab should contain all buttons and input fields', () => {
124+
render(
125+
<Provider store={store}>
126+
<ContextManager />
127+
</Provider>
128+
);
129+
130+
fireEvent.click(screen.getByText('Assign'));
131+
expect(screen.getByText('Contexts Consumed')).toBeInTheDocument();
132+
});
133+
});
134+
135+
describe('State Manager', () => {
136+
test('Should render all containers', () => {
137+
render(
138+
<Provider store={store}>
139+
<StateManager isThemeLight={null} />
140+
</Provider>
141+
);
142+
expect(screen.getAllByRole('heading')).toHaveLength(4);
143+
expect(screen.getAllByRole('textbox')).toHaveLength(2);
144+
expect(screen.getAllByRole('grid')).toHaveLength(3);
145+
expect(screen.getAllByRole('column header')).toHaveLength(9);
120146
});
121147
});

__tests__/DragAndDrop.test.tsx

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,25 @@ import { DndProvider } from 'react-dnd';
44
import { HTML5Backend } from 'react-dnd-html5-backend';
55
import { fireEvent, render, screen } from '@testing-library/react';
66
import DragDropPanel from '../app/src/components/left/DragDropPanel';
7+
import ComponentDrag from '../app/src/components/right/ComponentDrag';
78
import { Provider } from 'react-redux';
89
import store from '../app/src/redux/store';
910

11+
function TestContext(component) {
12+
return(
13+
<Provider store={store}>
14+
<DndProvider backend={HTML5Backend}>
15+
{component}
16+
</DnDProvider>
17+
</Provider>
18+
)
19+
}
20+
1021
describe('Drag and Drop Side Panel', () => {
22+
1123
test('Renders all HTML Element choices', () => {
1224
render(
13-
<Provider store={store}>
14-
<DndProvider backend={HTML5Backend}>
15-
<DragDropPanel />
16-
</DndProvider>
17-
</Provider>
25+
TestContext(<DragDropPanel/>)
1826
);
1927
expect(screen.getByText('Div')).toBeInTheDocument();
2028
expect(screen.getByText('Img')).toBeInTheDocument();
@@ -36,27 +44,21 @@ describe('Drag and Drop Side Panel', () => {
3644

3745
test('Renders all React Router Component choices', () => {
3846
render(
39-
<Provider store={store}>
40-
<DndProvider backend={HTML5Backend}>
41-
<DragDropPanel />
42-
</DndProvider>
43-
</Provider>
47+
TestContext(<DragDropPanel />)
4448
);
4549

4650
expect(screen.getByText('Switch')).toBeInTheDocument();
4751
expect(screen.getByText('Route')).toBeInTheDocument();
4852
expect(screen.getByText('LinkTo')).toBeInTheDocument();
4953
});
5054

51-
// test('Adds new custom element', () => {
52-
// render(<Test />);
53-
// fireEvent.change(screen.getAllByRole('textbox')[0], {
54-
// target: { value: 'Testing' }
55-
// });
56-
// fireEvent.change(screen.getAllByRole('textbox')[1], {
57-
// target: { value: 'Testing' }
58-
// });
59-
// fireEvent.click(screen.getByDisplayValue('Add Element'));
60-
// expect(screen.getByText('Testing')).toBeInTheDocument();
61-
// });
55+
test('Should render Roots Components and Reusbale components', () => {
56+
render(
57+
TestContext(<ComponentDrag/>)
58+
);
59+
60+
expect(screen.getByText('Root Components')).toBeInTheDocument();
61+
expect(screen.getByText('Reusable Components')).toBeInTheDocument();
62+
});
63+
6264
});

__tests__/signIn.test.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ describe('sign in page', () => {
3838
});
3939
test('should invalidate empty password field', () => {
4040
render(<TestSignIn />);
41-
console.log(screen.getAllByRole('textbox'));
4241
fireEvent.change(screen.getByRole('textbox'), {
4342
target: {
4443
value: 'username'

app/src/components/StateManagement/CreateTab/components/StatePropsPanel.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import TablePassedInProps from './TablePassedInProps';
1818
import { RootState } from '../../../../redux/store';
1919

2020
const StatePropsPanel = ({ isThemeLight, data }): JSX.Element => {
21-
const { state, contextParam } = useSelector((store:RootState) => ({
21+
const { state, contextParam } = useSelector((store: RootState) => ({
2222
state: store.appState,
2323
contextParam: store.contextSlice
2424
}));
@@ -526,11 +526,11 @@ const useStyles = makeStyles((theme: Theme) => ({
526526
color: 'rgba(0,0,0,0.54)'
527527
},
528528
formControl: {
529-
margin: theme.spacing(1),
529+
margin: '8px',
530530
minWidth: 120
531531
},
532532
selectEmpty: {
533-
marginTop: theme.spacing(2)
533+
marginTop: '16px'
534534
},
535535
color: {
536536
color: '#fff'

app/src/components/StateManagement/StateManagement.tsx

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ const useStyles = makeStyles({
1919
});
2020

2121
const StateManager = (props): JSX.Element => {
22-
23-
const state = useSelector(store => store.appState)
24-
const isDarkMode = useSelector(state => state.darkMode.isDarkMode);
22+
const state = useSelector((store) => store.appState);
23+
const isDarkMode = useSelector((state) => state.darkMode.isDarkMode);
2524

2625
const { components } = state;
2726
const classes = useStyles();
@@ -31,27 +30,37 @@ const StateManager = (props): JSX.Element => {
3130
setValue(newValue);
3231
};
3332

34-
// add hook here to access which component has been clicked
35-
// then this will re-render the dataTable
33+
// add hook here to access which component has been clicked
34+
// then this will re-render the dataTable
3635

37-
const background_Color = isDarkMode ? '#21262b' : 'white'
36+
const background_Color = isDarkMode ? '#21262b' : 'white';
3837

3938
return (
4039
<React.Fragment>
41-
<div className={classes.contextContainer} style={{backgroundColor: background_Color}}>
40+
<div
41+
className={classes.contextContainer}
42+
style={{ backgroundColor: background_Color }}
43+
>
4244
<Box sx={{ width: '100%', typography: 'body1' }}>
4345
<TabContext value={value}>
4446
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
4547
<TabList onChange={handleChange} centered={true}>
46-
<Tab label="Create/Edit" value="1"/>
47-
<Tab label="Display" value="2" />
48+
<Tab
49+
label="Create/Edit"
50+
value="1"
51+
style={{ color: '#003366' }}
52+
/>
53+
<Tab label="Display" value="2" style={{ color: '#003366' }} />
4854
</TabList>
4955
</Box>
5056
<TabPanel value="1">
51-
<CreateContainer data={components} isThemeLight={props.isThemeLight } />
57+
<CreateContainer
58+
data={components}
59+
isThemeLight={props.isThemeLight}
60+
/>
5261
</TabPanel>
5362
<TabPanel value="2">
54-
<DisplayContainer data={components} props={props.props} />
63+
<DisplayContainer data={components} props={props.props} />
5564
</TabPanel>
5665
</TabContext>
5766
</Box>
@@ -60,4 +69,4 @@ const StateManager = (props): JSX.Element => {
6069
);
6170
};
6271

63-
export default StateManager;
72+
export default StateManager;

0 commit comments

Comments
 (0)