From 8eb22243846262384cddcc50598da52d7e842dca Mon Sep 17 00:00:00 2001 From: "Glen E. Ivey" Date: Wed, 14 Apr 2010 17:34:10 -0700 Subject: [PATCH] Fixed another test that wouldn't run in the browser. Found problem introduced in one of my earlier fixes to 'html' tests (ant-build only, couldn't get "head" element of the document because boot.js didn't set location= to the test's index.html. alas). --- specs/helpers.js | 5 + specs/html/boot.js | 11 +- specs/html/index.html | 2 + specs/html/spec.js | 6 +- specs/window/boot.js | 1 + specs/window/index.html | 2 + specs/window/spec.js | 224 +++++++++++++++++++++------------------- 7 files changed, 140 insertions(+), 111 deletions(-) create mode 100644 specs/helpers.js diff --git a/specs/helpers.js b/specs/helpers.js new file mode 100644 index 00000000..af3cbc5c --- /dev/null +++ b/specs/helpers.js @@ -0,0 +1,5 @@ +// helpers available to all tests + +function runningUnderEnvjs(){ + return navigator.userAgent.search( /Envjs/ ) > -1; +} diff --git a/specs/html/boot.js b/specs/html/boot.js index 9604bd21..8fe27500 100644 --- a/specs/html/boot.js +++ b/specs/html/boot.js @@ -5,6 +5,7 @@ load('specs/qunit.js'); load('specs/env.qunit.js'); +load('specs/helpers.js'); QUnit.init(); load('dist/platform/core.js'); @@ -13,6 +14,14 @@ load('dist/console.js'); load('dist/dom.js'); load('dist/event.js'); load('dist/html.js'); +load('dist/timer.js'); +load('dist/parser.js'); +load('dist/xhr.js'); +load('dist/window.js'); + +load('local_settings.js'); load('specs/html/spec.js'); -start(); + +location = 'specs/html/index.html'; +start(); diff --git a/specs/html/index.html b/specs/html/index.html index bde474aa..cf0ea55c 100644 --- a/specs/html/index.html +++ b/specs/html/index.html @@ -9,6 +9,8 @@ + diff --git a/specs/html/spec.js b/specs/html/spec.js index c289ee8f..6c6f8deb 100644 --- a/specs/html/spec.js +++ b/specs/html/spec.js @@ -2,9 +2,7 @@ QUnit.module('html'); test('HTML Interfaces Available', function(){ - var areInEnvjs = navigator.userAgent.search( /Envjs/ ) > -1; - - if (areInEnvjs) + if (runningUnderEnvjs()) expect(53); else expect(51); @@ -54,7 +52,7 @@ test('HTML Interfaces Available', function(){ ok(HTMLTableSectionElement, 'HTMLTableSectionElement defined'); ok(HTMLTableCellElement, 'HTMLTableCellElement defined'); - if (areInEnvjs){ + if (runningUnderEnvjs()){ ok(HTMLTableDataCellElement, 'HTMLTableDataCellElement defined'); ok(HTMLTableHeaderCellElement, 'HTMLTableHeaderCellElement defined'); } diff --git a/specs/window/boot.js b/specs/window/boot.js index 77b1566c..ff455636 100644 --- a/specs/window/boot.js +++ b/specs/window/boot.js @@ -15,6 +15,7 @@ load('dist/window.js'); load('specs/qunit.js'); load('specs/env.qunit.js'); +load('specs/helpers.js'); load('local_settings.js'); load('specs/window/spec.js'); diff --git a/specs/window/index.html b/specs/window/index.html index d35a4cb8..00bc68f3 100644 --- a/specs/window/index.html +++ b/specs/window/index.html @@ -10,6 +10,8 @@ +