Commit 14331be5 authored by Haakon Gunleiksrud's avatar Haakon Gunleiksrud
Browse files

Added more comments to the code.

parent 9c8d3a89
......@@ -5,6 +5,7 @@ import renderer from 'react-test-renderer'
describe('Testing App.js',()=>{
test('Snapshot match test', () => {
//Creates an instance of the App component and checkes to see if it matches the snapshot.
const tree = renderer.create(<App />).toJSON();
expect(tree).toMatchSnapshot();
})
......
......@@ -4,6 +4,7 @@ import renderer from 'react-test-renderer'
describe('Testing header.jsx',()=>{
//Creates an instance of the App component and checkes to see if it matches the snapshot.
test('Snapshot match test', () => {
const tree = renderer.create(<Header />).toJSON();
expect(tree).toMatchSnapshot();
......
......@@ -10,10 +10,10 @@ describe('Testing the index state',()=>{
let currentIndex = instance.state.currentIndex;
expect(instance.state.currentIndex).toBe(currentIndex);
// changing the state
// Changing the state
instance.goToNextSlide();
// currentIndex property is updated to `true`
// Cheking to see if currentIndex increments.
if(instance.state.currentIndex === 3){
expect(instance.state.currentIndex).toBe(0);
}
......@@ -28,10 +28,10 @@ describe('Testing the index state',()=>{
let currentIndex = instance.state.currentIndex;
expect(instance.state.currentIndex).toBe(currentIndex);
// changing the state
// Changing the state
instance.goToPrevSlide();
// currentIndex property is updated to `true`
// Cheking to see if currentIndex deincrements.
if (instance.state.currentIndex === 0){
expect(instance.state.currentIndex).toBe(3);
}
......@@ -44,10 +44,9 @@ describe('Testing the index state',()=>{
let tree = create(<MiddlePart />)
let instance = tree.getInstance();
// changing the state
// Changing the state
instance.goToFirstSlide();
// currentIndex property is updated to `true`
expect(instance.state.currentIndex).toBe(0);
})
......@@ -55,10 +54,9 @@ describe('Testing the index state',()=>{
let tree = create(<MiddlePart />)
let instance = tree.getInstance();
// changing the state
// Changing the state
instance.goToSecondSlide();
// currentIndex property is updated to `true`
expect(instance.state.currentIndex).toBe(1);
})
......@@ -69,7 +67,6 @@ describe('Testing the index state',()=>{
// changing the state
instance.goToThirdSlide();
// currentIndex property is updated to `true`
expect(instance.state.currentIndex).toBe(2);
})
......@@ -80,8 +77,6 @@ describe('Testing the index state',()=>{
// changing the state
instance.goToFourthSlide();
// currentIndex property is updated to `true`
expect(instance.state.currentIndex).toBe(3);
})
})
\ No newline at end of file
import React from 'react';
/*
Creates a header with just the title of the project.
*/
function Header(){
return (
<div className="header" id="header">
......
import React from 'react';
/*
Creates the next button to the right.
*/
class NextButton extends React.Component{
render(){
......
import React from 'react';
/*
Creates the prev button to the left.
*/
class PrevButton extends React.Component{
render(){
return (
......
import React, {Component} from 'react';
/*
Creates the sidebar to the right.
*/
class Sidebar extends Component {
constructor(props){
......
......@@ -11,11 +11,14 @@ import elevator1 from '../assets/sounds/elevatorMusic1.mp3'
import elevator2 from '../assets/sounds/elevatorMusic2.mp3'
import elevator3 from '../assets/sounds/elevatorMusic3.mp3'
import elevator4 from '../assets/sounds/loungeAmbient.mp3'
/*
Creates the sound box.
*/
class SoundBox extends React.Component{
constructor(props){
super(props);
//Loads the sound files directly
this.state = {
animals: [cat,horse,donkey,wolf],
laugh: [tidusLaugh,cartoonLaugh,crowdLaugh,laughTrack],
......
import React from 'react';
/*
Creates the text box.
*/
class TextBox extends React.Component{
constructor(props){
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment