dwf/rva: actionColllection now has an optional finishCallback

This commit is contained in:
pivotal 2008-12-04 09:37:36 -08:00
parent f5486bde35
commit 735ebd6c66
3 changed files with 95 additions and 59 deletions

View File

@ -79,44 +79,44 @@
<leaf>
<file leaf-file-name="bootstrap.html" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/bootstrap.html">
<provider editor-type-id="HtmlPreview">
<state />
</provider>
<provider selected="true" editor-type-id="text-editor">
<state line="7" column="61" selection-start="350" selection-end="350" vertical-scroll-proportion="0.13782384">
<folding />
</state>
</provider>
<provider editor-type-id="HtmlPreview">
<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">
<provider selected="true" editor-type-id="text-editor">
<state line="518" column="0" selection-start="14460" selection-end="14460" vertical-scroll-proportion="0.59381044">
<state line="565" column="0" selection-start="15772" selection-end="15858" vertical-scroll-proportion="0.7794971">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="jasmine.js" pinned="false" current="false" current-in-tab="false">
<file leaf-file-name="jasmine.js" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/lib/jasmine.js">
<provider selected="true" editor-type-id="text-editor">
<state line="279" column="17" selection-start="5820" selection-end="5820" vertical-scroll-proportion="0.3968254">
<state line="70" column="0" selection-start="1481" selection-end="1553" vertical-scroll-proportion="0.2205029">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="example.html" pinned="false" current="true" current-in-tab="true">
<file leaf-file-name="example.html" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/example.html">
<provider editor-type-id="HtmlPreview">
<state />
</provider>
<provider selected="true" editor-type-id="text-editor">
<state line="8" column="7" selection-start="355" selection-end="355" vertical-scroll-proportion="0.15751295">
<folding />
</state>
</provider>
<provider editor-type-id="HtmlPreview">
<state />
</provider>
</entry>
</file>
<file leaf-file-name="jasmine.css" pinned="false" current="false" current-in-tab="false">
@ -296,6 +296,19 @@
<RUBY_DOC NAME="NUMBER" VALUE="0" />
</component>
<component name="RunManager">
<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">
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
@ -315,38 +328,6 @@
</option>
<envs />
</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>
<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="RubyRunConfigurationType" factoryName="Ruby test">
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
@ -361,6 +342,25 @@
<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="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" />
<configuration name="&lt;template&gt;" type="WebApp" default="true" selected="false">
<Host>localhost</Host>
@ -412,7 +412,7 @@
</todo-panel>
</component>
<component name="ToolWindowManager">
<frame x="80" y="22" width="1661" height="1178" extended-state="0" />
<frame x="2" y="22" width="1661" height="1178" extended-state="0" />
<editor active="true" />
<layout>
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
@ -499,14 +499,14 @@
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/test/bootstrap.html">
<provider editor-type-id="HtmlPreview">
<state />
</provider>
<provider selected="true" editor-type-id="text-editor">
<state line="7" column="61" selection-start="350" selection-end="350" vertical-scroll-proportion="0.13782384">
<folding />
</state>
</provider>
<provider editor-type-id="HtmlPreview">
<state />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/jasmine.css">
<provider selected="true" editor-type-id="text-editor">
@ -522,30 +522,30 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/example.html">
<provider editor-type-id="HtmlPreview">
<state />
</provider>
<provider selected="true" editor-type-id="text-editor">
<state line="8" column="7" selection-start="355" selection-end="355" vertical-scroll-proportion="0.15751295">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/bootstrap.js">
<provider selected="true" editor-type-id="text-editor">
<state line="518" column="0" selection-start="14460" selection-end="14460" vertical-scroll-proportion="0.59381044">
<state line="565" column="0" selection-start="15772" selection-end="15858" vertical-scroll-proportion="0.7794971">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/jasmine.js">
<provider selected="true" editor-type-id="text-editor">
<state line="279" column="17" selection-start="5820" selection-end="5820" vertical-scroll-proportion="0.3968254">
<state line="70" column="0" selection-start="1481" selection-end="1553" vertical-scroll-proportion="0.2205029">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/example.html">
<provider selected="true" editor-type-id="text-editor">
<state line="8" column="7" selection-start="355" selection-end="355" vertical-scroll-proportion="0.15751295">
<folding />
</state>
</provider>
<provider editor-type-id="HtmlPreview">
<state />
</provider>
</entry>
</component>
</project>

View File

@ -64,6 +64,13 @@ var actionCollection = function () {
finished: false,
results: nestedResults(),
finish: function () {
if (that.finishCallback) {
that.finishCallback();
}
that.finished = true;
},
report: function (result) {
that.results.push(result);
},
@ -80,7 +87,7 @@ var actionCollection = function () {
next: function() {
if (that.index >= that.actions.length) {
that.finished = true;
that.finish();
return;
}

29
test/bootstrap.js vendored
View File

@ -541,6 +541,34 @@ var testRunner = function() {
}, 1000);
}
var testRunnerFinishCallback = function () {
var runner = Runner();
var foo = 0;
runner.finish();
reporter.test((runner.finishCallback === undefined),
"Runner finish callback was defined");
reporter.test((runner.finished === true),
"Runner finished flag was not set.");
runner.finishCallback = function () {
foo++;
}
runner.finish();
reporter.test((runner.finished === true),
"Runner finished flag was not set.");
reporter.test((runner.finishCallback !== undefined),
"Runner finish callback was not defined");
reporter.test((foo === 1),
"Runner finish callback was not called");
}
var testNestedResults = function () {
// Leaf case
@ -636,6 +664,7 @@ var runTests = function () {
testBeforeAndAfterCallbacks();
testSpecScope();
testRunner();
testRunnerFinishCallback();
testNestedResults();
testReporting();