dont show Run tests is showTests is false, fix documentation example

This commit is contained in:
j 2012-06-16 14:25:08 +02:00
parent 9d391e4c13
commit 099fbc7880
3 changed files with 32 additions and 29 deletions

View file

@ -28,8 +28,8 @@ My.MAGIC_CONSTANT <number> Magic constant, needed for HTTP requests
*/ */
My.MAGIC_CONSTANT = navigator.userAgent.length % 2 == 0 ? 23 : 42; My.MAGIC_CONSTANT = navigator.userAgent.length % 2 == 0 ? 23 : 42;
Ox.load(function() {
//@ Objects //@ Objects
/* /*
*/ */
/*@ /*@
@ -77,35 +77,37 @@ My.favorites = (function() {
keys = Object.keys(favorites); keys = Object.keys(favorites);
return Ox.extend(favorites, {any: favorites[keys[Ox.random(keys.length)]]}); return Ox.extend(favorites, {any: favorites[keys[Ox.random(keys.length)]]});
}()); }());
/*@ /*@
replace <array> ... replace <array> ...
0 <regexp> ... 0 <regexp> ...
1 <string> replace 1 <string> replace
*/ */
My.HTMLUtils = { My.HTMLUtils = (function() {
entities: { var entities = {
'"': '&quot;', '&': '&amp;', "'": '&apos;', '<': '&lt;', '>': '&gt;' '"': '&quot;', '&': '&amp;', "'": '&apos;', '<': '&lt;', '>': '&gt;'
}, };
replace: { return {
namedEntity: [ entities: entities,
new RegExp('(' + Ox.values(this.entities).join('|') + ')', 'g'), replace: {
function(match) { namedEntity: [
return Ox.keyOf(this.entities, match); new RegExp('(' + Ox.values(entities).join('|') + ')', 'g'),
} function(match) {
], return Ox.keyOf(entities, match);
numericEntity: [ }
/&#([0-9A-FX]+);/gi, ],
function(match, code) { numericEntity: [
return Ox.char( /&#([0-9A-FX]+);/gi,
/^X/i.test(code) function(match, code) {
? parseInt(code.slice(1), 16) return Ox.char(
: parseInt(code, 10) /^X/i.test(code)
); ? parseInt(code.slice(1), 16)
} : parseInt(code, 10)
], );
} }
}; ],
}
};
}());
/*@ /*@
My.defaultPlace <o> Default place object My.defaultPlace <o> Default place object
@ -274,6 +276,7 @@ My.localStorage = (function() {
}; };
}()); }());
});
//@ //@
Ox.load('UI', function() { Ox.load('UI', function() {
var path = Ox.PATH + '../examples/documentation/js/'; var path = Ox.PATH + '../examples/documentation/js/';

View file

@ -5,7 +5,6 @@ This example demonstrates various form elements.
'use strict'; 'use strict';
Ox.load({Geo: {}, UI: {}, Unicode: {}}, function() { Ox.load({Geo: {}, UI: {}, Unicode: {}}, function() {
var countries = Ox.sortASCII(Ox.COUNTRIES.filter(function(country) { var countries = Ox.sortASCII(Ox.COUNTRIES.filter(function(country) {
return !country.dissolved && !country.disputed && !country.exception; return !country.dissolved && !country.disputed && !country.exception;
}).map(function(country) { }).map(function(country) {
@ -692,6 +691,5 @@ Ox.load({Geo: {}, UI: {}, Unicode: {}}, function() {
], ],
orientation: 'horizontal' orientation: 'horizontal'
}) })
.appendTo(Ox.$body) .appendTo(Ox.$body);
}); });

View file

@ -74,7 +74,9 @@ Ox.DocPanel = function(options, self) {
self.$testsStatus = $('<div>') self.$testsStatus = $('<div>')
.css({marginTop: '5px', textAlign: 'center'}) .css({marginTop: '5px', textAlign: 'center'})
.appendTo(self.$toolbar); .appendTo(self.$toolbar);
if (!self.options.results) { if (!self.options.showTests) {
self.$testsStatus.hide();
} else if (!self.options.results) {
self.options.results = {}; self.options.results = {};
self.$testsButton = Ox.Button({title: 'Run Tests'}) self.$testsButton = Ox.Button({title: 'Run Tests'})
.css({margin: '4px auto'}) .css({margin: '4px auto'})