dwf/rva: adding optional element for DOM output

This commit is contained in:
pivotal 2008-12-04 11:43:22 -08:00
parent cc164257a7
commit e1cafe7881
4 changed files with 95 additions and 82 deletions

View File

@ -79,29 +79,29 @@
<leaf> <leaf>
<file leaf-file-name="bootstrap.html" pinned="false" current="false" current-in-tab="false"> <file leaf-file-name="bootstrap.html" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/bootstrap.html"> <entry file="file://$PROJECT_DIR$/test/bootstrap.html">
<provider selected="true" editor-type-id="text-editor">
<state line="7" column="58" selection-start="347" selection-end="347" vertical-scroll-proportion="0.13782384">
<folding />
</state>
</provider>
<provider editor-type-id="HtmlPreview"> <provider editor-type-id="HtmlPreview">
<state /> <state />
</provider> </provider>
</entry>
</file>
<file leaf-file-name="json_reporter.js" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/json_reporter.js">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="15" column="37" selection-start="279" selection-end="279" vertical-scroll-proportion="0.27562863"> <state line="29" column="0" selection-start="991" selection-end="991" vertical-scroll-proportion="0.5709845">
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="bootstrap.js" pinned="false" current="true" current-in-tab="true"> <file leaf-file-name="json_reporter.js" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/lib/json_reporter.js">
<provider selected="true" editor-type-id="text-editor">
<state line="2" column="25" selection-start="87" selection-end="87" vertical-scroll-proportion="0.036750484">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="bootstrap.js" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/bootstrap.js"> <entry file="file://$PROJECT_DIR$/test/bootstrap.js">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="670" column="25" selection-start="19640" selection-end="19640" vertical-scroll-proportion="0.5093229"> <state line="674" column="65" selection-start="20000" selection-end="20000" vertical-scroll-proportion="0.5947007">
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -110,7 +110,7 @@
<file leaf-file-name="jasmine.js" pinned="false" current="false" current-in-tab="false"> <file leaf-file-name="jasmine.js" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/jasmine.js"> <entry file="file://$PROJECT_DIR$/lib/jasmine.js">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="285" column="5" selection-start="6014" selection-end="6014" vertical-scroll-proportion="0.43650794"> <state line="292" column="26" selection-start="6082" selection-end="6082" vertical-scroll-proportion="0.3617021">
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -118,14 +118,14 @@
</file> </file>
<file leaf-file-name="example.html" pinned="false" current="false" current-in-tab="false"> <file leaf-file-name="example.html" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/example.html"> <entry file="file://$PROJECT_DIR$/example/example.html">
<provider editor-type-id="HtmlPreview">
<state />
</provider>
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="8" column="7" selection-start="355" selection-end="355" vertical-scroll-proportion="0.15751295"> <state line="8" column="7" selection-start="355" selection-end="355" vertical-scroll-proportion="0.15751295">
<folding /> <folding />
</state> </state>
</provider> </provider>
<provider editor-type-id="HtmlPreview">
<state />
</provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="jasmine.css" pinned="false" current="false" current-in-tab="false"> <file leaf-file-name="jasmine.css" pinned="false" current="false" current-in-tab="false">
@ -305,52 +305,6 @@
<RUBY_DOC NAME="NUMBER" VALUE="0" /> <RUBY_DOC NAME="NUMBER" VALUE="0" />
</component> </component>
<component name="RunManager"> <component name="RunManager">
<configuration default="true" type="Applet" factoryName="Applet">
<module name="" />
<option name="MAIN_CLASS_NAME" />
<option name="HTML_FILE_NAME" />
<option name="HTML_USED" value="false" />
<option name="WIDTH" value="400" />
<option name="HEIGHT" value="300" />
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
<option name="VM_PARAMETERS" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
</configuration>
<configuration default="true" type="Remote" factoryName="Remote">
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" value="javadebug" />
<option name="HOST" value="localhost" />
<option name="PORT" value="5005" />
</configuration>
<configuration default="true" type="RubyRunConfigurationType" factoryName="Ruby test">
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_CLASS_NAME" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_METHOD_NAME" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift)" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="MODULE_NAME" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="INHERITANCE_CHECK_DISABLED" VALUE="false" />
</configuration>
<configuration default="true" type="Application" factoryName="Application" enabled="false" merge="false">
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="" />
<envs />
</configuration>
<configuration default="true" type="JUnit" factoryName="JUnit" enabled="false" merge="false"> <configuration default="true" type="JUnit" factoryName="JUnit" enabled="false" merge="false">
<module name="" /> <module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
@ -370,6 +324,52 @@
</option> </option>
<envs /> <envs />
</configuration> </configuration>
<configuration default="true" type="RubyRunConfigurationType" factoryName="Ruby test">
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_CLASS_NAME" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_METHOD_NAME" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift)" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="MODULE_NAME" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="INHERITANCE_CHECK_DISABLED" VALUE="false" />
</configuration>
<configuration default="true" type="Applet" factoryName="Applet">
<module name="" />
<option name="MAIN_CLASS_NAME" />
<option name="HTML_FILE_NAME" />
<option name="HTML_USED" value="false" />
<option name="WIDTH" value="400" />
<option name="HEIGHT" value="300" />
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
<option name="VM_PARAMETERS" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
</configuration>
<configuration default="true" type="Application" factoryName="Application" enabled="false" merge="false">
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="" />
<envs />
</configuration>
<configuration default="true" type="Remote" factoryName="Remote">
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" value="javadebug" />
<option name="HOST" value="localhost" />
<option name="PORT" value="5005" />
</configuration>
<list size="0" /> <list size="0" />
<configuration name="&lt;template&gt;" type="WebApp" default="true" selected="false"> <configuration name="&lt;template&gt;" type="WebApp" default="true" selected="false">
<Host>localhost</Host> <Host>localhost</Host>
@ -508,14 +508,14 @@
</component> </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/example/example.html"> <entry file="file://$PROJECT_DIR$/example/example.html">
<provider editor-type-id="HtmlPreview">
<state />
</provider>
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="8" column="7" selection-start="355" selection-end="355" vertical-scroll-proportion="0.15751295"> <state line="8" column="7" selection-start="355" selection-end="355" vertical-scroll-proportion="0.15751295">
<folding /> <folding />
</state> </state>
</provider> </provider>
<provider editor-type-id="HtmlPreview">
<state />
</provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/jasmine.css"> <entry file="file://$PROJECT_DIR$/lib/jasmine.css">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
@ -531,33 +531,33 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/test/bootstrap.html"> <entry file="file://$PROJECT_DIR$/lib/jasmine.js">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="7" column="58" selection-start="347" selection-end="347" vertical-scroll-proportion="0.13782384"> <state line="292" column="26" selection-start="6082" selection-end="6082" vertical-scroll-proportion="0.3617021">
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/bootstrap.html">
<provider editor-type-id="HtmlPreview"> <provider editor-type-id="HtmlPreview">
<state /> <state />
</provider> </provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/jasmine.js">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="285" column="5" selection-start="6014" selection-end="6014" vertical-scroll-proportion="0.43650794"> <state line="29" column="0" selection-start="991" selection-end="991" vertical-scroll-proportion="0.5709845">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/json_reporter.js">
<provider selected="true" editor-type-id="text-editor">
<state line="15" column="37" selection-start="279" selection-end="279" vertical-scroll-proportion="0.27562863">
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/test/bootstrap.js"> <entry file="file://$PROJECT_DIR$/test/bootstrap.js">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="670" column="25" selection-start="19640" selection-end="19640" vertical-scroll-proportion="0.5093229"> <state line="674" column="65" selection-start="20000" selection-end="20000" vertical-scroll-proportion="0.5947007">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/json_reporter.js">
<provider selected="true" editor-type-id="text-editor">
<state line="2" column="25" selection-start="87" selection-end="87" vertical-scroll-proportion="0.036750484">
<folding /> <folding />
</state> </state>
</provider> </provider>

