Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
#827: Polished and fixed alert class style when restarting tests for …
…junit plugin.
  • Loading branch information
davsclaus committed Dec 10, 2013
1 parent 2206bf1 commit 3347d34
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 28 deletions.
21 changes: 11 additions & 10 deletions hawtio-web/src/main/webapp/app/junit/html/tests.html
Expand Up @@ -32,15 +32,14 @@
<div class="row-fluid">
<div ng-show="runningTests()" class="alert alert-{{alertClass}}">

<strong>Testing Summary</strong>
<strong>Testing in progress ...</strong>

<br/> Running: <strong>{{inProgressData.running}}</strong>
<br/> Testing class: <strong>{{inProgressData.testClass}}</strong>
<br/> Testing method: <strong>{{inProgressData.testMethod}}</strong>
<br/> Run count: <strong>{{inProgressData.runCount}}</strong>
<br/> Failure count: <strong>{{inProgressData.failureCount}}</strong>
<br/> Ignore count: <strong>{{inProgressData.ignoreCount}}</strong>
<br/> Time: <strong>{{inProgressData.runTime}} ms</strong>
<br/> Run: <strong>{{inProgressData.runCount}}</strong>
<br/> Failure: <strong>{{inProgressData.failureCount}}</strong>
<br/> Ignore: <strong>{{inProgressData.ignoreCount}}</strong>
<br/> Elapsed time: <strong>{{inProgressData.runTime}}</strong> ms

</div>
</div>
Expand All @@ -49,10 +48,12 @@
<div ng-show="testResults" class="alert alert-{{alertClass}}">
<button type="button" class="close" ng-click="clearResults()">&times;</button>

<br/> Run count: <strong>{{testResults.runCount}}</strong>
<br/> Failure count: <strong>{{testResults.failureCount}}</strong>
<br/> Ignore count: <strong>{{testResults.ignoreCount}}</strong>
<br/> Time: <strong>{{testResults.runTime}} ms</strong>
<strong>Test Results</strong>

<br/> Run: <strong>{{testResults.runCount}}</strong>
<br/> Failure: <strong>{{testResults.failureCount}}</strong>
<br/> Ignore: <strong>{{testResults.ignoreCount}}</strong>
<br/> Elapsed time: <strong>{{testResults.runTime}}</strong> ms

<ul class="failures">
<li ng-repeat="failure in testResults.failures | filter:resultSearchTest" class="failure">
Expand Down
39 changes: 21 additions & 18 deletions hawtio-web/src/main/webapp/app/junit/js/tree.ts
Expand Up @@ -55,6 +55,7 @@ module JUnit {

$scope.clearResults = () => {
$scope.testResults = null;
$scope.alertClass = "success";
inProgressStatus.data = null;
inProgressStatus.alertClass = "success";
};
Expand Down Expand Up @@ -153,19 +154,6 @@ module JUnit {
}
};

function renderResults(results) {
$scope.testResults = results;
$scope.running = false;
var alertClass = "error";
if (results.successful) {
alertClass = "success";
} else if (!results.runCount) {
alertClass = "warning";
}
$scope.alertClass = alertClass;
Core.$apply($scope);
}

var renderInProgress = function (response) {
var result = response.value;
if (result) {
Expand All @@ -192,9 +180,27 @@ module JUnit {
}
};

var renderResults = function (result) {
if (result) {
log.info("Render results: " + result);

inProgressStatus.data = null;
inProgressStatus.alertClass = null;

var alertClass = "success";
if (result.failureCount > 0) {
alertClass = "error";
}
$scope.alertClass = alertClass;
$scope.testResults = result;

Core.$apply($scope);
}
}

function runTests(listOfClassNames) {
$scope.running = true;
$scope.testResults = null;
// reset before running new set of unit tests
$scope.clearResults();

var mbean = getJUnitMBean(workspace);
if (mbean && listOfClassNames && listOfClassNames.length) {
Expand All @@ -209,9 +215,6 @@ module JUnit {
arguments: []
});

// reset before running new set of unit tests
$scope.clearResults();

// execute the unit tests
jolokia.execute(mbean, "runTestClasses", listOfClassNames, onSuccess(renderResults));
}
Expand Down

0 comments on commit 3347d34

Please sign in to comment.