Ox.DocPanel: add UI to run tests
This commit is contained in:
parent
def580aa0a
commit
86f6123565
1 changed files with 21 additions and 2 deletions
|
@ -62,7 +62,22 @@ Ox.DocPanel = function(options, self) {
|
||||||
|
|
||||||
self.results = {};
|
self.results = {};
|
||||||
|
|
||||||
|
self.$testsButton = Ox.Button({title: 'Run Tests'})
|
||||||
|
.css({float: 'left', margin: '4px'})
|
||||||
|
.bindEvent({click: runTests});
|
||||||
|
self.$testsIcon = Ox.LoadingIcon()
|
||||||
|
.css({float: 'left', margin: '4px'});
|
||||||
|
self.$toolbar = Ox.Bar({size: 24})
|
||||||
|
.append(self.$testsButton)
|
||||||
|
.append(self.$testsIcon);
|
||||||
self.$list = Ox.Element();
|
self.$list = Ox.Element();
|
||||||
|
self.$sidebar = Ox.SplitPanel({
|
||||||
|
elements: [
|
||||||
|
{element: self.$toolbar, size: 24},
|
||||||
|
{element: self.$list}
|
||||||
|
],
|
||||||
|
orientation: 'vertical'
|
||||||
|
});
|
||||||
self.$page = Ox.Element();
|
self.$page = Ox.Element();
|
||||||
|
|
||||||
that.setElement(
|
that.setElement(
|
||||||
|
@ -70,7 +85,7 @@ Ox.DocPanel = function(options, self) {
|
||||||
elements: [
|
elements: [
|
||||||
{
|
{
|
||||||
collapsible: self.options.collapsible,
|
collapsible: self.options.collapsible,
|
||||||
element: self.$list,
|
element: self.$sidebar,
|
||||||
resizable: self.options.resizable,
|
resizable: self.options.resizable,
|
||||||
resize: self.options.resize,
|
resize: self.options.resize,
|
||||||
size: self.options.size
|
size: self.options.size
|
||||||
|
@ -265,11 +280,13 @@ Ox.DocPanel = function(options, self) {
|
||||||
selectItem(data.ids.length ? data.ids[0] : '')
|
selectItem(data.ids.length ? data.ids[0] : '')
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
self.$panel.replaceElement(0, self.$list);
|
self.$sidebar.replaceElement(1, self.$list);
|
||||||
selectItem(self.options.selected);
|
selectItem(self.options.selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
function runTests() {
|
function runTests() {
|
||||||
|
self.$testsButton.options({disabled: true});
|
||||||
|
self.$testsIcon.start();
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
Ox.load({Geo: {}, Image: {}, Unicode: {}}, function() {
|
Ox.load({Geo: {}, Image: {}, Unicode: {}}, function() {
|
||||||
Ox.test(self.options.items, function(results) {
|
Ox.test(self.options.items, function(results) {
|
||||||
|
@ -287,6 +304,8 @@ Ox.DocPanel = function(options, self) {
|
||||||
self.results[key][passed]++;
|
self.results[key][passed]++;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
self.$testsButton.options({disabled: false});
|
||||||
|
self.$testsIcon.stop();
|
||||||
renderList();
|
renderList();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue