diff options
| author | Alon Levy <alon@pobox.com> | 2014-10-20 13:25:32 +0300 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2014-10-20 21:36:37 +0300 |
| commit | c919c4bfef4ad9e2dc25d040c0727dd29ad541ae (patch) | |
| tree | dd6394603680976c48801b53321e8085b0db1505 /tests/test_nan_problem.js | |
| parent | f1f4e937932f52c630831d0d501f8f8756b37531 (diff) | |
introduce require.js and rewrite tests
Yes, I'm being lazy. The purpose of require.js is to allow writing
modules, i.e. individual smaller then the whole files with clear
dependencies. This is achieved by using a new api provided by
require.js:
define, require, requirejs
Read more at [requirejs] (http://requirejs.org)
Tests have been rewritten to work correctly with require.js; they still
use jsdom.
Test output is now stored in the repository, all tests are run via
run_tests.js; This is a hack - once a good harness (with assertions,
suites - unittest like) presents itself it will be used.
Hidden here is also using FileSaver for history saving, so history is
saved to history.json instead to a random name. Plus dropping some dead
code.
Diffstat (limited to 'tests/test_nan_problem.js')
| -rw-r--r-- | tests/test_nan_problem.js | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/tests/test_nan_problem.js b/tests/test_nan_problem.js deleted file mode 100644 index fab9df34..00000000 --- a/tests/test_nan_problem.js +++ /dev/null @@ -1,78 +0,0 @@ -var fs = require('fs'), - jsdom = require('jsdom'); - -var script_filenames = [ - "external/scripts/d3/d3.js", - "external/scripts/jquery.js", - "external/scripts/jquery-ui.js", - "external/scripts/autocomplete.js", - - "scripts/caret.js", - "scripts/history.js", - "scripts/rhizicore.js", - "scripts/textanalysis.js", - "scripts/textanalysis-ui.js", - "scripts/buttons.js", - "scripts/drag_n_drop.js", - "scripts/robot.js", - "scripts/watchdog.js", - "scripts/gant.js"].map(function(x) { return "../" + x; }); - -function feed_sentence(window, s, finalize) -{ - var i; - console.log('******* feeding: ' + s); - for (i = 1 ; i <= s.length; ++i) { - console.log('======= ' + s.substr(0, i)); - window.analyzeSentence(s.substr(0, i), false); - } - if (finalize) { - window.analyzeSentence(s, true); - } -} - -function dump_nodes(window) { - var nodes = window.force.nodes(); - for(var i = 0 ; i < nodes.length; ++i) { - console.log('nodes[' + nodes[i].id + '/' + nodes[i].type + '].[xy] = (' + nodes[i].x + ',' + nodes[i].y + ')'); - } -} - -var env = jsdom.env({ - scripts: script_filenames, - html: "<html><body></body></html>", - created: function(errors, window) { - window.console.log = console.log; // slightly evil - window.process = process; // more evil - }, - done: function (errors, window) { - var i; - var s1 = "#a"; - var s2 = "#a is"; - var nodes; - - window.force - .nodes(window.nodes) - .links(window.links) - .alpha(0.1) - .start(); - console.log('---------'); - console.log(errors); - console.log('---------'); - //console.log(window.textAnalyser2("#a")); - feed_sentence(window, s1, true); - dump_nodes(window); - feed_sentence(window, s2, false); - console.log(window.force.alpha()); - dump_nodes(window); - debugger; - window.force.tick(); - console.log(window.force.alpha()); - dump_nodes(window); - //console.log(window.nodes); - //console.log(window.links); - process.exit(); - window.debug_print(window.force); - //process.exit(); - } -}); |
