diff --git a/INSTALL b/INSTALL index fdd17d5..fb9af9c 100644 --- a/INSTALL +++ b/INSTALL @@ -218,18 +218,3 @@ package: Then you can run unit tests by running: nosetests - - -JavaScript "unit" tests ------------------------ - -JsUnit is included with Luminotes, so to kick off tests of the client-side -JavaScript code, simply run: - - python2.4 static/js/test/run_tests.py - -The run_tests.py script runs the tests inside browser windows and presumes -that you have both Firefox and Internet Explorer 6 installed, and also that -the Luminotes server is running on the local machine. Edit run_tests.py if you -need to specify different paths to the browser binaries or want to test with -additional browsers. diff --git a/static/js/test/Editor_setup.js b/static/js/test/Editor_setup.js deleted file mode 100644 index 10f8129..0000000 --- a/static/js/test/Editor_setup.js +++ /dev/null @@ -1,33 +0,0 @@ -function setUpPage() { - id = "fake_id"; - notebook_id = "fake_notebook_id"; - title = "the title" - note_text = "

" + title + "

blah"; - deleted_from_id = undefined; - revisions_list = undefined; - read_write = true; - startup = false; - highlight = false; - editor_focus = false; - - editor = new Editor( id, notebook_id, note_text, deleted_from_id, revisions_list, read_write, startup, highlight, editor_focus ); - - init_complete = false; - connect( editor, "init_complete", function () { init_complete = true; } ); - - wait_for_init_complete(); -} - -function wait_for_init_complete() { - // busywait for the editor initialization to complete - if ( !init_complete ) { - setTimeout( "wait_for_init_complete()", 10 ); - return; - } - - setUpPageStatus = "complete"; -} - -function tearDownPage() { - editor.shutdown(); -} diff --git a/static/js/test/Stub_editor.js b/static/js/test/Stub_editor.js deleted file mode 100644 index f05f054..0000000 --- a/static/js/test/Stub_editor.js +++ /dev/null @@ -1,133 +0,0 @@ -function Editor( id, notebook_id, note_text, deleted_from_id, revisions_list, read_write, startup, highlight, focus ) { - this.id = id; - this.notebook_id = notebook_id; - this.initial_text = note_text; - this.deleted_from_id = deleted_from_id || null; - this.revisions_list = revisions_list || new Array(); - this.read_write = read_write; - this.startup = startup || false; // whether this Editor is for a startup note - this.init_highlight = highlight || false; - this.init_focus = focus || false; - this.closed = false; - var iframe_id = "note_" + id; - - this.document = null; - this.iframe = createDOM( "iframe", { - "id": iframe_id, - "name": iframe_id, - "class": "note_frame" - } ); - this.iframe.editor = this; - this.title = null; - - this.delete_button = createDOM( "input" ); - this.changes_button = createDOM( "input" ); - this.undelete_button = createDOM( "input" ); - this.options_button = createDOM( "input" ); - this.hide_button = createDOM( "input" ); - - connect( this.iframe, "onload", function ( event ) { self.finish_init(); } ); -} - -Editor.prototype.finish_init = function () { - if ( this.iframe.contentDocument ) { // browsers such as Firefox - this.document = this.iframe.contentDocument; - } else { // browsers such as IE - this.document = this.iframe.contentWindow.document; - } - - if ( !this.initial_text ) - this.initial_text = "

"; - - this.document.write( this.initial_text ); - - this.scrape_title(); - - if ( this.init_focus ) - this.focus(); - - this.calls = new Array(); -} - -Editor.prototype.add_call = function ( method_name, args ) { - this.calls[ this.calls.length ] = [ method_name, args || [] ]; -} - -Editor.prototype.highlight = function ( scroll ) { - this.add_call( "highlight", [ scroll ] ); -} - -Editor.prototype.exec_command = function ( command, parameter ) { - this.add_call( "exec_command", [ command, parameter ] ); -} - -Editor.prototype.resize = function () { - this.add_call( "resize" ); -} - -Editor.prototype.empty = function () { - this.add_call( "empty" ); - - if ( !this.document || !this.document.body ) - return true; // consider it empty as of now - - return ( scrapeText( this.document.body ).length == 0 ); -} - -Editor.prototype.start_link = function () { - this.add_call( "start_link" ); -} - -Editor.prototype.end_link = function () { - this.add_call( "end_link" ); -} - -Editor.prototype.find_link_at_cursor = function () { - this.add_call( "find_link_at_cursor" ); - - return null; -} - -Editor.prototype.focus = function () { - this.add_call( "focus" ); -} - -// return true if the specified state is enabled -Editor.prototype.state_enabled = function ( state_name ) { - this.add_call( "state_enabled", [ state_name ] ); - - return false; -} - -Editor.prototype.contents = function () { - this.add_call( "contents" ); - - return this.document.body.innerHTML; -} - -Editor.prototype.shutdown = function( event ) { - this.add_call( "shutdown", [ event ] ); -} - -// convenience function for parsing a link that has an href URL containing a query string -function parse_query( link ) { - if ( !link || !link.href ) - return new Array(); - - return parseQueryString( link.href.split( "?" ).pop() ); -} - -// convenience function for getting a link's title (stripped of whitespace), either from a query -// argument in the href or from the actual link title -function link_title( link, query ) { - if ( !query ) - query = parse_query( link ); - - var link_title = strip( query.title || scrapeText( link ) ); - - // work around an IE quirk in which link titles are sometimes 0xa0 - if ( link_title.charCodeAt( 0 ) == 160 ) - return ""; - - return link_title; -} diff --git a/static/js/test/Stub_invoker.js b/static/js/test/Stub_invoker.js deleted file mode 100644 index 8e4853e..0000000 --- a/static/js/test/Stub_invoker.js +++ /dev/null @@ -1,49 +0,0 @@ -function Invoker( handler ) { - this.handler = handler; -} - -Invoker.prototype.invoke = function ( url, http_type, args, callback, form, fire_and_forget ) { - if ( form ) { - var form = formContents( getElement( form ) ); - var arg_names = form[ 0 ]; - var arg_values = form[ 1 ]; - } else { - var arg_names = []; - var arg_values = []; - } - - extend( arg_names, keys( args ) ); - extend( arg_values, values( args ) ); - - // if there's no handler, simulate an error reaching the server - if ( !this.handler ) { - signal( self, "error_message", "There was a problem reaching the server. Please check your network connectivity." ); - return; - } - - var args = new Array(); - for ( var i in arg_names ) { - var name = arg_names[ i ]; - var value = arg_values[ i ]; - - args[ name ] = value; - } - - // ask the stub handler for a fake response to the invocation request - var result = this.handler( url, args ); - - if ( fire_and_forget ) - return; - - if ( result.error ) - signal( this, "error_message", result.error ); - - if ( callback ) - callback( result ); - - if ( result.redirect ) - window.location = result.redirect; - - if ( result.reload ) - window.location.reload(); -} diff --git a/static/js/test/Test_Luminotes.html b/static/js/test/Test_Luminotes.html deleted file mode 100644 index 529e8e5..0000000 --- a/static/js/test/Test_Luminotes.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - Luminotes Test Suite - - - - - -

Luminotes Test Suite

- -

This page contains a suite of tests for testing Luminotes.

- - diff --git a/static/js/test/Test_editor.html b/static/js/test/Test_editor.html deleted file mode 100644 index c94fd3e..0000000 --- a/static/js/test/Test_editor.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - -Luminotes Editor Tests - - - - - - - - - -

Luminotes Editor Tests

- -

This page contains tests for the Luminotes Editor class. To see them, take a look at the source.

- -
- - - diff --git a/static/js/test/Test_wiki.html b/static/js/test/Test_wiki.html deleted file mode 100644 index 4c2cafd..0000000 --- a/static/js/test/Test_wiki.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - -Luminotes Wiki Tests - - - - - - - - - - -

Luminotes Wiki Tests

- -

This page contains tests for the Luminotes Wiki class. To see them, take a look at the source.

- -
- -
- -
-
-
-
-
- -
- - - - - - - - -
- - - - - - - - - - - - - -
-
- - - diff --git a/static/js/test/run_tests.py b/static/js/test/run_tests.py deleted file mode 100755 index 35b1236..0000000 --- a/static/js/test/run_tests.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/python - -import subprocess -import os.path - -browsers = [ - "firefox", - "ie6", -] - -def main(): - test_page = "http://localhost:8081/static/js/test/Test_Luminotes.html" - test_runner = "http://localhost:8081/static/jsunit/testRunner.html?testpage=%s&autorun=true" % test_page - - # launch tests in each supported browser - for browser in browsers: - subprocess.call( [ browser, test_runner ] ) - - -if __name__ == "__main__": - main()