From f9b4c9da648f81aef1fbee41d24822e420eb56f9 Mon Sep 17 00:00:00 2001 From: Di Peng Date: Thu, 14 Jul 2011 18:28:15 -0700 Subject: refactor(docs): run e2e tests with and without jquery - e2e tests will run index.html (without jquery) and with index-jq.html(with jquery). - many small changes to make e2e tests work withough JQuery as we discover problems that were previously hidden by using real JQuery. --- docs/src/gen-docs.js | 3 ++- docs/src/ngdoc.js | 41 ++++++++++++++++++++++++++------------- docs/src/templates/doc_widgets.js | 10 ++++++---- docs/src/templates/index.html | 2 +- docs/src/writer.js | 11 +++++++---- 5 files changed, 43 insertions(+), 24 deletions(-) (limited to 'docs/src') diff --git a/docs/src/gen-docs.js b/docs/src/gen-docs.js index ead01c32..425831b6 100755 --- a/docs/src/gen-docs.js +++ b/docs/src/gen-docs.js @@ -27,6 +27,8 @@ var writes = callback.chain(function(){ writer.copyDir('img', writes.waitFor()); writer.copyDir('examples', writes.waitFor()); writer.copyTpl('index.html', writes.waitFor()); + writer.copy('docs/src/templates/index.html', 'build/docs/index-jq.html', writes.waitFor(), + '<-- jquery place holder -->', ' + <-- jquery place holder --> diff --git a/docs/src/writer.js b/docs/src/writer.js index 9ad202d9..0655572d 100644 --- a/docs/src/writer.js +++ b/docs/src/writer.js @@ -59,16 +59,19 @@ exports.makeDir = function (path, callback) { }; exports.copyTpl = function(filename, callback) { - copy('docs/src/templates/' + filename, OUTPUT_DIR + filename, callback); + exports.copy('docs/src/templates/' + filename, OUTPUT_DIR + filename, callback); }; -function copy(from, to, callback) { +exports.copy = function(from, to, callback, replacementKey, replacement) { //console.log('writing', to, '...'); fs.readFile(from, function(err, content){ if (err) return callback.error(err); + if(replacementKey && replacement) { + content = content.toString().replace(replacementKey, replacement); + } fs.writeFile(to, content, callback); }); -} +}; exports.copyDir = function copyDir(dir, callback) { exports.makeDir(OUTPUT_DIR + '/' + dir, callback.waitFor(function(){ @@ -81,7 +84,7 @@ exports.copyDir = function copyDir(dir, callback) { if (stat.isDirectory()) { copyDir(dir + '/' + file, callback.waitFor()); } else { - copy(path, OUTPUT_DIR + '/' + dir + '/' + file, callback.waitFor()); + exports.copy(path, OUTPUT_DIR + '/' + dir + '/' + file, callback.waitFor()); } })); }); -- cgit v1.2.3