Current state with lots and lots of debugging junk

This commit is contained in:
Jonathan Frederic 2014-11-05 23:16:07 -08:00
parent b3c49fce66
commit 8c149c9112
7 changed files with 44 additions and 14 deletions

View File

@ -97,7 +97,12 @@ define([
// Make sure the view creation is not out of order with
// any state updates.
model.state_change = model.state_change.then(function() {
console.log('create_view ' + model.id);
try {
console.log('create_view ' + model.id);
console.log(' _view_name ' + model.get('_view_name'));
console.log(' _view_module ' + model.get('_view_module'));
} catch (e) { }
return utils.load_class(model.get('_view_name'), model.get('_view_module'),
WidgetManager._view_types).then(function(ViewType) {

View File

@ -70,6 +70,7 @@ define(["widgets/js/manager",
_handle_comm_msg: function (msg) {
// Handle incoming comm msg.
var method = msg.content.data.method;
console.log(method);
var that = this;
switch (method) {
case 'update':
@ -81,8 +82,9 @@ define(["widgets/js/manager",
this.trigger('msg:custom', msg.content.data.content);
break;
case 'display':
that.widget_manager.display_view(msg, that)
.catch(utils.reject("Couldn't process display msg for model id '" + String(that.id) + "'", true));
this.state_change = this.state_change.then(function() {
return that.widget_manager.display_view(msg, that);
}).catch(utils.reject("Couldn't process display msg for model id '" + String(that.id) + "'", true));
break;
}
},
@ -99,6 +101,7 @@ define(["widgets/js/manager",
} finally {
that.state_lock = null;
}
return rsvp.Promise.resolve();
}, utils.reject("Couldn't set model state", true));
},

View File

@ -150,7 +150,7 @@ define([
this.$label.hide();
} else {
this.$label.text(description);
MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]);
// MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]);
this.$label.show();
}
@ -308,7 +308,7 @@ define([
this.$label.hide();
} else {
this.$label.text(description);
MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]);
// MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]);
this.$label.show();
}
}
@ -416,7 +416,7 @@ define([
this.$label.hide();
} else {
this.$label.text(description);
MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]);
// MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]);
this.$label.show();
}
return ProgressView.__super__.update.apply(this);

View File

@ -94,7 +94,7 @@ define([
this.$label.hide();
} else {
this.$label.text(description);
MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]);
// MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]);
this.$label.show();
}
}
@ -219,7 +219,7 @@ define([
this.$label.hide();
} else {
this.$label.text(description);
MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]);
// MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]);
this.$label.show();
}
}
@ -326,7 +326,7 @@ define([
this.$label.hide();
} else {
this.$label.text(description);
MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]);
// MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]);
this.$label.show();
}
}
@ -441,7 +441,7 @@ define([
this.$label.hide();
} else {
this.$label.text(description);
MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]);
// MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]);
this.$label.show();
}
}

View File

@ -101,7 +101,7 @@ define([
this.$label.hide();
} else {
this.$label.text(description);
MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]);
// MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]);
this.$label.show();
}
}
@ -177,7 +177,7 @@ define([
this.$label.hide();
} else {
this.$label.text(description);
MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]);
// MathJax.Hub.Queue(["Typeset",MathJax.Hub,this.$label.get(0)]);
this.$label.show();
}
}

View File

@ -744,4 +744,26 @@ casper.capture_log = function () {
});
};
casper.interact = function() {
// Start an interactive Javascript console.
var system = require('system');
system.stdout.writeLine('JS interactive console.');
system.stdout.writeLine('Type `exit` to quit.');
function read_line() {
system.stdout.writeLine('JS: ');
var line = system.stdin.readLine();
return line;
}
var input = read_line();
while (input.trim() != 'exit') {
var output = this.evaluate(function(code) {
return String(eval(code));
}, {code: input});
system.stdout.writeLine('\nOut: ' + output);
input = read_line();
}
};
casper.capture_log();

View File

@ -13,7 +13,6 @@ casper.notebook_test(function () {
'display(bool_widgets[1])\n' +
'print("Success")');
this.execute_cell_then(bool_index, function(index){
this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
'Create bool widget cell executed with correct output.');
@ -48,7 +47,6 @@ casper.notebook_test(function () {
this.test.assert(this.cell_element_function(index,
'.widget-area .widget-subarea button', 'hasClass', ['active']),
'Toggle button is toggled.');
});
index = this.append_cell(
@ -57,6 +55,8 @@ casper.notebook_test(function () {
'print("Success")');
this.execute_cell_then(index, function(index){
this.interact();
this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
'Change bool widget value cell executed with correct output.');