Skip to content

Commit

Permalink
more test data. restructure rendering slightly to be per-suite
Browse files Browse the repository at this point in the history
  • Loading branch information
enjalot committed Feb 19, 2016
1 parent a942e82 commit f29e0e8
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 22 deletions.
23 changes: 13 additions & 10 deletions electron/css/dataproofer.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,18 @@ button.tabletop-loader {
Test specific CSS
*/

.test-results {
.suites {
padding: 5px;
position: absolute;
top: 0;
width: 100%;
height: calc(100% - 200px);
overflow-y: scroll;
}
.test-results .test {
.suite {
float: left;
}
.suite .test {
margin: 3px;
padding: 10px;
margin-top: 10px;
Expand All @@ -80,36 +83,36 @@ button.tabletop-loader {
background-color: white;
border-radius: 3px;
}
.test-results .test:nth-child(odd) {
.suite .test:nth-child(odd) {
background-color: #efefef;
}

.test-results .test .passfail {
.suite .test .passfail {
width: 20px;
float:left;
}

.test-results .test .message {
.suite .test .message {
float:left;
width: calc(100% - 245px);
}

.test-results .test .test-header {
.suite .test .test-header {
font-size: 14px;
font-weight: bold;
}
.test-results .test .test-column {
.suite .test .test-column {
font-size: 12px;
font-weight: bold;
font-style: italic;
}
.test-results .test .test-value {
.suite .test .test-value {
font-weight: bold;
font-family; Courier;
}

.test-results .test .fingerprint {
.suite .test .fingerprint {
width: 200px;
float: right;
margin-right: 25px;
}
}
4 changes: 2 additions & 2 deletions electron/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ <h5 class="nav-group-title">Test Suites</h5>
</div>

<div class="pane">
<div class="test-results">
<div class="suites">
<!-- we will insert our results here -->
</div>
<div id="grid">
Expand All @@ -71,6 +71,6 @@ <h5 class="nav-group-title">Test Suites</h5>
<!-- Javascript -->
<script src="js/renderer.js"></script>
<script src="js/processor.js"></script>

</body>
</html>
26 changes: 20 additions & 6 deletions electron/js/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ var Renderer = require('dataproofer').Rendering;
function HTMLRenderer(config) {
Renderer.call(this, config)
window.rows = config.rows;
this.resultList = [];
var resultList = {}
config.suites.forEach(function(suite) {
resultList[suite.name] = []
})
this.resultList = resultList;

var columns = [];
Object.keys(rows[0]).forEach(function(col) {
Expand All @@ -24,23 +28,33 @@ function HTMLRenderer(config) {
var grid = new SlickGrid("#grid", rows, columns, options);
this.grid = grid;

d3.select(".test-results").selectAll(".test").remove();
d3.select(".suites").selectAll(".suite").remove();
d3.select(".suites").selectAll(".suite")
.data(config.suites)
.enter().append("div")
.attr({
class: function(d) { return "suite " + d.name }
})
.append("h2").text(function(d) { return d.name })
//d3.select(".test-results").selectAll(".test").remove();
}

HTMLRenderer.prototype = Object.create(Renderer.prototype, {})
HTMLRenderer.prototype.constructor = HTMLRenderer;

HTMLRenderer.prototype.addResult = function(suite, test, result) {
//console.log("add result", suite, test, result)
console.log(suite, test.name());
//console.log("this results", this.results);
this.results[suite][test] = result;
this.resultList.push({ suite: suite, test: test, result: result })
this.resultList[suite].push({ suite: suite, test: test, result: result })

// A reference to our SlickGrid table so we can manipulate it via the fingerprint
var grid = this.grid;

var tests = d3.select(".test-results").selectAll(".test")
.data(this.resultList)
var container = d3.select("." + suite)
console.log("container", container)
var tests = container.selectAll(".test")
.data(this.resultList[suite])

var testsEnter = tests.enter().append("div").classed("test", true)
testsEnter.append("div").classed("passfail", true)
Expand Down
7 changes: 4 additions & 3 deletions sample-datasets/geo-test.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name,latlon,tag
enjalot,"1337.8162046,-122.2911677",cool
gerald,"37.8,-122.2911677",sweet
ejfox,"97.8162046,222.2911677",awesome
enjalot,"1337.8162046,-122.2911677",bad
gerald,"37.8,-122.2911677",good
ejfox,"97.8162046,222.2911677",bad
null island,"0,0",bad
2 changes: 1 addition & 1 deletion sample-datasets/silk-road-arrests.csv
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Laurence Lindberg,Contra Costa,California,USA,-121.9175345,37.9034806,administra
Alicia Mitts,Contra Costa,California,USA,-121.9175345,37.9034806,administrative,5/28/2014,Produced and sold fake Xanax pills,,30 year-old part of Jeremy Donagal's Xanax drug ring,http://www.mercurynews.com/my-town/ci_25861423/contra-costa-nine-charged-massive-xanax-drug-operation
Thomas Elliott,Contra Costa,California,USA,-121.9175345,37.9034806,administrative,5/28/2014,Produced and sold fake Xanax pills,,39 year-old part of Jeremy Donagal's Xanax drug ring,http://www.mercurynews.com/my-town/ci_25861423/contra-costa-nine-charged-massive-xanax-drug-operation
Michael Tomada,Contra Costa,California,USA,-121.9175345,37.9034806,administrative,5/28/2014,Produced and sold fake Xanax pills,,42 year-old part of Jeremy Donagal's Xanax drug ring,http://www.mercurynews.com/my-town/ci_25861423/contra-costa-nine-charged-massive-xanax-drug-operation
Christopher Neely,Contra Costa,California,USA,-121.9175345,37.9034806,administrative,5/28/2014,Produced and sold fake Xanax pills,,part of Jeremy Donagal's Xanax drug ring. Sitll at large.,http://www.mercurynews.com/my-town/ci_25861423/contra-costa-nine-charged-massive-xanax-drug-operation
Christopher Neely,Contra Costa,California,USA,0,0,administrative,5/28/2014,Produced and sold fake Xanax pills,,part of Jeremy Donagal's Xanax drug ring. Sitll at large.,http://www.mercurynews.com/my-town/ci_25861423/contra-costa-nine-charged-massive-xanax-drug-operation
"Kenneth Koskiniemi,",Contra Costa,California,USA,-121.9175345,37.9034806,administrative,5/28/2014,Produced and sold fake Xanax pills,,37 year-old part of Jeremy Donagal's Xanax drug ring,http://www.mercurynews.com/my-town/ci_25861423/contra-costa-nine-charged-massive-xanax-drug-operation
Duston Kirk,Contra Costa,California,USA,-121.9175345,37.9034806,administrative,,Produced and sold fake Xanax pills,,38 year-old part of Jeremy Donagal's Xanax drug ring,http://www.mercurynews.com/my-town/ci_25861423/contra-costa-nine-charged-massive-xanax-drug-operation
Michael Gonzalez,Contra Costa,California,USA,-121.9175345,37.9034806,administrative,5/28/2014,Produced and sold fake Xanax pills,,41 year-old part of Jeremy Donagal's Xanax drug ring,http://www.mercurynews.com/my-town/ci_25861423/contra-costa-nine-charged-massive-xanax-drug-operation
Expand Down

0 comments on commit f29e0e8

Please sign in to comment.