update DocPage ('examples' property renamed to 'tests')

This commit is contained in:
rolux 2012-05-27 16:54:20 +02:00
parent b4bb926c0c
commit 27b55e2b6e

View file

@ -93,7 +93,7 @@ Ox.DocPage = function(options, self) {
];
[
'description', 'usage', 'arguments', 'properties',
'events', 'examples', 'source'
'events', 'tests', 'source'
].forEach(function(section) {
var className = 'OxLine' + Ox.uid();
if (item[section]) {
@ -151,26 +151,28 @@ Ox.DocPage = function(options, self) {
});
})
)
.append('<span class="OxSection">' + Ox.toTitleCase(section) + '</span>')
.append('<span class="OxSection">' + Ox.toTitleCase(
section == 'tests' ? 'examples' : section
) + '</span>')
);
if (section == 'examples') {
item.examples.forEach(function(example) {
if (section == 'tests') {
item.tests.forEach(function(test) {
$elements.push($('<div>')
.addClass(className)
.css({marginLeft: (level * 32 + 16) + 'px'})
.html(
'<code><b>&gt;&nbsp;'
+ Ox.encodeHTMLEntities(example.statement)
+ Ox.encodeHTMLEntities(test.statement)
.replace(/ /g, '&nbsp;')
.replace(/\n/g, '<br/>\n&nbsp;&nbsp;')
+ '</b></code>'
)
);
example.result && $elements.push($('<div>')
test.result && $elements.push($('<div>')
.addClass(className)
.css({marginLeft: (level * 32 + 16) + 'px'})
.html(
'<code>' + Ox.encodeHTMLEntities(example.result) + '</code>'
'<code>' + Ox.encodeHTMLEntities(test.result) + '</code>'
)
)
});
@ -184,7 +186,7 @@ Ox.DocPage = function(options, self) {
+ '</b>:' + self.options.item.line + '</code>'
)
);
Ox.print('IS::', item.source);
//Ox.print('IS::', item.source);
$elements.push(
Ox.SyntaxHighlighter({
replace: self.options.replace,