diff --git a/static/js/Editor.js b/static/js/Editor.js
index 49ab6b6..2b4c948 100644
--- a/static/js/Editor.js
+++ b/static/js/Editor.js
@@ -166,6 +166,8 @@ Editor.prototype.finish_init = function () {
this.scrape_title();
if ( this.init_focus )
this.focus();
+
+ signal( self, "init_complete" );
}
Editor.prototype.highlight = function ( scroll ) {
diff --git a/static/js/test/Test_editor.html b/static/js/test/Test_editor.html
index c048fe1..b91132a 100644
--- a/static/js/test/Test_editor.html
+++ b/static/js/test/Test_editor.html
@@ -22,6 +22,9 @@ function setUp() {
editor_focus = false;
editor = new Editor( id, notebook_id, note_text, deleted_from, revisions_list, read_write, startup, highlight, editor_focus );
+
+ init_complete = false;
+ connect( editor, "init_complete", function () { init_complete = true; } );
}
function tearDown() {
@@ -29,8 +32,25 @@ function tearDown() {
}
function test_Editor() {
- assertNotUndefined( editor );
- assertNotNull( editor );
+ // busywait for the editor initialization to complete
+ if ( !init_complete ) {
+ setTimeout( "test_Editor()", 10 );
+ return;
+ }
+
+ assertNotUndefined( editor.changes_button );
+ assertNotUndefined( editor.closed );
+ assertNotUndefined( editor.deleted_from );
+ assertNotUndefined( editor.document );
+ assertNotUndefined( editor.document.body );
+ assertNotUndefined( editor.document.body.innerHTML );
+ assertNotUndefined( editor.id );
+ assertNotUndefined( editor.iframe );
+ assertNotUndefined( editor.revisions_list );
+ assertNotUndefined( editor.startup );
+ assertNotUndefined( editor.title );
+ assertNotUndefined( editor.options_button );
+ assertNotUndefined( editor.read_write );
}
diff --git a/static/js/test/Test_wiki.html b/static/js/test/Test_wiki.html
index 2afd2b9..fb24eb3 100644
--- a/static/js/test/Test_wiki.html
+++ b/static/js/test/Test_wiki.html
@@ -8,7 +8,7 @@
-
+