Skip to content

Commit

Permalink
Merge ac606ee into 94d73f3
Browse files Browse the repository at this point in the history
  • Loading branch information
campos20 authored Sep 10, 2020
2 parents 94d73f3 + ac606ee commit ca0c483
Show file tree
Hide file tree
Showing 11 changed files with 758 additions and 73 deletions.
24 changes: 17 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
language: java
jdk: openjdk8
sudo: true
jobs:
include:
- language: java
jdk: openjdk8
sudo: true
script:
- ./gradlew assemble
- ./gradlew check
- ./gradlew buildOfficial

script:
- ./gradlew assemble
- ./gradlew check
- ./gradlew buildOfficial
- language: node_js
node_js: 10
script:
- cd tnoodle-ui
- npm install
- npm test -- --coverage
after_script:
- COVERALLS_REPO_TOKEN=$coveralls_repo_token npm run coveralls
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

TNoodle is a software suite that contains the official WCA scramble program. It consists of the core scrambling code (primarily written in Java) as well as a UI and server to generate a fully autonomous JAR file

[![Build Status](https://travis-ci.org/thewca/tnoodle.svg?branch=master)](https://travis-ci.org/thewca/tnoodle)
[![Build Status](https://travis-ci.org/thewca/tnoodle.svg?branch=master)](https://travis-ci.org/thewca/tnoodle) [![Coverage Status](https://coveralls.io/repos/github/thewca/tnoodle/badge.svg?branch=master)](https://coveralls.io/github/thewca/tnoodle?branch=master)

## WCA Scramble Program

Expand Down
90 changes: 46 additions & 44 deletions tnoodle-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,46 +1,48 @@
{
"name": "tnoodle-ui",
"version": "0.1.0",
"private": true,
"homepage": "http://localhost:2014/scramble",
"proxy": "http://localhost:2014",
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"bootstrap": "^4.4.1",
"fetch-intercept": "^2.3.1",
"node-sass": "^4.13.1",
"react": "^16.12.0",
"react-bootstrap": "^1.0.0-beta.16",
"react-dom": "^16.12.0",
"react-icons": "^3.10.0",
"react-redux": "^7.1.3",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.3",
"redux": "^4.0.5"
},
"eslintConfig": {
"extends": "react-app"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --watchAll --watchAll=false",
"eject": "react-scripts eject",
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
"name": "tnoodle-ui",
"version": "0.1.0",
"private": true,
"homepage": "http://localhost:2014/scramble",
"proxy": "http://localhost:2014",
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"bootstrap": "^4.4.1",
"fetch-intercept": "^2.3.1",
"node-sass": "^4.13.1",
"react": "^16.12.0",
"react-bootstrap": "^1.0.0-beta.16",
"react-dom": "^16.12.0",
"react-icons": "^3.10.0",
"react-redux": "^7.1.3",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.3",
"redux": "^4.0.5"
},
"eslintConfig": {
"extends": "react-app"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --watchAll --watchAll=false",
"eject": "react-scripts eject",
"coveralls": "cat ./coverage/lcov.info | node node_modules/.bin/coveralls"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"coveralls": "^3.1.0"
}
}
67 changes: 67 additions & 0 deletions tnoodle-ui/src/components/EntryInterface.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import React from "react";
import { act } from "react-dom/test-utils";

import { render, unmountComponentAtNode } from "react-dom";
import { fireEvent } from "@testing-library/react";

import { Provider } from "react-redux";
import store from "../redux/Store";

import EntryInterface from "./EntryInterface";

let container = null;
beforeEach(() => {
// setup a DOM element as a render target
container = document.createElement("div");
document.body.appendChild(container);
});

afterEach(() => {
// cleanup on exiting
unmountComponentAtNode(container);
container.remove();
container = null;
});

it("Competition name should be already filled with current date", () => {
// Render component
act(() => {
render(
<Provider store={store}>
<EntryInterface />
</Provider>,
container
);
});

const today = new Date().toISOString().split("T")[0];

const competitionNameInput = container.querySelector("#competition-name");
expect(competitionNameInput.value).toEqual("Scrambles for " + today);
});

it("Password should toggle", () => {
// Render component
act(() => {
render(
<Provider store={store}>
<EntryInterface />
</Provider>,
container
);
});

const input = container.querySelector("#password");
const passwordToggler = container.querySelector(".input-group-prepend");

fireEvent.change(input, { target: { value: "123456" } });

// Type password at first
expect(input.type).toBe("password");

// After the click, it should be type text
fireEvent.click(passwordToggler);
expect(input.type).toBe("text");

expect(input.value).toBe("123456");
});
12 changes: 6 additions & 6 deletions tnoodle-ui/src/components/EventPickerTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ const EventPickerTable = connect(
mapDispatchToProps
)(
class extends Component {
componentDidMount = function () {
componentDidMount() {
this.getFormats();
this.getWcaEvents();
this.getFmcTranslations();
};
}

getFormats = () => {
fetchFormats()
Expand All @@ -49,8 +49,8 @@ const EventPickerTable = connect(
return response.json();
}
})
.then((formats) => {
this.props.setWcaFormats(formats);
.then((response) => {
this.props.setWcaFormats(response);
});
};

Expand All @@ -61,8 +61,8 @@ const EventPickerTable = connect(
return response.json();
}
})
.then((wcaEvents) => {
this.props.setWcaEvents(wcaEvents);
.then((response) => {
this.props.setWcaEvents(response);
});
};

Expand Down
15 changes: 10 additions & 5 deletions tnoodle-ui/src/components/FmcTranslationsDetail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,23 @@ const FmcTranslationsDetail = connect(
checked={
translation.status
}
onChange={(e) =>
onChange={(
e
) =>
this.handleTranslation(
translation.id, e.target.checked
translation.id,
e
.target
.checked
)
}
/>
</th>
{j <
TRANSLATIONS_PER_LINE -
1 && (
<th />
)}
1 && (
<th />
)}
</React.Fragment>
);
}
Expand Down
Loading

0 comments on commit ca0c483

Please sign in to comment.