From 9cc54f996b439c4ef35e7c73c5314da230602f65 Mon Sep 17 00:00:00 2001 From: Rene Saarsoo Date: Mon, 23 Apr 2012 12:13:40 +0300 Subject: [PATCH] Remove all console.log-s from DocTests. Class loading failure is now shown in grid. For other failures the grid also displays the failure message. --- template/app/controller/DocTests.js | 25 ++++++++++++++++++++----- template/app/view/doctests/Index.js | 12 ------------ 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/template/app/controller/DocTests.js b/template/app/controller/DocTests.js index ea09c769..705ee1be 100644 --- a/template/app/controller/DocTests.js +++ b/template/app/controller/DocTests.js @@ -103,18 +103,33 @@ Ext.define('Docs.controller.DocTests', { }); }, this); - this.classesLeft--; - if (this.classesLeft === 0) { - this.getIndex().enable(); - } + this.countClassLoaded(); }, failure: function(response, opts) { - console.log('Class load failed', cls, url, response, opts); + this.getIndex().addExample({ + id: cls, + name: cls, + href: document.location.href.replace(/#.*/, '#!/api/' + cls), + code: 'ClassLoadingFailed();', + status: 'failure', + message: 'Class loading failed' + }); + + this.countClassLoaded(); }, scope: this }); }, + // Counts that yet another class has been loaded. + // When all loaded, enable the page again. + countClassLoaded: function() { + this.classesLeft--; + if (this.classesLeft === 0) { + this.getIndex().enable(); + } + }, + /** * Extract example code from html. * diff --git a/template/app/view/doctests/Index.js b/template/app/view/doctests/Index.js index ba95c2db..abe47226 100644 --- a/template/app/view/doctests/Index.js +++ b/template/app/view/doctests/Index.js @@ -248,10 +248,6 @@ Ext.define('Docs.view.doctests.Index', { record.commit(); config.pass++; this.showResult(config); - - if (Ext.isDefined(console)) { - console.log('Test passed: ', record.get('name')); - } }, /** @@ -271,13 +267,5 @@ Ext.define('Docs.view.doctests.Index', { record.commit(); config.fail++; this.showResult(config); - - if (Ext.isDefined(console)) { - var stack = 'no stack available'; - if (e.stack) { - stack = e.stack; - } - console.log('Test failure for ' + record.get('name'), e, stack); - } } }); -- GitLab