diff --git a/app/js/filters/ctxcls.js b/app/js/filters/ctxcls.js
new file mode 100644
index 00000000..de84a147
--- /dev/null
+++ b/app/js/filters/ctxcls.js
@@ -0,0 +1,17 @@
+'use strict';
+
+var filtersModule = require('./_index.js');
+
+/**
+ * @ngInject
+ */
+function ctxcls($filter) {
+ return function(input) {
+ return input > 0.15 ? 'danger'
+ : input > 0.08 ? 'warning'
+ : input > 0 ? 'info'
+ : 'success';
+ };
+}
+
+filtersModule.filter('ctxcls', ctxcls);
diff --git a/app/views/grouped-runs.html b/app/views/grouped-runs.html
index 66d88491..646cd006 100644
--- a/app/views/grouped-runs.html
+++ b/app/views/grouped-runs.html
@@ -92,7 +92,7 @@
+ ng-class="job.failuresRate / 100 | ctxcls">
{{ job.name }} |
{{ job.passes }} |
{{ job.failures }} |
diff --git a/app/views/home.html b/app/views/home.html
index 3cbf3444..ea779e65 100644
--- a/app/views/home.html
+++ b/app/views/home.html
@@ -104,7 +104,7 @@
+ ng-class="p.failRate | ctxcls">
{{$index+1}} |
{{p.name}}
diff --git a/app/views/job.html b/app/views/job.html
index 423dcadd..92997f35 100644
--- a/app/views/job.html
+++ b/app/views/job.html
@@ -94,7 +94,7 @@
|
+ ng-class="test.failuresRate / 100 | ctxcls">
{{ test.name|limitTo:110 }} |
{{ test.passes|number }} |
{{ test.failures|number }} |
diff --git a/app/views/tests-detail.html b/app/views/tests-detail.html
index b2877fa7..1e75418c 100644
--- a/app/views/tests-detail.html
+++ b/app/views/tests-detail.html
@@ -54,7 +54,7 @@
+ ng-class="test.failureAverage | ctxcls">
{{test.test_id | limitTo: 110}}
|
diff --git a/test/unit/filters/ctxcls_spec.js b/test/unit/filters/ctxcls_spec.js
new file mode 100644
index 00000000..3f20961f
--- /dev/null
+++ b/test/unit/filters/ctxcls_spec.js
@@ -0,0 +1,41 @@
+describe('Ctxcls Filter', function() {
+
+ var ctxclsFilter;
+
+ beforeEach(function() {
+ module('app');
+ module('app.filters');
+ });
+
+ beforeEach(inject(function(_ctxclsFilter_) {
+ ctxclsFilter = _ctxclsFilter_;
+ }));
+
+ it('should return an error context class', function() {
+ expect(ctxclsFilter(1)).toBe('danger');
+ });
+
+ it('should return an error context class', function() {
+ expect(ctxclsFilter(0.151)).toBe('danger');
+ });
+
+ it('should return an waring context class', function() {
+ expect(ctxclsFilter(0.15)).toBe('warning');
+ });
+
+ it('should return an waring context class', function() {
+ expect(ctxclsFilter(0.081)).toBe('warning');
+ });
+
+ it('should return an info context class', function() {
+ expect(ctxclsFilter(0.08)).toBe('info');
+ });
+
+ it('should return an info context class', function() {
+ expect(ctxclsFilter(0.01)).toBe('info');
+ });
+
+ it('should return an success context class', function() {
+ expect(ctxclsFilter(0)).toBe('success');
+ });
+});