From c8cab73bc0df2243e68a312ab2f40f63afd5d9e8 Mon Sep 17 00:00:00 2001 From: Rene Saarsoo Date: Sat, 21 Apr 2012 14:35:09 +0300 Subject: [PATCH] Syntax cleanup. Remove training commas and whitespace. Add missing semicolons. --- lib/jsduck/options.rb | 2 +- template/app/Assert.js | 2 +- template/app/controller/DocTests.js | 22 +++++++++---------- template/app/view/doctests/Index.js | 20 ++++++++--------- template/app/view/examples/Inline.js | 6 +++--- template/app/view/examples/InlinePreview.js | 24 ++++++++++----------- template/resources/sass/_doc_tests.scss | 23 ++++++++------------ 7 files changed, 47 insertions(+), 52 deletions(-) diff --git a/lib/jsduck/options.rb b/lib/jsduck/options.rb index 85116c39..77ba1d99 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 ed65944e..e95e0cbd 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 5e6a11f3..9f410e70 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 e64613bf..db259850 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 7ea1b10f..db147e10 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 72b29232..7f8bdd13 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 d417920b..742d0841 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; } -- GitLab