View File

@ -1,5 +1,6 @@
JasmineReporters.JSON = function () { JasmineReporters.JSON = function (elementId) {
var that = { var that = {
elementId: elementId,
results: {}, results: {},
addResults: function (results) { addResults: function (results) {
@ -7,7 +8,15 @@ JasmineReporters.JSON = function () {
}, },
report: function () { report: function () {
return Object.toJSON(that.results); var output = Object.toJSON(that.results);
if (that.elementId) {
var element = document.getElementById(that.elementId);
if (element) {
element.innerHTML = output;
}
}
return output;
} }
} }
return that; return that;

View File

@ -26,6 +26,7 @@
<div id="fail_messages"></div> <div id="fail_messages"></div>
</div> </div>
</div> </div>
<div style="display:none" id="json_reporter_results"></div>
</body> </body>
</html> </html>

5
test/bootstrap.js vendored
View File

@ -658,7 +658,7 @@ var testJSONReporter = function () {
}); });
}); });
runner.reporter = JasmineReporters.JSON(); runner.reporter = JasmineReporters.JSON('json_reporter_results');
reporter.test((runner.reporter !== undefined), reporter.test((runner.reporter !== undefined),
"Runner's reporter is undefined"); "Runner's reporter is undefined");
@ -671,6 +671,9 @@ var testJSONReporter = function () {
setTimeout(function() { setTimeout(function() {
reporter.test((runner.reporter.report() === expectedJSONString), reporter.test((runner.reporter.report() === expectedJSONString),
'Jasmine Reporter does not have the expected report, has: ' + runner.reporter.report()); 'Jasmine Reporter does not have the expected report, has: ' + runner.reporter.report());
reporter.test((document.getElementById('json_reporter_results').innerHTML === expectedJSONString),
'Jasmine Reporter did not output the string to the DOM');
}, 500); }, 500);
} }