Skip to content

Commit

Permalink
fixes #5 by adding back template replacement for DateTime_Stamp and c…
Browse files Browse the repository at this point in the history
…orrecting logic
  • Loading branch information
a11smiles committed Jan 2, 2017
1 parent 35f80cd commit 0e4ff2c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 21 deletions.
1 change: 1 addition & 0 deletions lib/reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ var HtmlDetailedReporter = function (baseReporterDecorator, config, logger, help
// Replace remaining placeholders
template = template.replace('{{Auto_Reload}}', autoReload);
template = template.replace('{{Refresh_Timeout}}', refreshTimeout);
template = template.replace('{{DateTime_Stamp}}', formatTimestamp());
template = template.replace('{{Total_Test_Count}}', counts.totalCnt);
template = template.replace('{{Total_Pass_Count}}', counts.passCnt);
template = template.replace('{{Total_Skip_Count}}', counts.skipCnt);
Expand Down
49 changes: 28 additions & 21 deletions template.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,33 @@
</style>
<script src="{{jquery_Path}}/jquery.min.js"></script>
<script>
var reload = {{Auto_Reload}};

var reload = shouldReload();

var shouldReload = function() {
if (location.search != null && location.search != undefined && location.search.length > 0)
return location.search.substr(1) === 'true' ? true : false;
else
return {{Auto_Reload}};
};

var setState = function(status) {
if (status) {
$('#refreshBtn').removeClass('btn-danger');
$('#refreshBtn').addClass('btn-success');
$('#refreshBtn').text('Enable Refresh');
} else {
$('#refreshBtn').removeClass('btn-success');
$('#refreshBtn').addClass('btn-danger');
$('#refreshBtn').text('Disable Refresh');
}
};

var refresh = function() {
if (reload) {
location.search = reload;
}
};

$(document).ready(function() {
setState(!reload);

Expand All @@ -47,26 +72,8 @@
}
});

var setState = function(status) {
if (status) {
$('#refreshBtn').removeClass('btn-danger');
$('#refreshBtn').addClass('btn-success');
$('#refreshBtn').text('Enable Refresh');
} else {
$('#refreshBtn').removeClass('btn-success');
$('#refreshBtn').addClass('btn-danger');
$('#refreshBtn').text('Disable Refresh');
}
}

var refresh = function() {
if (reload) {
location.reload();
}
};

setTimeout(refresh, {{Refresh_Timeout}});
})
});
</script>
</head>
<body id="REPORT_TEMPLATE">
Expand Down

0 comments on commit 0e4ff2c

Please sign in to comment.