Commit 9c8d3a89 authored by Haakon Gunleiksrud's avatar Haakon Gunleiksrud
Browse files

Deleted the snapshots, and fixed classList = null bug

parent d9a15a9f
......@@ -7,31 +7,42 @@ describe('Testing the index state',()=>{
test('testing if the index state variable increments when the nextButton is pressed', () => {
let tree = create(<MiddlePart />)
let instance = tree.getInstance();
expect(instance.state.currentIndex).toBe(0);
let currentIndex = instance.state.currentIndex;
expect(instance.state.currentIndex).toBe(currentIndex);
// changing the state
instance.goToNextSlide();
// currentIndex property is updated to `true`
expect(instance.state.currentIndex).toBe(1);
if(instance.state.currentIndex === 3){
expect(instance.state.currentIndex).toBe(0);
}
else{
expect(instance.state.currentIndex).toBe(currentIndex+1);
}
})
test('testing if the index state variable deincrements when the prevButton is pressed', () => {
let tree = create(<MiddlePart />)
let instance = tree.getInstance();
expect(instance.state.currentIndex).toBe(0);
let currentIndex = instance.state.currentIndex;
expect(instance.state.currentIndex).toBe(currentIndex);
// changing the state
instance.goToPrevSlide();
// currentIndex property is updated to `true`
if (instance.state.currentIndex === 0){
expect(instance.state.currentIndex).toBe(3);
}
else{
expect(instance.state.currentIndex).toBe(currentIndex-1);
}
})
test('testing if the index state variable changes to 0 when the first navigation button is pressed.', () => {
let tree = create(<MiddlePart />)
let instance = tree.getInstance();
expect(instance.state.currentIndex).toBe(0);
// changing the state
instance.goToFirstSlide();
......@@ -43,7 +54,6 @@ describe('Testing the index state',()=>{
test('testing if the index state variable changes to 1 when the second navigation button is pressed.', () => {
let tree = create(<MiddlePart />)
let instance = tree.getInstance();
expect(instance.state.currentIndex).toBe(0);
// changing the state
instance.goToSecondSlide();
......@@ -55,7 +65,6 @@ describe('Testing the index state',()=>{
test('testing if the index state variable changes to 2 when the third navigation button is pressed.', () => {
let tree = create(<MiddlePart />)
let instance = tree.getInstance();
expect(instance.state.currentIndex).toBe(0);
// changing the state
instance.goToThirdSlide();
......@@ -67,7 +76,6 @@ describe('Testing the index state',()=>{
test('testing if the index state variable changes to 3 when the fourth navigation button is pressed.', () => {
let tree = create(<MiddlePart />)
let instance = tree.getInstance();
expect(instance.state.currentIndex).toBe(0);
// changing the state
instance.goToFourthSlide();
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Testing header.jsx Snapshot match test 1`] = `
<div
className="header"
id="header"
>
Awesome art collections!
</div>
`;
......@@ -13,6 +13,9 @@ class NavigationDots extends React.Component{
Updates the classes of the dot-buttons.
*/
toggleClasses = () => {
if (document.getElementById('dot_0') === null){
return
}
for (let i=0; i<4; i++){
if (this.props.currentIndex===i){
document.getElementById('dot_'+i).classList += [" activeDot"]
......@@ -28,6 +31,7 @@ class NavigationDots extends React.Component{
}
render(){
//this.toggleClasses();
return (
<div className="navDots">
<button id="dot_0" className = "dot" onClick={this.props.goToFirstSlide}></button>
......
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