Skip to content

Commit fae64a4

Browse files
committed
Good looking text boxes also function correctly.
1 parent 32f7de6 commit fae64a4

3 files changed

Lines changed: 21 additions & 15 deletions

File tree

src/components/mainService.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/************* MAIN SERVICE ***************/
2+
13
angular.module('app').service('mainService', function($http, $q, $sce) {
24

35
// $sce.trustAsResourceUrl('/s');
@@ -69,14 +71,14 @@ this.user = {}
6971
this.randomKata = () => {
7072
return $http({
7173
method: 'GET',
72-
url: `/kata/random`
74+
url: `/kata/random`
7375
});
7476
};
7577

7678
this.randomKyuKata = (kyu) => {
7779
return $http({
7880
method: 'GET',
79-
url: `/kata/random/` + kyu
81+
url: `/kata/random/` + kyu
8082
});
8183
};
8284

src/components/training/training.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ <h3 class="font16-reg" id="kata-name">
1313
</h3>
1414
</div>
1515

16+
1617
<div class="kata-stats">
1718
<p>Here's where stats go</p>
1819
<p>Here's where stats go</p>
@@ -79,9 +80,9 @@ <h2 class="font20-reg">Name of Kata</h2>
7980
<p>Example Tests:</p>
8081
<form>
8182
<textarea name="examples" id="example-input" ng-init="examplesInput = 'Test.assertEquals(a, 1);'" id="example-tests-input" ng-model="examplesInput"></textarea>
82-
<button ng-click="testExamples(solutionInput, examplesInput)" class="test-examples-button font12-reg-blue">RUN EXAMPLES</button>
83-
<button ng-click="testSuite(solutionInput)" class="test-suite-button font12-reg-black" style=""><i class="fa fa-caret-right fa-lg" style="margin-right: 2px" aria-hidden="true"></i>ATTEMPT</button>
8483
</form>
84+
<button ng-click="testExamples()" class="test-examples-button font12-reg-blue">RUN EXAMPLES</button>
85+
<button ng-click="testSuite(solutionInput)" class="test-suite-button font12-reg-black" style=""><i class="fa fa-caret-right fa-lg" style="margin-right: 2px" aria-hidden="true"></i>ATTEMPT</button>
8586
</div>
8687
</div>
8788
</div>

src/components/training/trainingCtrl.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
angular.module('app').controller('trainingCtrl', function($scope, $state, mainService) {
66

7-
var textarea = document.getElementById('solution-input');
8-
var myCodeMirror = CodeMirror.fromTextArea(textarea, {
9-
lineNumbers: true,
7+
var textarea1 = document.getElementById('solution-input');
8+
var solutionsCode = CodeMirror.fromTextArea(textarea1, {
9+
lineNumbers: true,
1010
theme: 'seti',
1111
});
1212

13-
var textarea = document.getElementById('example-input');
14-
var myCodeMirror = CodeMirror.fromTextArea(textarea, {
15-
lineNumbers: true,
13+
var textarea2 = document.getElementById('example-input');
14+
var examplesCode = CodeMirror.fromTextArea(textarea2, {
15+
lineNumbers: true,
1616
theme: 'seti',
1717
});
1818

@@ -30,18 +30,21 @@ var textarea = document.getElementById('solution-input');
3030
$scope.showInstructions = function() {
3131
$scope.showOutputShow = true;
3232
$scope.showInstructionsShow = false;
33-
}
33+
}//comment
3434

3535
//Examples should be an array of objects. Returned results will be an array with the different tests and their results.
36-
$scope.testExamples = function(solutions, examples) {
36+
$scope.testExamples = function() {
37+
let solutions = solutionsCode.getValue();
38+
let examples = examplesCode.getValue();
3739
$scope.showOutput();
3840
solutions = solutions.replace(/\n/g, " ");
41+
solutions = solutions.replace(/\s+/g, " ");
3942
let examplesArr = [];
40-
console.log(examples);
43+
console.log("solutions: ", solutions, " examples: ", examples);
4144
examples = examples.split(/\n/);
4245
console.log(examples);
43-
examples.forEach(example => examplesArr.push({test: example}));
44-
mainService.testExamples(solutions, examplesArr).then((response) => $scope.output.push(response.data[0]));
46+
// examples.forEach(example => examplesArr.push({test: example}));
47+
// mainService.testExamples(solutions, examplesArr).then((response) => $scope.output.push(response.data[0]));
4548
}
4649

4750

0 commit comments

Comments
 (0)