Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Haakon Gunleiksrud
IT2819_h19_p2_haakon
Commits
6a31c696
Commit
6a31c696
authored
Sep 27, 2019
by
Turid Cecilie Dahl
Browse files
Merge remote-tracking branch 'origin/test_cleaning' into turid_sandbox
parents
ab581b72
14331be5
Changes
9
Hide whitespace changes
Inline
Side-by-side
prosjekt2/src/__tests__/App.tests.js
View file @
6a31c696
...
...
@@ -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
();
})
...
...
prosjekt2/src/__tests__/Header.tests.js
View file @
6a31c696
...
...
@@ -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
();
...
...
prosjekt2/src/__tests__/MiddlePart.tests.js
View file @
6a31c696
...
...
@@ -10,10 +10,10 @@ describe('Testing the index state',()=>{
let
currentIndex
=
instance
.
state
.
currentIndex
;
expect
(
instance
.
state
.
currentIndex
).
toBe
(
currentIndex
);
//
c
hanging the state
//
C
hanging 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
);
//
c
hanging the state
//
C
hanging 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
();
//
c
hanging the state
//
C
hanging 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
();
//
c
hanging the state
//
C
hanging 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
prosjekt2/src/components/Header.jsx
View file @
6a31c696
import
React
from
'
react
'
;
/*
Creates a header with just the title of the project.
*/
function
Header
(){
return
(
<
div
className
=
"header"
id
=
"header"
>
...
...
prosjekt2/src/components/NextButton.jsx
View file @
6a31c696
import
React
from
'
react
'
;
/*
Creates the next button to the right.
*/
class
NextButton
extends
React
.
Component
{
render
(){
...
...
prosjekt2/src/components/PrevButton.jsx
View file @
6a31c696
import
React
from
'
react
'
;
/*
Creates the prev button to the left.
*/
class
PrevButton
extends
React
.
Component
{
render
(){
return
(
...
...
prosjekt2/src/components/Sidebar.jsx
View file @
6a31c696
import
React
,
{
Component
}
from
'
react
'
;
/*
Creates the sidebar to the right.
*/
class
Sidebar
extends
Component
{
constructor
(
props
){
...
...
prosjekt2/src/components/SoundBox.jsx
View file @
6a31c696
...
...
@@ -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
],
...
...
prosjekt2/src/components/TextBox.jsx
View file @
6a31c696
import
React
from
'
react
'
;
/*
Creates the text box.
*/
class
TextBox
extends
React
.
Component
{
constructor
(
props
){
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment