diff --git a/lib/jsduck/options.rb b/lib/jsduck/options.rb
index 85116c398b166bc1ba08898e7f4f2c99cd3188c3..77ba1d9985fed2ef483a6bc89f4b2fb0dae1ff5a 100644
--- a/lib/jsduck/options.rb
+++ b/lib/jsduck/options.rb
@@ -285,7 +285,7 @@ module JsDuck
"Base URL for examples with relative URL-s.", " ") do |path|
@examples_base_url = path
end
-
+
opts.on('--doctests', "Creates infrastructure for running tests. Experimental!", " ") do
@doctests = true
end
diff --git a/template/app/Assert.js b/template/app/Assert.js
index ed65944e4cb13e0408a688e1d77653b3138c7ac4..e95e0cbdba1ee52b715dcdff04e5aa87913c9979 100644
--- a/template/app/Assert.js
+++ b/template/app/Assert.js
@@ -3,7 +3,7 @@
*/
Ext.define('Docs.Assert', {
singleton: true,
-
+
assert: function(value, message) {
if (!value) {
if (Ext.isEmpty(message)) {
diff --git a/template/app/controller/DocTests.js b/template/app/controller/DocTests.js
index 5e6a11f30f360ac4fbb5da34b287f6bc07852e46..9f410e70dd68540bd576d5246f3150968c2dd6e8 100644
--- a/template/app/controller/DocTests.js
+++ b/template/app/controller/DocTests.js
@@ -28,13 +28,13 @@ Ext.define('Docs.controller.DocTests', {
selector: '#testcontainer'
}
],
-
+
init: function() {
this.addEvents('loadIndex');
this.control({
'#doctestgrid': {
- afterrender: this.onGridAfterRender,
+ afterrender: this.onGridAfterRender
}
});
},
@@ -52,10 +52,10 @@ Ext.define('Docs.controller.DocTests', {
isActive: function() {
return !!this.getIndex().getTab();
},
-
+
/**
* Locates all examples.
- *
+ *
* @private
* @param {Ext.data.Store}
*/
@@ -68,13 +68,13 @@ Ext.define('Docs.controller.DocTests', {
var task = new Ext.util.DelayedTask(function() {
this.locateClsExamples(store, cls);
}, this);
- task.delay(0)
+ task.delay(0);
}, this);
},
/**
* Locates all inline examples attached to a class file.
- *
+ *
* @private
* @param {Ext.data.Store}
* @param {Object}
@@ -96,7 +96,7 @@ Ext.define('Docs.controller.DocTests', {
name += ' example #' + (exampleIdx + 1).toString();
id += '-' + exampleIdx.toString();
}
-
+
store.add({
id: id,
name: name,
@@ -105,7 +105,7 @@ Ext.define('Docs.controller.DocTests', {
status: 'ready'
});
}, this);
-
+
this.clssLeft--;
if (this.clssLeft === 0) {
store.resumeEvents();
@@ -122,14 +122,14 @@ Ext.define('Docs.controller.DocTests', {
/**
* Extract example code from html.
- *
+ *
* @private
* @param {String}
*/
extractExampleCode: function(html) {
var exampleCodes = [],
preMatches = html.match(this.preRegex);
-
+
Ext.each(preMatches, function(preMatch) {
if (preMatch.match(this.preClsRegex)) {
var codeMatches = preMatch.match(this.codeRegex);
@@ -140,7 +140,7 @@ Ext.define('Docs.controller.DocTests', {
}, this);
return exampleCodes;
},
-
+
onGridAfterRender: function(grid) {
var store = grid.getStore();
this.locateExamples(store);
diff --git a/template/app/view/doctests/Index.js b/template/app/view/doctests/Index.js
index e64613bf840d14b5d16758dfeb78cdca315e8152..db2598507cdaed5c63aff62acd66d6813d99a3f1 100644
--- a/template/app/view/doctests/Index.js
+++ b/template/app/view/doctests/Index.js
@@ -92,12 +92,12 @@ Ext.define('Docs.view.doctests.Index', {
model: 'Docs.model.DocTest',
data: []
});
-
+
this.callParent(arguments);
-
+
var runAllButton = Ext.ComponentQuery.query('#runallbutton', this)[0];
runAllButton.on('click', this.onRunAllButtonClick, this);
-
+
var testGrid = Ext.ComponentQuery.query('#doctestgrid', this)[0];
testGrid.on('itemclick', this.onRunLinkClick, this, {
delegate: '.doc-test-run',
@@ -121,19 +121,19 @@ Ext.define('Docs.view.doctests.Index', {
if (!tests.examples || tests.examples.length < 1) {
return;
}
-
+
if ((!tests.fail) && (!tests.pass)) {
Ext.ComponentQuery.query('#testcontainer', this)[0].setDisabled(true);
}
-
+
this.clearTestRunner();
var testRunner = this.getComponent('testrunner');
var record = tests.examples.pop();
-
+
var example = testRunner.add(
Ext.create('Docs.view.examples.Inline', {
cls: 'doc-test-preview',
- value: Ext.String.htmlDecode(Ext.util.Format.stripTags(record.get('code'))),
+ value: Ext.String.htmlDecode(Ext.util.Format.stripTags(record.get('code')))
})
);
@@ -173,10 +173,10 @@ Ext.define('Docs.view.doctests.Index', {
this.runExample({
pass: 0,
fail: 0,
- examples: [record],
+ examples: [record]
});
},
-
+
onRunAllButtonClick: function() {
var examples = [];
this.store.each(function(record) {
@@ -194,7 +194,7 @@ Ext.define('Docs.view.doctests.Index', {
record.set('status', 'pass');
tests.pass++;
this.showResult(tests);
-
+
if (Ext.isDefined(console)) {
console.log('Test passed: ', record.get('name'));
}
diff --git a/template/app/view/examples/Inline.js b/template/app/view/examples/Inline.js
index 7ea1b10f0245c346e00931fe1feda5afcfed6d32..db147e10895f9292cef3623b15d6b6ce32207a3b 100644
--- a/template/app/view/examples/Inline.js
+++ b/template/app/view/examples/Inline.js
@@ -35,10 +35,10 @@ Ext.define('Docs.view.examples.Inline', {
* @cfg {Docs.view.examples.InlineToolbar} toolbar
* The toolbar with buttons that controls this component.
*/
-
+
constructor: function() {
this.callParent(arguments);
-
+
this.addEvents([
/**
* @event previewsuccess
@@ -55,7 +55,7 @@ Ext.define('Docs.view.examples.Inline', {
'previewfailure',
]);
},
-
+
initComponent: function() {
this.options = Ext.apply({
device: "phone",
diff --git a/template/app/view/examples/InlinePreview.js b/template/app/view/examples/InlinePreview.js
index 72b292323787dec5e43c75a3c42903cb62253097..7f8bdd13bf37c19e5cfce684c039398ee866bbd1 100644
--- a/template/app/view/examples/InlinePreview.js
+++ b/template/app/view/examples/InlinePreview.js
@@ -6,25 +6,25 @@ Ext.define('Docs.view.examples.InlinePreview', {
requires: [
'Docs.view.examples.Device'
],
-
+
bodyPadding: '0 10',
-
+
statics: {
iframeId: 0,
-
+
getNextIframeId: function() {
return this.iframeId++;
},
-
+
getPreviewByIframeId: function(iframeId) {
return Ext.ComponentManager.get('inline-preview-' + iframeId);
},
-
+
previewSuccess: function(iframeId) {
var preview = this.getPreviewByIframeId(iframeId);
preview.fireEvent('previewsuccess', preview);
},
-
+
previewFailure: function(iframeId, e) {
var preview = this.getPreviewByIframeId(iframeId);
preview.fireEvent('previewfailure', preview, e);
@@ -37,13 +37,13 @@ Ext.define('Docs.view.examples.InlinePreview', {
* See docs of parent component.
*/
options: {},
-
+
constructor: function(config) {
config = config || {};
config.iframeId = this.self.getNextIframeId();
config.id = 'inline-preview-' + config.iframeId;
this.callParent([config]);
-
+
this.addEvents([
/**
* @event previewsuccess
@@ -60,12 +60,12 @@ Ext.define('Docs.view.examples.InlinePreview', {
'previewfailure'
]);
},
-
+
initComponent: function() {
this.html = this.getHtml();
-
+
this.callParent(arguments);
-
+
this.on('success', this.onSuccess, this);
this.on('failure', this.onFailure, this);
},
@@ -110,7 +110,7 @@ Ext.define('Docs.view.examples.InlinePreview', {
iframe.src = "eg-iframe.html";
}
},
-
+
/**
* Returns the current height of the preview.
* @return {Number}
diff --git a/template/resources/sass/_doc_tests.scss b/template/resources/sass/_doc_tests.scss
index d417920bb587aa4087839307173c04a00e7d1df3..742d0841b32d8eb6e9e1adecd1e2ec2c13322138 100644
--- a/template/resources/sass/_doc_tests.scss
+++ b/template/resources/sass/_doc_tests.scss
@@ -1,24 +1,19 @@
// Styles for doc tests
.doc-test-preview {
- display: none;
-}
+ display: none; }
.doc-test-ready {
- font-weight: bold;
- color: #333;
-}
+ font-weight: bold;
+ color: #333; }
.doc-test-error {
- font-weight: bold;
- color: orange;
-}
+ font-weight: bold;
+ color: orange; }
.doc-test-failure {
- font-weight: bold;
- color: red;
-}
+ font-weight: bold;
+ color: red; }
.doc-test-success {
- font-weight: bold;
- color: green;
-}
\ No newline at end of file
+ font-weight: bold;
+ color: green; }