Skip to content

Commit 947d002

Browse files
authored
Merge pull request #64 from oslabs-beta/staging
Created a 4.0 version of the Reactime Website
2 parents b4ac425 + d8a9236 commit 947d002

File tree

4 files changed

+126
-5
lines changed

4 files changed

+126
-5
lines changed

src/app/__tests__/PerfView.test.tsx

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
import React from 'react';
2+
import { configure, mount } from 'enzyme';
3+
// import { act } from 'react-dom/test-utils';
4+
import Adapter from 'enzyme-adapter-react-16';
5+
import PerfView from '../components/PerfView';
6+
// import { iterator } from 'core-js/fn/symbol';
7+
8+
// Unit test cases for PerfView
9+
configure({ adapter: new Adapter() });
10+
11+
// Test props and basic rendering
12+
describe('PerfView Component ', () => {
13+
const snapshot0 = {
14+
name: 'root',
15+
state: 'root',
16+
componentData: {},
17+
children:
18+
[
19+
{
20+
name: 'App',
21+
state: { num: 0 },
22+
componentData: { actualDuration: 10000 },
23+
children:
24+
[
25+
{
26+
name: 'DisplayPanel', state: 'stateless', componentData: { actualDuration: 5000 }, children: [],
27+
},
28+
{
29+
name: 'AltDisplay', state: 'stateless', componentData: { actualDuration: 4000 }, children: [],
30+
},
31+
{
32+
name: 'Button Panel',
33+
state: 'stateless',
34+
componentData: { actualDuration: 3000 },
35+
children:
36+
[
37+
{
38+
name: 'Button', state: { num: 0 }, componentData: { actualDuration: 2000 }, children: [],
39+
},
40+
{
41+
name: 'Button', state: { num: 0 }, componentData: { actualDuration: 1000 }, children: [],
42+
},
43+
],
44+
},
45+
{
46+
name: 'MarketSContainer', state: 'stateless', componentData: { actualDuration: 500 }, children: [],
47+
},
48+
{
49+
name: 'MainSlider', state: 'stateless', componentData: { actualDuration: 100 }, children: [],
50+
},
51+
],
52+
},
53+
],
54+
};
55+
56+
const snapshot1 = {
57+
name: 'root',
58+
state: 'root',
59+
componentData: {},
60+
children:
61+
[
62+
{
63+
name: 'App',
64+
state: { num: 1 },
65+
componentData: { actualDuration: 10 },
66+
children:
67+
[
68+
{
69+
name: 'DisplayPanel', state: 'stateless', componentData: { actualDuration: 50 }, children: [],
70+
},
71+
{
72+
name: 'AltDisplay', state: 'stateless', componentData: { actualDuration: 40 }, children: [],
73+
},
74+
{
75+
name: 'Button Panel',
76+
state: 'stateless',
77+
componentData: { actualDuration: 30 },
78+
children:
79+
[
80+
{
81+
name: 'Button', state: { num: 2 }, componentData: { actualDuration: 20 }, children: [],
82+
},
83+
{
84+
name: 'Button', state: { num: 3 }, componentData: { actualDuration: 10 }, children: [],
85+
},
86+
],
87+
},
88+
{
89+
name: 'MarketSContainer', state: 'stateless', componentData: { actualDuration: 5 }, children: [],
90+
},
91+
{
92+
name: 'MainSlider', state: 'stateless', componentData: { actualDuration: 1 }, children: [],
93+
},
94+
],
95+
},
96+
],
97+
};
98+
99+
let wrapper;
100+
const snapshots = [];
101+
snapshots.push(snapshot0);
102+
snapshots.push(snapshot1);
103+
104+
beforeEach(() => {
105+
wrapper = mount(<PerfView viewIndex={-1} snapshots={snapshots} width={600} height={600} />);
106+
});
107+
108+
it('allows us to set viewIndex prop', () => {
109+
expect(wrapper.props().viewIndex).toEqual(-1);
110+
111+
wrapper.setProps({ viewIndex: 0 });
112+
expect(wrapper.props().viewIndex).toEqual(0);
113+
114+
// wrapper.setProps({ viewIndex: 1000 });
115+
});
116+
117+
it('renders a single svg element', () => {
118+
expect(wrapper.find('svg')).toHaveLength(1);
119+
});
120+
});

src/app/components/PerfView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ const PerfView = (props:PerfViewProps) => {
4141
// Set up color scaling function
4242
const colorScale = d3.scaleLinear()
4343
.domain([0, 7])
44-
.range(['hsl(152,30%,80%)', 'hsl(228,30%,40%)'])
45-
// .range(['hsl(210,30%,80%)', 'hsl(152,30%,40%)'])
44+
.range(['hsl(200,60%,60%)', 'hsl(255,30%,30%)'])
45+
// .range(['hsl(152,30%,80%)', 'hsl(228,30%,40%)'])
4646
.interpolate(d3.interpolateHcl);
4747

4848
// Set up circle-packing layout function

src/app/styles/components/d3graph.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ div.tooltip {
114114
}
115115

116116
.perf-chart-labels {
117-
font: 12px sans-serif;
117+
font: 1.3em sans-serif;
118+
/* font-size: calc(12px + .8vw); */
118119
/* color: white; */
119120
/* fill: rgb(231, 231, 231); */
120121
fill: #2a2f3a;
121122
pointer-events: none;
122123
text-anchor: middle;
123-
};
124-
124+
};

website/reactime-marketing

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 729437f14d2a0db4d8484c1dba308306f0aa080b

0 commit comments

Comments
 (0)