Skip to content

Commit 013cee4

Browse files
authored
Merge pull request #2 from oslabs-beta/ui-bugs
UI and backend bugs commented for implementation
2 parents c6d38ec + df15113 commit 013cee4

File tree

9 files changed

+35
-5
lines changed

9 files changed

+35
-5
lines changed

package/__tests__/linkFiber.test.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable react/jsx-filename-extension */
2-
import React from 'react';
2+
import React, { Component, useState } from 'react';
33
import { render } from 'react-dom';
44

55
const linkFiberRequire = require('../linkFiber');
@@ -8,7 +8,7 @@ let linkFiber;
88
let mode;
99
let snapShot;
1010

11-
class App extends React.Component {
11+
class App extends Component {
1212
constructor(props) {
1313
super(props);
1414
this.state = { foo: 'bar' };
@@ -20,6 +20,17 @@ class App extends React.Component {
2020
}
2121
}
2222

23+
// Need to create a functioanl component instance to test
24+
// Would need to be revised but here's the gist
25+
// const funcComponent = () => {
26+
// const [ number, setNumber ] = useState(0);
27+
// const newNumber = setNumber(1);
28+
29+
// return (
30+
// <div>{newNumber}</div>
31+
// )
32+
// }
33+
2334
describe('unit test for linkFiber', () => {
2435
beforeEach(() => {
2536
snapShot = { tree: null };

package/__tests__/timeJump.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ class FiberNode {
1919
}
2020
}
2121

22+
// MVP FEATURE: Additional Testing
23+
// Testing for useState and useContext
24+
25+
2226
describe('unit testing for timeJump.js', () => {
2327
let timeJump;
2428
let snapShot;

package/linkFiber.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ module.exports = (snap, mode) => {
4242

4343
function createTree(currentFiber, tree = new Tree('root')) {
4444
if (!currentFiber) return tree;
45-
45+
// We have to figure out which properties to destructure from currentFiber
46+
// To support hooks and Context API
4647
const { sibling, stateNode, child } = currentFiber;
4748

4849
let nextTree = tree;
@@ -53,7 +54,8 @@ module.exports = (snap, mode) => {
5354
// change setState functionality
5455
changeSetState(stateNode);
5556
}
56-
57+
// Need to check if functional component AND uses hooks
58+
5759
// iterate through siblings
5860
createTree(sibling, tree);
5961
// iterate through children

package/timeJump.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ module.exports = (origin, mode) => {
1212
// recursively change state of tree
1313
function jump(target, coords = []) {
1414
const originNode = traverseTree(origin.tree, coords);
15-
1615
// set the state of the origin tree
1716
originNode.component.setState(target.state, () => {
1817
// iterate through new children once state has been set

package/tree.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class Tree {
3535
}
3636

3737
// print out the tree in the console
38+
// BUG FIX: Don't print the Router as a component
39+
// Change how the children are printed
3840
print() {
3941
const children = ['children: '];
4042
this.children.forEach(child => {

src/app/components/Action.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import PropTypes from 'prop-types';
33

44
import { changeView, changeSlider } from '../actions/actions';
55

6+
// BUG FIX:
7+
// changeSlider should also respond to the click event on the div
8+
69
const Action = props => {
710
const {
811
selected, index, sliderIndex, dispatch,

src/app/components/Diff.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import ReactHtmlParser from 'react-html-parser';
55

66
import { useStoreContext } from '../store';
77

8+
// FIX: Update the div copy to something more explanatory
9+
810
function Diff({ snapshot, show }) {
911
const [mainState] = useStoreContext();
1012
const { currentTab, tabs } = mainState;

src/app/components/SwitchApp.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import Select from 'react-select';
33
import { useStoreContext } from '../store';
44
import { setTab } from '../actions/actions';
55

6+
7+
// BUG FIX: Fix the dropdown styling to make it more distinguishable
8+
69
const SwitchAppDropdown = () => {
710
const [{ currentTab, tabs }, dispatch] = useStoreContext();
811

src/app/containers/ActionContainer.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ import Action from '../components/Action';
55
import { emptySnapshots } from '../actions/actions';
66
import { useStoreContext } from '../store';
77

8+
// MVP Feature: Include a dropdown functionality
9+
// to show stateful/functional/Context API differentiation
10+
// May want to add another child component to the container
11+
812
function ActionContainer() {
913
const [{ tabs, currentTab }, dispatch] = useStoreContext();
1014
const { snapshots, sliderIndex, viewIndex } = tabs[currentTab];

0 commit comments

Comments
 (0)