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> <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 editor-type-id="HtmlPreview">
<state />
</provider>
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="7" column="61" selection-start="350" selection-end="350" vertical-scroll-proportion="0.13782384"> <state line="7" column="61" selection-start="350" selection-end="350" vertical-scroll-proportion="0.13782384">
<folding /> <folding />
</state> </state>
</provider> </provider>
<provider editor-type-id="HtmlPreview">
<state />
</provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="bootstrap.js" pinned="false" current="false" current-in-tab="false"> <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="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 /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </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"> <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="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 /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </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"> <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">
@ -296,6 +296,19 @@
<RUBY_DOC NAME="NUMBER" VALUE="0" /> <RUBY_DOC NAME="NUMBER" VALUE="0" />
</component> </component>
<component name="RunManager"> <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"> <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" />
@ -315,38 +328,6 @@
</option> </option>
<envs /> <envs />
</configuration> </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"> <configuration default="true" type="RubyRunConfigurationType" factoryName="Ruby test">
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" /> <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_SCRIPT_PATH" VALUE="" />
@ -361,6 +342,25 @@
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" /> <RTEST_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="INHERITANCE_CHECK_DISABLED" VALUE="false" /> <RTEST_RUN_CONFIG_SETTINGS_ID NAME="INHERITANCE_CHECK_DISABLED" VALUE="false" />
</configuration> </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" /> <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>
@ -412,7 +412,7 @@
</todo-panel> </todo-panel>
</component> </component>
<component name="ToolWindowManager"> <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" /> <editor active="true" />
<layout> <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" /> <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>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/test/bootstrap.html"> <entry file="file://$PROJECT_DIR$/test/bootstrap.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="7" column="61" selection-start="350" selection-end="350" vertical-scroll-proportion="0.13782384"> <state line="7" column="61" selection-start="350" selection-end="350" vertical-scroll-proportion="0.13782384">
<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">
@ -522,30 +522,30 @@
</state> </state>
</provider> </provider>
</entry> </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"> <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="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 /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<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="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 /> <folding />
</state> </state>
</provider> </provider>
</entry> </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> </component>
</project> </project>

View File

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

29
test/bootstrap.js vendored
View File

@ -541,6 +541,34 @@ var testRunner = function() {
}, 1000); }, 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 () { var testNestedResults = function () {
// Leaf case // Leaf case
@ -636,6 +664,7 @@ var runTests = function () {
testBeforeAndAfterCallbacks(); testBeforeAndAfterCallbacks();
testSpecScope(); testSpecScope();
testRunner(); testRunner();
testRunnerFinishCallback();
testNestedResults(); testNestedResults();
testReporting(); testReporting();