save test results
This commit is contained in:
parent
0d2f082779
commit
28075133ee
2 changed files with 14 additions and 6 deletions
4
index.js
4
index.js
|
@ -382,6 +382,7 @@ Ox.load(function() {
|
||||||
path: 'dev/',
|
path: 'dev/',
|
||||||
references: /\b(Ox\.[\w\$]+)\b/g,
|
references: /\b(Ox\.[\w\$]+)\b/g,
|
||||||
replace: [app.re.code],
|
replace: [app.re.code],
|
||||||
|
results: app.data.testResults || void 0,
|
||||||
selected: app.user.item.doc,
|
selected: app.user.item.doc,
|
||||||
showTests: true
|
showTests: true
|
||||||
})
|
})
|
||||||
|
@ -401,6 +402,9 @@ Ox.load(function() {
|
||||||
.bindEventOnce({
|
.bindEventOnce({
|
||||||
load: function(data) {
|
load: function(data) {
|
||||||
app.data.docItems = data.items;
|
app.data.docItems = data.items;
|
||||||
|
},
|
||||||
|
tests: function(data) {
|
||||||
|
app.data.testResults = data.results;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -47,6 +47,7 @@ Ox.DocPanel = function(options, self) {
|
||||||
replace: [],
|
replace: [],
|
||||||
resizable: false,
|
resizable: false,
|
||||||
resize: [128, 256, 384],
|
resize: [128, 256, 384],
|
||||||
|
results: null,
|
||||||
runTests: false,
|
runTests: false,
|
||||||
selected: '',
|
selected: '',
|
||||||
showTests: false,
|
showTests: false,
|
||||||
|
@ -60,7 +61,9 @@ Ox.DocPanel = function(options, self) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
self.results = {};
|
if (!self.options.results) {
|
||||||
|
self.options.results = {};
|
||||||
|
}
|
||||||
|
|
||||||
self.$testsButton = Ox.Button({title: 'Run Tests'})
|
self.$testsButton = Ox.Button({title: 'Run Tests'})
|
||||||
.css({float: 'left', margin: '4px'})
|
.css({float: 'left', margin: '4px'})
|
||||||
|
@ -109,7 +112,7 @@ Ox.DocPanel = function(options, self) {
|
||||||
self.$sidebar.replaceElement(0, self.$toolbar);
|
self.$sidebar.replaceElement(0, self.$toolbar);
|
||||||
renderList();
|
renderList();
|
||||||
self.options.runTests && runTests();
|
self.options.runTests && runTests();
|
||||||
that.triggerEvent('load', {items: docItems});
|
that.triggerEvent('load', {items: self.options.items});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -153,8 +156,8 @@ Ox.DocPanel = function(options, self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getIcon(id, expanded) {
|
function getIcon(id, expanded) {
|
||||||
var $icon = null, results = self.results[id];
|
var $icon = null, results = self.options.results[id];
|
||||||
if (!Ox.isEmpty(self.results)) {
|
if (!Ox.isEmpty(self.options.results)) {
|
||||||
$icon = Ox.Theme.getColorImage(
|
$icon = Ox.Theme.getColorImage(
|
||||||
'symbol' + (expanded === true ? 'Down' : expanded === false ? 'Right' : 'Center'),
|
'symbol' + (expanded === true ? 'Down' : expanded === false ? 'Right' : 'Center'),
|
||||||
!results ? 'none' : results.failed === 0 ? 'passed' : 'failed',
|
!results ? 'none' : results.failed === 0 ? 'passed' : 'failed',
|
||||||
|
@ -281,13 +284,14 @@ Ox.DocPanel = function(options, self) {
|
||||||
item.section ? item.module + '/' + item.section + '/' : [],
|
item.section ? item.module + '/' + item.section + '/' : [],
|
||||||
item.module + '/' + (item.section ? item.section + '/' : '') + item.name
|
item.module + '/' + (item.section ? item.section + '/' : '') + item.name
|
||||||
).forEach(function(key) {
|
).forEach(function(key) {
|
||||||
self.results[key] = self.results[key] || {passed: 0, failed: 0};
|
self.options.results[key] = self.options.results[key] || {passed: 0, failed: 0};
|
||||||
self.results[key][passed]++;
|
self.options.results[key][passed]++;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
self.$testsLabel.hide();
|
self.$testsLabel.hide();
|
||||||
self.$testsButton.show();
|
self.$testsButton.show();
|
||||||
renderList();
|
renderList();
|
||||||
|
that.triggerEvent('tests', {results: self.options.results});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue