update test stats ui

This commit is contained in:
rolux 2012-06-12 17:37:35 +02:00
parent b915839305
commit 84d345624f

View file

@ -61,7 +61,7 @@ Ox.DocPanel = function(options, self) {
}
});
self.$toolbar = Ox.Bar({size: 24});
self.$toolbar = Ox.Bar({size: 24}).css({textAlign: 'center'});
self.$list = Ox.Element();
self.$sidebar = Ox.SplitPanel({
elements: [
@ -71,22 +71,20 @@ Ox.DocPanel = function(options, self) {
orientation: 'vertical'
});
self.$page = Ox.Element();
self.$testsStatus = $('<div>')
.css({marginTop: '5px', textAlign: 'center'})
.appendTo(self.$toolbar);
if (!self.options.results) {
self.options.results = {};
self.$testsButton = Ox.Button({title: 'Run Tests'})
.css({float: 'left', margin: '4px'})
.css({margin: '4px auto'})
.bindEvent({click: runTests})
.appendTo(self.$toolbar);
self.$testsLabel = Ox.Label({title: 'Running Tests...'}).hide();
self.$testsStatus.hide();
} else {
self.$testsLabel = Ox.Label({title: formatResults()});
self.$testsStatus.html(formatResults());
}
self.$testsLabel
.css({float: 'left', margin: '4px'})
.appendTo(self.$toolbar);
that.setElement(
self.$panel = Ox.SplitPanel({
elements: [
@ -280,8 +278,8 @@ Ox.DocPanel = function(options, self) {
}
function runTests() {
self.$testsButton.hide();
self.$testsLabel.show();
self.$testsButton.remove();
self.$testsStatus.html('Running tests...').show();
Ox.load({Geo: {}, Image: {}, Unicode: {}}, function() {
Ox.test(self.options.items, function(results) {
results.forEach(function(result) {
@ -298,7 +296,7 @@ Ox.DocPanel = function(options, self) {
self.options.results[key][passed]++;
});
});
self.$testsLabel.options({title: formatResults()});
self.$testsStatus.html(formatResults());
renderList();
that.triggerEvent('tests', {results: self.options.results});
});