Permalink
Browse files

Use jsdom rather than domino

domino doesn't support the full DOM API; in particular,
the "elements" property on form elements is missing.

jsdom does a better job of supporting the full DOM API, but
requires an older version of node than I was using. So I changed
the node engine requirements in package.json and .travis.yml
to ensure that tests are run with the correct node version.
  • Loading branch information...
townxelliot committed Aug 16, 2013
1 parent aff14e5 commit c8ee57b58f5652067e40bef1e76d4b7717f05f88
Showing with 9 additions and 9 deletions.
  1. +0 −1 .travis.yml
  2. +3 −2 package.json
  3. +6 −6 test/dom.helper.js
View
@@ -1,5 +1,4 @@
language: node_js
node_js:
- "0.11"
- "0.10"
- "0.8"
View
@@ -21,6 +21,7 @@
"email": "ian.maffett@intel.com"
}
],
"engines" : { "node" : ">=0.8.14 <0.11" },
"license": "MIT",
"bugs": {
"url": "https://github.com/01org/appframework/issues"
@@ -44,8 +45,8 @@
"grunt-contrib-concat": "~0.3.0",
"grunt-mochaccino": "~0.1.4",
"chai": "~1.7.2",
"domino": "~1.0.12",
"blanket": "~1.1.5",
"grunt-cli": "~0.1.9"
"grunt-cli": "~0.1.9",
"jsdom": "~0.8.3"
}
}
View
@@ -1,17 +1,17 @@
var path = require("path");
var domino = require("domino");
var jsdom = require("jsdom");
var afPath = path.join(__dirname, "../appframework.js");
// html: html to load into the window
// jsFiles: array of paths to js files to load into the window
// callback: function with signature callback(errors, window)
// jsFiles: array of paths to js files to load into the window;
// loads af core by default
module.exports = function (html) {
if (!("window" in global)) {
global.window = domino.createWindow("<body></body>");
global.navigator = global.window.navigator;
global.document = jsdom.jsdom("<html><head></head><body></body></html>");
global.window = document.parentWindow;
global.navigator = window.navigator;
require(afPath);
global.$ = window.$;
global.document = window.document;
}
if (html) {

0 comments on commit c8ee57b

Please sign in to comment.