Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| add3e1ee7a | |||
| baf1bf10f6 | |||
| 504ba8c54d |
@@ -1,14 +1 @@
|
|||||||
.idea/
|
.idea
|
||||||
.svn/
|
|
||||||
.DS_Store
|
|
||||||
site/
|
|
||||||
.bundle/
|
|
||||||
.pairs
|
|
||||||
.rvmrc
|
|
||||||
*.gem
|
|
||||||
.bundle
|
|
||||||
tags
|
|
||||||
Gemfile.lock
|
|
||||||
pkg/*
|
|
||||||
.sass-cache/*
|
|
||||||
src/html/.sass-cache/*
|
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
[submodule "pages"]
|
|
||||||
path = pages
|
|
||||||
url = git@github.com:pivotal/jasmine.git
|
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project relativePaths="false" version="4">
|
||||||
|
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
|
||||||
|
</project>
|
||||||
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0" is_locked="false">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<option name="myLocal" value="false" />
|
||||||
|
<inspection_tool class="CheckXmlFileWithXercesValidator" level="ERROR" enabled="false" />
|
||||||
|
<inspection_tool class="XmlUnboundNsPrefix" level="WARNING" enabled="false" />
|
||||||
|
<inspection_tool class="CheckDtdRefs" level="ERROR" enabled="false" />
|
||||||
|
<inspection_tool class="XmlDuplicatedId" level="ERROR" enabled="false" />
|
||||||
|
<inspection_tool class="XmlWrongRootElement" level="ERROR" enabled="false" />
|
||||||
|
<inspection_tool class="CheckTagEmptyBody" level="WARNING" enabled="false" />
|
||||||
|
</profile>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<settings>
|
||||||
|
<option name="PROJECT_PROFILE" value="Project Default" />
|
||||||
|
<option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
|
||||||
|
<scopes />
|
||||||
|
<list size="0" />
|
||||||
|
</settings>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module relativePaths="false" type="RUBY_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="library" name="[gem] rspec (v1.2.8, /Library/Ruby/Gems/1.8/gems/rspec-1.2.8)" level="application" />
|
||||||
|
</component>
|
||||||
|
<component name="RModuleSettingsStorage">
|
||||||
|
<RMODULE_SETTINGS_STORAGE_ID NAME="NUMBER" VALUE="0" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project relativePaths="false" version="4">
|
||||||
|
<component name="DependencyValidationManager">
|
||||||
|
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectDetails">
|
||||||
|
<option name="projectName" value="jasmine-ruby" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="Ruby SDK 1.8.6 (/usr/bin/ruby)" project-jdk-type="RUBY_SDK" />
|
||||||
|
<component name="SvnBranchConfigurationManager">
|
||||||
|
<option name="mySupportsUserInfoFilter" value="true" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project relativePaths="false" version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/jasmine-ruby.iml" filepath="$PROJECT_DIR$/.idea/jasmine-ruby.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project relativePaths="false" version="4">
|
||||||
|
<component name="CodeStyleSettingsManager">
|
||||||
|
<option name="PER_PROJECT_SETTINGS" />
|
||||||
|
<option name="USE_PER_PROJECT_SETTINGS" value="false" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project relativePaths="false" version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="" />
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
||||||
@@ -0,0 +1,330 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project relativePaths="false" version="4">
|
||||||
|
<component name="ChangeListManager">
|
||||||
|
<list default="true" readonly="true" name="Default" comment="" />
|
||||||
|
<ignored path=".idea/workspace.xml" />
|
||||||
|
<ignored path="jasmine-ruby.iws" />
|
||||||
|
</component>
|
||||||
|
<component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
|
||||||
|
<component name="CreatePatchCommitExecutor">
|
||||||
|
<option name="PATCH_PATH" value="" />
|
||||||
|
<option name="REVERSE_PATCH" value="false" />
|
||||||
|
</component>
|
||||||
|
<component name="DaemonCodeAnalyzer">
|
||||||
|
<disable_hints />
|
||||||
|
</component>
|
||||||
|
<component name="FavoritesManager">
|
||||||
|
<favorites_list name="jasmine-ruby" />
|
||||||
|
</component>
|
||||||
|
<component name="FileEditorManager">
|
||||||
|
<leaf>
|
||||||
|
<file leaf-file-name="jasmine" pinned="false" current="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/bin/jasmine">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="3" column="0" selection-start="131" selection-end="131" vertical-scroll-proportion="0.0">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file leaf-file-name="jasmine_helper.rb" pinned="false" current="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/lib/jasmine-ruby/jasmine_helper.rb">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="25" column="51" selection-start="623" selection-end="623" vertical-scroll-proportion="0.0">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file leaf-file-name="jasmine_spec.rb" pinned="false" current="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/spec/jasmine_spec.rb">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="16" column="34" selection-start="678" selection-end="678" vertical-scroll-proportion="0.0">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file leaf-file-name="Rakefile" pinned="false" current="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/Rakefile">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="13" column="31" selection-start="452" selection-end="452" vertical-scroll-proportion="0.0">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file leaf-file-name="VERSION.yml" pinned="false" current="true" current-in-tab="true">
|
||||||
|
<entry file="file://$PROJECT_DIR$/VERSION.yml">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="4" column="0" selection-start="34" selection-end="34" vertical-scroll-proportion="0.1285956">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file leaf-file-name="jasmine_runner.rb" pinned="false" current="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/jasmine/contrib/ruby/jasmine_runner.rb">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="2" column="14" selection-start="45" selection-end="45" vertical-scroll-proportion="0.0">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file leaf-file-name="jasmine_spec_builder.rb" pinned="false" current="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/jasmine/contrib/ruby/jasmine_spec_builder.rb">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="41" column="17" selection-start="956" selection-end="956" vertical-scroll-proportion="0.0">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file leaf-file-name="Rakefile" pinned="false" current="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/jasmine/Rakefile">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="51" column="17" selection-start="1646" selection-end="1646" vertical-scroll-proportion="0.0">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
</leaf>
|
||||||
|
</component>
|
||||||
|
<component name="FindManager">
|
||||||
|
<FindUsagesManager>
|
||||||
|
<setting name="OPEN_NEW_TAB" value="false" />
|
||||||
|
</FindUsagesManager>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectLevelVcsManager">
|
||||||
|
<OptionsSetting value="true" id="Add" />
|
||||||
|
<OptionsSetting value="true" id="Remove" />
|
||||||
|
<OptionsSetting value="true" id="Checkout" />
|
||||||
|
<OptionsSetting value="true" id="Update" />
|
||||||
|
<OptionsSetting value="true" id="Status" />
|
||||||
|
<OptionsSetting value="true" id="Edit" />
|
||||||
|
<ConfirmationsSetting value="0" id="Add" />
|
||||||
|
<ConfirmationsSetting value="0" id="Remove" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectPane">
|
||||||
|
<subPane>
|
||||||
|
<PATH>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="jasmine-ruby" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
</PATH>
|
||||||
|
<PATH>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="jasmine-ruby" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="jasmine-ruby" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
</PATH>
|
||||||
|
</subPane>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectReloadState">
|
||||||
|
<option name="STATE" value="0" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectView">
|
||||||
|
<navigator currentView="ProjectPane" proportions="0.5" version="1" splitterProportion="0.5">
|
||||||
|
<flattenPackages />
|
||||||
|
<showMembers />
|
||||||
|
<showModules />
|
||||||
|
<showLibraryContents />
|
||||||
|
<hideEmptyPackages />
|
||||||
|
<abbreviatePackageNames />
|
||||||
|
<showStructure ProjectPane="false" />
|
||||||
|
<autoscrollToSource />
|
||||||
|
<autoscrollFromSource />
|
||||||
|
<sortByType />
|
||||||
|
</navigator>
|
||||||
|
</component>
|
||||||
|
<component name="PropertiesComponent">
|
||||||
|
<property name="options.splitter.details.proportions" value="0.2" />
|
||||||
|
<property name="options.splitter.main.proportions" value="0.3" />
|
||||||
|
<property name="options.searchVisible" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="RunManager">
|
||||||
|
<configuration default="true" type="CucumberRunConfigurationType" factoryName="Cucumber">
|
||||||
|
<module name="" />
|
||||||
|
<CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift)" />
|
||||||
|
<CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="" />
|
||||||
|
<CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
|
||||||
|
<CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
||||||
|
<CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
||||||
|
<envs />
|
||||||
|
<CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*.feature" />
|
||||||
|
<CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
|
||||||
|
<CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
|
||||||
|
<CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
|
||||||
|
<CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="TEST_TAGS_FILTER" VALUE="" />
|
||||||
|
<CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="TEST_NAME_FILTER" VALUE="" />
|
||||||
|
<CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="CUCUMBER_ARGS" VALUE="" />
|
||||||
|
<CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
|
||||||
|
<CUCUMBER_RUN_CONFIG_SETTINGS_ID NAME="VERBOSE_OPTION" VALUE="false" />
|
||||||
|
</configuration>
|
||||||
|
<configuration default="true" type="RSpecRunConfigurationType" factoryName="RSpec">
|
||||||
|
<module name="" />
|
||||||
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift)" />
|
||||||
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="" />
|
||||||
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
|
||||||
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
||||||
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
||||||
|
<envs />
|
||||||
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
|
||||||
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
|
||||||
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="[none]" />
|
||||||
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
|
||||||
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="" />
|
||||||
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
|
||||||
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
|
||||||
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
|
||||||
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
|
||||||
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
|
||||||
|
</configuration>
|
||||||
|
<configuration default="true" type="TestUnitRunConfigurationType" factoryName="Ruby test">
|
||||||
|
<module name="" />
|
||||||
|
<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="SHOULD_USE_SDK" VALUE="false" />
|
||||||
|
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
||||||
|
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
||||||
|
<envs />
|
||||||
|
<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="INHERITANCE_CHECK_DISABLED" VALUE="false" />
|
||||||
|
</configuration>
|
||||||
|
<list size="0" />
|
||||||
|
</component>
|
||||||
|
<component name="ShelveChangesManager" show_recycled="false" />
|
||||||
|
<component name="SvnConfiguration">
|
||||||
|
<option name="USER" value="" />
|
||||||
|
<option name="PASSWORD" value="" />
|
||||||
|
<option name="LAST_MERGED_REVISION" />
|
||||||
|
<option name="UPDATE_RUN_STATUS" value="false" />
|
||||||
|
<option name="MERGE_DRY_RUN" value="false" />
|
||||||
|
<option name="MERGE_DIFF_USE_ANCESTRY" value="true" />
|
||||||
|
<option name="UPDATE_LOCK_ON_DEMAND" value="false" />
|
||||||
|
<option name="IGNORE_SPACES_IN_MERGE" value="false" />
|
||||||
|
<option name="DETECT_NESTED_COPIES" value="true" />
|
||||||
|
<option name="IGNORE_SPACES_IN_ANNOTATE" value="true" />
|
||||||
|
<configuration useDefault="true">/Users/ragaskar/.subversion</configuration>
|
||||||
|
<myIsUseDefaultProxy>false</myIsUseDefaultProxy>
|
||||||
|
<supportedVersion>125</supportedVersion>
|
||||||
|
</component>
|
||||||
|
<component name="ToolWindowManager">
|
||||||
|
<frame x="-4" y="24" width="1619" height="1028" extended-state="0" />
|
||||||
|
<editor active="true" />
|
||||||
|
<layout>
|
||||||
|
<window_info id="Web Preview" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" />
|
||||||
|
<window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" />
|
||||||
|
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" />
|
||||||
|
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" />
|
||||||
|
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" />
|
||||||
|
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24952978" sideWeight="0.6627409" order="0" side_tool="false" />
|
||||||
|
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" />
|
||||||
|
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32976446" sideWeight="0.5" order="1" side_tool="false" />
|
||||||
|
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" />
|
||||||
|
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" />
|
||||||
|
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" />
|
||||||
|
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" />
|
||||||
|
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" />
|
||||||
|
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" />
|
||||||
|
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" />
|
||||||
|
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" />
|
||||||
|
</layout>
|
||||||
|
</component>
|
||||||
|
<component name="VcsManagerConfiguration">
|
||||||
|
<option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" />
|
||||||
|
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="true" />
|
||||||
|
<option name="PERFORM_UPDATE_IN_BACKGROUND" value="true" />
|
||||||
|
<option name="PERFORM_COMMIT_IN_BACKGROUND" value="true" />
|
||||||
|
<option name="PERFORM_EDIT_IN_BACKGROUND" value="true" />
|
||||||
|
<option name="PERFORM_CHECKOUT_IN_BACKGROUND" value="true" />
|
||||||
|
<option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true" />
|
||||||
|
<option name="PERFORM_ROLLBACK_IN_BACKGROUND" value="false" />
|
||||||
|
<option name="FORCE_NON_EMPTY_COMMENT" value="false" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" />
|
||||||
|
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
|
||||||
|
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
|
||||||
|
<option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
|
||||||
|
<option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
|
||||||
|
<option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
|
||||||
|
<option name="ACTIVE_VCS_NAME" />
|
||||||
|
<option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
|
||||||
|
<option name="UPDATE_GROUP_BY_CHANGELIST" value="false" />
|
||||||
|
<option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
|
||||||
|
<option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
|
||||||
|
</component>
|
||||||
|
<component name="XDebuggerManager">
|
||||||
|
<breakpoint-manager />
|
||||||
|
</component>
|
||||||
|
<component name="editorHistoryManager">
|
||||||
|
<entry file="file://$PROJECT_DIR$/jasmine/contrib/ruby/jasmine_runner.rb">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="2" column="14" selection-start="45" selection-end="45" vertical-scroll-proportion="0.0">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/jasmine/contrib/ruby/jasmine_spec_builder.rb">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="41" column="17" selection-start="956" selection-end="956" vertical-scroll-proportion="0.0">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/jasmine/Rakefile">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="51" column="17" selection-start="1646" selection-end="1646" vertical-scroll-proportion="0.0">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/bin/jasmine">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="3" column="0" selection-start="131" selection-end="131" vertical-scroll-proportion="0.0">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/lib/jasmine-ruby/jasmine_helper.rb">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="25" column="51" selection-start="623" selection-end="623" vertical-scroll-proportion="0.0">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/spec/jasmine_spec.rb">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="16" column="34" selection-start="678" selection-end="678" vertical-scroll-proportion="0.0">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/Rakefile">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="13" column="31" selection-start="452" selection-end="452" vertical-scroll-proportion="0.0">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/VERSION.yml">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="4" column="0" selection-start="34" selection-end="34" vertical-scroll-proportion="0.1285956">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
# Developing for Jasmine Core
|
|
||||||
|
|
||||||
## How to Contribute
|
|
||||||
|
|
||||||
We welcome your contributions - Thanks for helping make Jasmine a better project for everyone. Please review the backlog and discussion lists (the main group - [http://groups.google.com/group/jasmine-js](http://groups.google.com/group/jasmine-js) and the developer's list - [http://groups.google.com/group/jasmine-js-dev](http://groups.google.com/group/jasmine-js-dev)) before starting work - what you're looking for may already have been done. If it hasn't, the community can help make your contribution better.
|
|
||||||
|
|
||||||
## How to write new Jasmine code
|
|
||||||
|
|
||||||
Or, How to make a successful pull request
|
|
||||||
|
|
||||||
* _Do not change the public interface_. Lots of projects depend on Jasmine and if you aren't careful you'll break them
|
|
||||||
* _Be environment agnostic_ - server-side developers are just as important as browser developers
|
|
||||||
* _Be browser agnostic_ - if you must rely on browser-specific functionality, please write it in a way that degrades gracefully
|
|
||||||
* _Write specs_ - Jasmine's a testing framework; don't add functionality without test-driving it
|
|
||||||
* _Ensure the *entire* test suite is green_ in all the big browsers, Node, and JSHint - your contribution shouldn't break Jasmine for other users
|
|
||||||
|
|
||||||
Follow these tips and your pull request, patch, or suggestion is much more likely to be integrated.
|
|
||||||
|
|
||||||
## Environment
|
|
||||||
|
|
||||||
Ruby, RubyGems and Rake are used in order to script the various file interactions. You will need to run on a system that supports Ruby in order to run Jasmine's specs.
|
|
||||||
|
|
||||||
Node.js is used to run most of the specs (the HTML-independent code) and should be present. Additionally, the JS Hint project scrubs the source code as part of the spec process.
|
|
||||||
|
|
||||||
## Development
|
|
||||||
|
|
||||||
All source code belongs in `src/`. The `core/` directory contains the bulk of Jasmine's functionality. This code should remain browser- and environment-agnostic. If your feature or fix cannot be, as mentioned above, please degrade gracefully. Any code that should only be in a non-browser environment should live in `src/console/`. Any code that depends on a browser (specifically, it expects `window` to be the global or `document` is present) should live in `src/html/`.
|
|
||||||
|
|
||||||
Please respect the code patterns as possible. For example, using `jasmine.getGlobal()` to get the global object so as to remain environment agnostic.
|
|
||||||
|
|
||||||
## Running Specs
|
|
||||||
|
|
||||||
As in all good projects, the `spec/` directory mirrors `src/` and follows the same rules. The browser runner will include and attempt to run all specs. The node runner will exclude any html-dependent specs (those in `spec/html/`).
|
|
||||||
|
|
||||||
You will notice that all specs are run against the built `jasmine.js` instead of the component source files. This is intentional as a way to ensure that the concatenation code is working correctly.
|
|
||||||
|
|
||||||
Please ensure all specs are green before committing or issuing a pull request.
|
|
||||||
|
|
||||||
There are Thor tasks to help with getting green - run `thor list` to see them all. Here are the key tasks:
|
|
||||||
|
|
||||||
* `thor jasmine_dev:execute_specs` outputs the expected number of specs that should be run and attempts to run in browser and Node
|
|
||||||
* `thor jasmine_dev:execute_specs_in_browser` opens `spec/runner.html` in the default browser on MacOS. Please run this in at least Firefox and Chrome before committing
|
|
||||||
* `thor jasmine_dev:execute_specs_in_node` runs all the Jasmine specs in Node.js - it will complain if Node is not installed
|
|
||||||
* `thor jasmine_dev:js_hint` runs all the files through JSHint and will complain about potential viable issues with your code. Fix them.
|
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2008-2011 Pivotal Labs
|
Copyright (c) 2008 Pivotal Labs
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
a copy of this software and associated documentation files (the
|
a copy of this software and associated documentation files (the
|
||||||
@@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|||||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
@@ -1,24 +1,479 @@
|
|||||||
<a name="README">[Jasmine](http://pivotal.github.com/jasmine/)</a>
|
Jasmine
|
||||||
=======
|
=======
|
||||||
**A JavaScript Testing Framework**
|
**YET ANOTHER JavaScript testing framework**
|
||||||
|
|
||||||
Jasmine is a Behavior Driven Development testing framework for JavaScript. It does not rely on browsers, DOM, or any JavaScript framework. Thus it's suited for websites, [Node.js](http://nodejs.org) projects, or anywhere that JavaScript can run.
|
Quick Start
|
||||||
|
----------
|
||||||
|
|
||||||
Documentation & guides live here: [http://pivotal.github.com/jasmine/](http://pivotal.github.com/jasmine/)
|
### Ruby Suite Running
|
||||||
|
|
||||||
|
sudo gem sources -a http://gems.github.com
|
||||||
|
sudo gem install json thin
|
||||||
|
git clone git://github.com/pivotal/jasmine.git
|
||||||
|
cd jasmine/examples/ruby
|
||||||
|
rake jasmine_server
|
||||||
|
|
||||||
|
open `http://localhost:8888/` in your favorite browser.
|
||||||
|
|
||||||
|
### HTML Suite Running
|
||||||
|
|
||||||
|
git clone git://github.com/pivotal/jasmine.git
|
||||||
|
|
||||||
|
open `examples/test/html/example_suite.html` in your favorite browser.
|
||||||
|
|
||||||
|
### Automatic Suite Running (w/ Selenium)
|
||||||
|
|
||||||
|
sudo gem sources -a http://gems.github.com
|
||||||
|
sudo gem install json thin pivotal-selenium-rc selenium-client
|
||||||
|
git clone git://github.com/pivotal/jasmine.git
|
||||||
|
cd jasmine/examples/ruby
|
||||||
|
rake test:ci
|
||||||
|
|
||||||
|
Releases
|
||||||
|
----------
|
||||||
|
0.9.0 beta [[download]](http://github.com/pivotal/jasmine/zipball/master)
|
||||||
|
`git clone git://github.com/pivotal/jasmine.git`
|
||||||
|
|
||||||
|
0.8.0 [[download]](http://github.com/pivotal/jasmine/zipball/0.8.0)
|
||||||
|
|
||||||
|
### Which Release Should I Use?
|
||||||
|
|
||||||
|
Please use the latest version unless you have a good reason not to. Some of this documentation may not be applicable to older versions.
|
||||||
|
|
||||||
|
|
||||||
|
Why Another Frickin' JS TDD/BDD Framework?
|
||||||
|
-----------
|
||||||
|
|
||||||
|
There are some situations when you want to test-drive JavaScript, but you don't want to be bothered with or even have an explicit document. You have no DOM to work with and thus lack HTML elements on which to hang event handlers. You may need to make asynchronous calls (say, to an AJAX API) and cannot mock/stub them.
|
||||||
|
|
||||||
|
But you still need to write tests.
|
||||||
|
|
||||||
|
What's an Agile Engineer to do?
|
||||||
|
|
||||||
|
Enter Jasmine
|
||||||
|
------------
|
||||||
|
|
||||||
|
Jasmine is yet another JavaScript testing framework. It's *heavily* influenced by JSSpec, ScrewUnit & [JSpec](http://github.com/visionmedia/jspec/tree/master), which are all influenced by RSpec. But each of those was lacking in some way: JSSpec & ScrewUnit require a DOM. JSpec's DOM-less assumption was a great start, but it needed asynchronous support.
|
||||||
|
|
||||||
|
So we started over. And TDD'd a whole new framework. Enjoy.
|
||||||
|
|
||||||
|
How To
|
||||||
|
------
|
||||||
|
|
||||||
|
There is a nice example of how to use Jasmine in the /example directory. But here's more information.
|
||||||
|
|
||||||
|
Exciting changes are afoot and many syntax changes have been made to make Jasmine more usable. Please read the examples below for updates.
|
||||||
|
|
||||||
|
### Specs
|
||||||
|
|
||||||
|
Each spec is, naturally, a JavaScript function. You tell Jasmine about this spec with a call to `it()` with a string and the function. The string is a description that will be helpful to you when reading a report.
|
||||||
|
|
||||||
|
it('should be a test', function () {
|
||||||
|
var foo = 0
|
||||||
|
foo++;
|
||||||
|
});
|
||||||
|
|
||||||
|
### Expectations
|
||||||
|
|
||||||
|
Within your spec you will want/need to make expectations. These are made with the `expect()` funciton and expectation matchers. like this:
|
||||||
|
|
||||||
|
it('should be a test', function () {
|
||||||
|
var foo = 0
|
||||||
|
foo++;
|
||||||
|
|
||||||
|
expect(foo).toEqual(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
Results of the expectations are logged for later for reporting.
|
||||||
|
|
||||||
|
#### Expectation Matchers
|
||||||
|
|
||||||
|
Jasmine has several built-in matchers. Here are a few:
|
||||||
|
|
||||||
|
`toEqual()` compares objects or primitives and returns true if they are equal
|
||||||
|
|
||||||
|
`toNotEqual()` compares objects or primitives and returns true if they are not equal
|
||||||
|
|
||||||
|
`toMatch()` takes a regex or a string and returns true if it matches
|
||||||
|
|
||||||
|
`toNotMatch()` takes a regex or a string and returns true if it does not match
|
||||||
|
|
||||||
|
`toBeDefined()` returns true if the object or primitive is not `undefined`
|
||||||
|
|
||||||
|
`toBeNull()` returns true if the object or primitive is not `null`
|
||||||
|
|
||||||
|
`toBeTruthy()` returns true if the object or primitive evaluates to true
|
||||||
|
|
||||||
|
`toBeFalsy()` returns true if the object or primitive evaluates to false
|
||||||
|
|
||||||
|
`toContain()` returns true if an array or string contains the passed variable.
|
||||||
|
|
||||||
|
`toNotContain()` returns true if an array or string does not contain the passed variable.
|
||||||
|
|
||||||
|
#### Writing New Matchers
|
||||||
|
|
||||||
|
A Matcher has a method name, takes an expected value as it's only parameter, has access to the actual value in this, and then makes a call to this.report with true/false with a failure message. Here's the definition of `toEqual()`:
|
||||||
|
|
||||||
|
Jasmine.Matchers.prototype.toEqual = function (expected) {
|
||||||
|
return this.report((this.actual === expected),
|
||||||
|
'Expected ' + expected + ' but got ' + this.actual + '.');
|
||||||
|
});
|
||||||
|
|
||||||
|
Feel free to define your own matcher as needed in your code. If you'd like to add Matchers to Jasmine, please write tests.
|
||||||
|
|
||||||
|
### Asynchronous Specs
|
||||||
|
|
||||||
|
You may be thinking, "That's all well and good, but you mentioned something about asynchronous tests."
|
||||||
|
|
||||||
|
Well, say you need to make a call that is asynchronous - an AJAX API, or some other JavaScript library. That is, the call returns immediately, yet you want to make expectations 'at some point in the future' after some magic happens in the background.
|
||||||
|
|
||||||
|
Jasmine allows you to do this with `runs()` and `waits()` blocks.
|
||||||
|
|
||||||
|
`runs()` blocks by themselves simply run as if they were called directly. The following snippets of code should provide similar results:
|
||||||
|
|
||||||
|
it('should be a test', function () {
|
||||||
|
var foo = 0
|
||||||
|
foo++;
|
||||||
|
|
||||||
|
expect(foo).toEqual(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
and
|
||||||
|
|
||||||
|
it('should be a test', function () {
|
||||||
|
runs( function () {
|
||||||
|
var foo = 0
|
||||||
|
foo++;
|
||||||
|
|
||||||
|
expect(foo).toEqual(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
multiple `runs()` blocks in a spec will run serially. For example,
|
||||||
|
|
||||||
|
it('should be a test', function () {
|
||||||
|
runs( function () {
|
||||||
|
var foo = 0
|
||||||
|
foo++;
|
||||||
|
|
||||||
|
expect(foo).toEqual(1);
|
||||||
|
});
|
||||||
|
runs( function () {
|
||||||
|
var bar = 0
|
||||||
|
bar++;
|
||||||
|
|
||||||
|
expect(bar).toEqual(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
`runs()` blocks share functional scope -- `this` properties will be common to all blocks, but declared `var`'s will not!
|
||||||
|
|
||||||
|
it('should be a test', function () {
|
||||||
|
runs( function () {
|
||||||
|
this.foo = 0
|
||||||
|
this.foo++;
|
||||||
|
var bar = 0;
|
||||||
|
bar++;
|
||||||
|
|
||||||
|
expect(this.foo).toEqual(1);
|
||||||
|
expect(bar).toEqual(1);
|
||||||
|
});
|
||||||
|
runs( function () {
|
||||||
|
this.foo++;
|
||||||
|
var bar = 0
|
||||||
|
bar++;
|
||||||
|
|
||||||
|
expect(foo).toEqual(2);
|
||||||
|
expect(bar).toEqual(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
`runs()` blocks exist so you can test asynchronous processes. The function `waits()` works with `runs()` to provide a naive
|
||||||
|
timeout before the next block is run. You supply a time to wait before the next `runs()` function is executed. For example:
|
||||||
|
|
||||||
|
it('should be a test', function () {
|
||||||
|
runs(function () {
|
||||||
|
this.foo = 0;
|
||||||
|
var that = this;
|
||||||
|
setTimeout(function () {
|
||||||
|
that.foo++;
|
||||||
|
}, 250);
|
||||||
|
});
|
||||||
|
|
||||||
|
runs(function () {
|
||||||
|
this.expects(this.foo).toEqual(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
waits(500);
|
||||||
|
|
||||||
|
runs(function () {
|
||||||
|
this.expects(this.foo).toEqual(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
What's happening here?
|
||||||
|
|
||||||
|
* The first call to `runs()` sets call for 1/4 of a second in the future that increments `this.foo`.
|
||||||
|
* The second `runs()` is executed immediately and then verifies that `this.foo` was indeed initialized to zero in the previous `runs()`.
|
||||||
|
* Then we wait for half a second.
|
||||||
|
* Then the last call to `runs()` expects that `this.foo` was incremented by the `setTimeout`.
|
||||||
|
|
||||||
|
|
||||||
|
### Suites
|
||||||
|
|
||||||
|
Specs are grouped in Suites. Suites are defined using the global `describe()` function:
|
||||||
|
|
||||||
|
describe('One suite', function () {
|
||||||
|
it('has a test', function () {
|
||||||
|
...
|
||||||
|
});
|
||||||
|
|
||||||
|
it('has another test', function () {
|
||||||
|
...
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
The Suite name is so that reporting is more descriptive.
|
||||||
|
|
||||||
|
Suites are executed in the order in which `describe()` calls are made, usually in the order in which their script files are included. Additionally, specs within a suite share a functional scope. So you may declare variables inside a describe block and they are accessible from within your specs. For example:
|
||||||
|
|
||||||
|
describe('A suite with some variables', function () {
|
||||||
|
var bar = 0
|
||||||
|
|
||||||
|
it('has a test', function () {
|
||||||
|
bar++;
|
||||||
|
expect(bar).toEqual(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('has another test', function () {
|
||||||
|
bar++;
|
||||||
|
expect(bar).toEqual(2);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
#### beforeEach
|
||||||
|
|
||||||
|
A suite can have a beforeEach declaration. It takes a function that is run before each spec. For example:
|
||||||
|
|
||||||
|
describe('some suite', function () {
|
||||||
|
|
||||||
|
var suiteWideFoo;
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
suiteWideFoo = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
it('should equal bar', function () {
|
||||||
|
expect(suiteWideFoo).toEqual(1);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
#### afterEach
|
||||||
|
|
||||||
|
Similarly, there is an afterEach declaration. It takes a function that is run after each spec. For example:
|
||||||
|
|
||||||
|
describe('some suite', function () {
|
||||||
|
|
||||||
|
var suiteWideFoo;
|
||||||
|
afterEach(function () {
|
||||||
|
suiteWideFoo = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
it('should equal 1', function () {
|
||||||
|
expect(suiteWideFoo).toEqual(1);
|
||||||
|
};
|
||||||
|
|
||||||
|
it('should equal 0 after', function () {
|
||||||
|
expect(suiteWideFoo).toEqual(0);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
### Nested Describes
|
||||||
|
Jasmine supports nested describes. An example:
|
||||||
|
|
||||||
|
describe('some suite', function () {
|
||||||
|
|
||||||
|
var suiteWideFoo;
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
suiteWideFoo = 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('some nested suite', function() {
|
||||||
|
var nestedSuiteBar;
|
||||||
|
beforeEach(function() {
|
||||||
|
nestedSuiteBar=1;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('nested expectation', function () {
|
||||||
|
expect(suiteWideFoo).toEqual(0);
|
||||||
|
expect(nestedSuiteBar).toEqual(1);
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
it('top-level describe', function () {
|
||||||
|
expect(suiteWideFoo).toEqual(0);
|
||||||
|
expect(nestedSuiteBar).toEqual(undefined);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
### Spies
|
||||||
|
|
||||||
|
Jasmine integrates 'spies' that permit many spying, mocking, and faking behaviors.
|
||||||
|
|
||||||
|
Here are a few examples:
|
||||||
|
|
||||||
|
var Klass = function () {
|
||||||
|
}
|
||||||
|
|
||||||
|
var Klass.prototype.method = function (arg) {
|
||||||
|
return arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
var Klass.prototype.methodWithCallback = function (callback) {
|
||||||
|
return callback('foo');
|
||||||
|
}
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
it('should spy on Klass#method') {
|
||||||
|
spyOn(Klass, 'method');
|
||||||
|
Klass.method('foo argument');
|
||||||
|
|
||||||
|
expect(Klass.method).wasCalledWith('foo argument');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should spy on Klass#methodWithCallback') {
|
||||||
|
var callback = Jasmine.createSpy();
|
||||||
|
Klass.method(callback);
|
||||||
|
|
||||||
|
expect(callback).wasCalledWith('foo');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Spies can be very useful for testing AJAX or other asynchronous behaviors that take callbacks by faking the method firing an async call.
|
||||||
|
|
||||||
|
var Klass = function () {
|
||||||
|
};
|
||||||
|
|
||||||
|
var Klass.prototype.asyncMethod = function (callback) {
|
||||||
|
someAsyncCall(callback);
|
||||||
|
};
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
it('should test async call') {
|
||||||
|
spyOn(Klass, 'asyncMethod');
|
||||||
|
var callback = Jasmine.createSpy();
|
||||||
|
|
||||||
|
Klass.asyncMethod(callback);
|
||||||
|
expect(callback).wasNotCalled();
|
||||||
|
|
||||||
|
var someResponseData = 'foo';
|
||||||
|
Klass.asyncMethod.mostRecentCall.args[0](someResponseData);
|
||||||
|
expect(callback).wasCalledWith(someResponseData);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
There are spy-specfic matchers that are very handy.
|
||||||
|
|
||||||
|
`wasCalled()` returns true if the object is a spy and was called
|
||||||
|
|
||||||
|
`wasCalledWith(arguments)` returns true if the object is a spy and was called with the passed arguments
|
||||||
|
|
||||||
|
`wasNotCalled()` returns true if the object is a spy and was not called
|
||||||
|
|
||||||
|
`wasNotCalledWith(arguments)` returns true if the object is a spy and was not called with the passed arguments
|
||||||
|
|
||||||
|
Spies can be trained to respond in a variety of ways when invoked:
|
||||||
|
|
||||||
|
`andCallThrough()`: spies on AND calls the original function spied on
|
||||||
|
|
||||||
|
`andReturn(arguments)`: returns passed arguments when spy is called
|
||||||
|
|
||||||
|
`andThrow(exception)`: throws passed exception when spy is called
|
||||||
|
|
||||||
|
`andCallFake(function)`: calls passed function when spy is called
|
||||||
|
|
||||||
|
Spies have some useful properties:
|
||||||
|
|
||||||
|
`callCount`: returns number of times spy was called
|
||||||
|
|
||||||
|
`mostRecentCall.args`: returns argument array from last call to spy.
|
||||||
|
|
||||||
|
`argsForCall[i]` returns arguments array for call `i` to spy.
|
||||||
|
|
||||||
|
Spies are automatically removed after each spec. They may be set in the beforeEach function.
|
||||||
|
|
||||||
|
### Runner
|
||||||
|
|
||||||
|
You don't need a DOM to run your tests, but you do need a page on which to load & execute your JS. Include the `jasmine.js` file in a script tag as well as the JS file with your specs. You can also use this page for reporting. More on that in a moment.
|
||||||
|
|
||||||
|
Here's the example HTML file (in `jasmine/example`):
|
||||||
|
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Jasmine Example</title>
|
||||||
|
<script type="text/javascript" src="../lib/jasmine.js"></script>
|
||||||
|
<script type="text/javascript" src="example.js"></script>
|
||||||
|
<link type="text/css" rel="stylesheet" href="../lib/jasmine.css"/>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>
|
||||||
|
Running Jasmine Example Specs
|
||||||
|
</h1>
|
||||||
|
<div id="results"></div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
jasmine.execute();
|
||||||
|
setTimeout(function () {
|
||||||
|
document.getElementById('results').innerHTML = 'It\'s alive! :' +
|
||||||
|
(jasmine.currentRunner.results.passedCount === 1);
|
||||||
|
}, 250);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
It's the call to `jasmine.execute()` that runs all of the defined specs, gathering reports of each expectation.
|
||||||
|
|
||||||
|
### Reports
|
||||||
|
|
||||||
|
If a reporter exists on the Jasmine instance (named `jasmine`), it will be called when each spec, suite and the overall runner complete. If you're at the single-spec result level, you'll get a spec description, whether it passed or failed, and what the failure message was. At the suite & runner report level, you'll get the total specs run so far, the passed counts, failed counts, and a description (of the suite or runner).
|
||||||
|
|
||||||
|
There is a `Jasmine.Reporters` namespace for you to see how to handle reporting. See the file `json_reporter.js`, which takes the results objects and turns them into JSON strings, for two examples of how to make the results callbacks work for you.
|
||||||
|
|
||||||
|
|
||||||
|
### Disabling Tests & Suites
|
||||||
|
|
||||||
|
Specs may be disabled by calling `xit()` instead of `it()`. Suites may be disabled by calling `xdescribe()` instead of `describe()`. A simple find/replace in your editor of choice will allow you to run a subset of your specs.
|
||||||
|
|
||||||
|
Contributing and Tests
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
Sometimes it's hard to test a framework with the framework itself. Either the framework isn't mature enough or it just hurts your head. Jasmine is affected by both.
|
||||||
|
|
||||||
|
So we made a little bootstrappy test reporter that lets us test Jasmine's pieces in isolation. See test/bootstrap.js. Feel free to use the bootstrap test suite to test your custom Matchers or extensions/changes to Jasmine.
|
||||||
|
|
||||||
|
Your contributions are welcome. Please submit tests with your pull request.
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
We now have a Google Group for support & discussion.
|
||||||
|
|
||||||
* Search past discussions: [http://groups.google.com/group/jasmine-js](http://groups.google.com/group/jasmine-js)
|
* Homepage: [http://groups.google.com/group/jasmine-js](http://groups.google.com/group/jasmine-js)
|
||||||
* Send an email to the list: [jasmine-js@googlegroups.com](jasmine-js@googlegroups.com)
|
* Group email: [jasmine-js@googlegroups.com](jasmine-js@googlegroups.com)
|
||||||
* View the project backlog at Pivotal Tracker: [http://www.pivotaltracker.com/projects/10606](http://www.pivotaltracker.com/projects/10606)
|
|
||||||
* Follow us on Twitter: [@JasmineBDD](http://twitter.com/JasmineBDD)
|
|
||||||
|
|
||||||
|
|
||||||
## Maintainers
|
## Maintainers
|
||||||
|
|
||||||
* [Davis W. Frank](mailto:dwfrank@pivotallabs.com), Pivotal Labs
|
* [Davis W. Frank](mailto:dwfrank@pivotallabs.com), Pivotal Labs
|
||||||
* [Rajan Agaskar](mailto:rajan@pivotallabs.com), Pivotal Labs
|
* [Rajan Agaskar](mailto:rajan@pivotallabs.com), Pivotal Labs
|
||||||
* [Christian Williams](mailto:antixian666@gmail.com), Square
|
|
||||||
|
|
||||||
Copyright (c) 2008-2012 Pivotal Labs. This software is licensed under the MIT License.
|
## Acknowledgments
|
||||||
|
* A big shout out to the various JavaScript test framework authors, especially TJ for [JSpec](http://github.com/visionmedia/jspec/tree/master) - we played with it a bit before deciding that we really needed to roll our own.
|
||||||
|
* Thanks to Pivot [Jessica Miller](http://www.jessicamillerworks.com/) for our fancy pass/fail/pending icons
|
||||||
|
* Huge contributions have been made by [Christian Williams](mailto:xian@pivotallabs.com) (the master "spy" coder), [Erik Hanson](mailto:erik@pivotallabs.com), [Adam Abrons](mailto:adam@pivotallabs.com) and [Carl Jackson](mailto:carl@pivotallabs.com), and many other Pivots.
|
||||||
|
|
||||||
|
## TODO List
|
||||||
|
|
||||||
|
* Pending & Disabled counts should be included in results
|
||||||
|
|||||||
@@ -1,44 +1,18 @@
|
|||||||
require "bundler"
|
namespace :jeweler do
|
||||||
Bundler::GemHelper.install_tasks
|
|
||||||
require "json"
|
|
||||||
require "tilt"
|
|
||||||
|
|
||||||
Dir["#{File.dirname(__FILE__)}/tasks/**/*.rb"].each do |file|
|
begin
|
||||||
require file
|
require 'jeweler'
|
||||||
end
|
Jeweler::Tasks.new do |gemspec|
|
||||||
|
gemspec.name = "jasmine-ruby"
|
||||||
desc "Run all Jasmine JS specs"
|
gemspec.summary = "Jasmine Ruby"
|
||||||
task :jasmine_specs do
|
gemspec.description = "Javascript BDD testings"
|
||||||
jasmine_dev = JasmineDev.new
|
gemspec.email = "ragaskar@gmail.com"
|
||||||
|
gemspec.homepage = "http://github.com/ragaskar/jasmine-ruby"
|
||||||
return unless jasmine_dev.node_installed?
|
gemspec.description = "Jasmine Ruby"
|
||||||
|
gemspec.authors = ["Rajan Agaskar"]
|
||||||
system "thor jasmine_dev:execute_specs"
|
end
|
||||||
|
Jeweler::GemcutterTasks.new
|
||||||
puts "\n\033[33m>>> DEPRECATED <<< Run Jasmine's JavaScript specs with 'thor jasmine_dev:execute_specs'\n\033[0m"
|
rescue LoadError
|
||||||
end
|
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
||||||
|
|
||||||
desc "Run all Jasmine core tests (JavaScript and dev tasks)"
|
|
||||||
task :spec => :require_pages_submodule do
|
|
||||||
jasmine_dev = JasmineDev.new
|
|
||||||
|
|
||||||
return unless jasmine_dev.node_installed?
|
|
||||||
|
|
||||||
system "rspec"
|
|
||||||
end
|
|
||||||
|
|
||||||
task :require_pages_submodule do
|
|
||||||
jasmine_dev = JasmineDev.new
|
|
||||||
|
|
||||||
unless jasmine_dev.pages_submodule_installed?
|
|
||||||
puts 'Installing the Github pages submodule:'
|
|
||||||
system 'git submodule update --init'
|
|
||||||
puts 'Now continuing...'
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "View full development tasks"
|
|
||||||
task :list_dev_tasks do
|
|
||||||
puts "Jasmine uses Thor for command line tasks for development. Here is the command set:"
|
|
||||||
system "thor list"
|
|
||||||
end
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
# How to work on a Jasmine Release
|
|
||||||
|
|
||||||
## Development
|
|
||||||
___Jasmine Core Maintainers Only___
|
|
||||||
|
|
||||||
Follow the instructions in `Contribute.markdown` during development.
|
|
||||||
|
|
||||||
### Git Rules
|
|
||||||
|
|
||||||
Please work on feature branches.
|
|
||||||
|
|
||||||
Please attempt to keep commits to `master` small, but cohesive. If a feature is contained in a bunch of small commits (e.g., it has several wip commits), please squash them when merging back to `master`.
|
|
||||||
|
|
||||||
### Version
|
|
||||||
|
|
||||||
We attempt to stick to [Semantic Versioning](). Most of the time, development should be against a new minor version - fixing bugs and adding new features that are backwards compatible.
|
|
||||||
|
|
||||||
The current version lives in the file `src/version.json`. This file should be set to the version that is _currently_ under development. That is, if version 1.0.0 is the current release then version should be incremented say, to 1.1.0.
|
|
||||||
|
|
||||||
This version is used by both `jasmine.js` and the `jasmine-core` Ruby gem.
|
|
||||||
|
|
||||||
Note that Jasmine should *not* use the "patch" version number. Let downstream projects rev their patch versions as needed, keeping their major and minor version numbers in sync with Jasmine core.
|
|
||||||
|
|
||||||
### Update the Github Pages (as needed)
|
|
||||||
|
|
||||||
Github pages have to exist in a branch called `gh-pages` in order for their app to serve them. This repo adds that branch as a submodule under the `pages` directory. This is a bit of a hack, but it allows us to work with the pages and the source at the same time and with one set of rake tasks.
|
|
||||||
|
|
||||||
If you want to submit changes to this repo and aren't a Pivotal Labs employee, you can fork and work in the `gh-pages` branch. You won't be able to edit the pages in the submodule off of master.
|
|
||||||
|
|
||||||
The pages are built with [Frank](https://github.com/blahed/frank). All the source for these pages live in the `pages/pages_source` directory.
|
|
||||||
|
|
||||||
## Release
|
|
||||||
|
|
||||||
When ready to release - specs are all green and the stories are done:
|
|
||||||
|
|
||||||
1. Update the version in `version.json` to a release candidate - add a `release_candidate` property with a value of 1
|
|
||||||
1. Update any comments on the public interfaces
|
|
||||||
1. Update any links or top-level landing page for the Github Pages
|
|
||||||
1. `thor jasmine_dev:release_prep` - updates the version, builds the `.js` files, builds the standalone release, and builds the Github pages
|
|
||||||
1. `rake release` - tags the repo with the version, builds the `jasmine-core` gem, pushes the gem to Rubygems.org
|
|
||||||
|
|
||||||
There should be a post to Pivotal Labs blog and a tweet to that link.
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
:minor: 1
|
||||||
|
:patch: 0
|
||||||
|
:major: 0
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
require File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "jasmine-ruby", "jasmine_helper.rb"))
|
||||||
|
|
||||||
|
|
||||||
|
if ARGV[0] == 'server'
|
||||||
|
require 'rubygems'
|
||||||
|
require File.expand_path(File.join(JasmineHelper.jasmine_root, "contrib/ruby/jasmine_spec_builder"))
|
||||||
|
|
||||||
|
puts "your tests are here:"
|
||||||
|
puts " http://localhost:8888/run.html"
|
||||||
|
JASMINE_SPEC_DIR = ARGV[1] || File.join(`pwd`.chomp, "spec")
|
||||||
|
Jasmine::SimpleServer.start(8888,
|
||||||
|
lambda { JasmineHelper.spec_file_urls },
|
||||||
|
JasmineHelper.dir_mappings)
|
||||||
|
end
|
||||||
|
#
|
||||||
|
#namespace :jasmine do
|
||||||
|
# desc "Start jasmine server"
|
||||||
|
# task :server do
|
||||||
|
# start_jasmine_server
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# desc "Run continuous integration tests"
|
||||||
|
# task :ci do
|
||||||
|
# require "spec"
|
||||||
|
# require 'spec/rake/spectask'
|
||||||
|
# ENV["RAILS_ROOT"] = RAILS_ROOT
|
||||||
|
# Spec::Rake::SpecTask.new(:lambda_ci) do |t|
|
||||||
|
# t.spec_opts = ["--color", "--format", "specdoc"]
|
||||||
|
# t.spec_files = [File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "jasmine_spec.rb"))]
|
||||||
|
# end
|
||||||
|
# Rake::Task[:lambda_ci].invoke
|
||||||
|
# end
|
||||||
|
#end
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
#
|
|
||||||
# Compass configuration file - for building Jasmine's 'final CSS files
|
|
||||||
#
|
|
||||||
|
|
||||||
# Require any additional compass plugins here.
|
|
||||||
|
|
||||||
# Set this to the root of your project when deployed:
|
|
||||||
http_path = "/"
|
|
||||||
css_dir = "src/html"
|
|
||||||
sass_dir = "src/html"
|
|
||||||
images_dir = "images"
|
|
||||||
javascripts_dir = "javascripts"
|
|
||||||
|
|
||||||
# You can select your preferred output style here (can be overridden via the command line):
|
|
||||||
# output_style = :expanded or :nested or :compact or :compressed
|
|
||||||
output_style = :compact
|
|
||||||
|
|
||||||
# To enable relative paths to assets via compass helper functions. Uncomment:
|
|
||||||
# relative_assets = true
|
|
||||||
|
|
||||||
# To disable debugging comments that display the original location of your selectors. Uncomment:
|
|
||||||
line_comments = false
|
|
||||||
|
|
||||||
|
|
||||||
# If you prefer the indented syntax, you might want to regenerate this
|
|
||||||
# project again passing --syntax sass, or you can uncomment this:
|
|
||||||
# preferred_syntax = :sass
|
|
||||||
# and then run:
|
|
||||||
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
|
|
||||||
|
Before Width: | Height: | Size: 905 B |
@@ -1,29 +0,0 @@
|
|||||||
# -*- encoding: utf-8 -*-
|
|
||||||
$:.push File.expand_path("../lib", __FILE__)
|
|
||||||
require "jasmine-core/version"
|
|
||||||
|
|
||||||
Gem::Specification.new do |s|
|
|
||||||
s.name = "jasmine-core"
|
|
||||||
s.version = Jasmine::Core::VERSION
|
|
||||||
s.platform = Gem::Platform::RUBY
|
|
||||||
s.authors = ["Rajan Agaskar", "Davis W. Frank", "Christian Williams"]
|
|
||||||
s.summary = %q{JavaScript BDD framework}
|
|
||||||
s.description = %q{Test your JavaScript without any framework dependencies, in any environment, and with a nice descriptive syntax.}
|
|
||||||
s.email = %q{jasmine-js@googlegroups.com}
|
|
||||||
s.homepage = "http://pivotal.github.com/jasmine"
|
|
||||||
s.rubyforge_project = "jasmine-core"
|
|
||||||
s.license = "MIT"
|
|
||||||
|
|
||||||
s.files = Dir.glob("./lib/**/*") + Dir.glob("./lib/jasmine-core/spec/**/*.js")
|
|
||||||
s.require_paths = ["lib"]
|
|
||||||
s.add_development_dependency "json_pure", ">= 1.4.3"
|
|
||||||
s.add_development_dependency "frank"
|
|
||||||
s.add_development_dependency "sass"
|
|
||||||
s.add_development_dependency "compass"
|
|
||||||
s.add_development_dependency "ragaskar-jsdoc_helper"
|
|
||||||
s.add_development_dependency "rspec"
|
|
||||||
s.add_development_dependency "fuubar"
|
|
||||||
s.add_development_dependency "awesome_print"
|
|
||||||
s.add_development_dependency "thor"
|
|
||||||
s.add_development_dependency "nokogiri"
|
|
||||||
end
|
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
# Generated by jeweler
|
||||||
|
# DO NOT EDIT THIS FILE
|
||||||
|
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
|
||||||
|
Gem::Specification.new do |s|
|
||||||
|
s.name = %q{jasmine-ruby}
|
||||||
|
s.version = "0.1.0"
|
||||||
|
|
||||||
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||||
|
s.authors = ["Rajan Agaskar"]
|
||||||
|
s.date = %q{2009-10-10}
|
||||||
|
s.default_executable = %q{jasmine}
|
||||||
|
s.description = %q{Jasmine Ruby}
|
||||||
|
s.email = %q{ragaskar@gmail.com}
|
||||||
|
s.executables = ["jasmine"]
|
||||||
|
s.extra_rdoc_files = [
|
||||||
|
"README.markdown"
|
||||||
|
]
|
||||||
|
s.files = [
|
||||||
|
".gitignore",
|
||||||
|
".idea/encodings.xml",
|
||||||
|
".idea/inspectionProfiles/Project_Default.xml",
|
||||||
|
".idea/inspectionProfiles/profiles_settings.xml",
|
||||||
|
".idea/jasmine-ruby.iml",
|
||||||
|
".idea/misc.xml",
|
||||||
|
".idea/modules.xml",
|
||||||
|
".idea/projectCodeStyle.xml",
|
||||||
|
".idea/vcs.xml",
|
||||||
|
".idea/workspace.xml",
|
||||||
|
"MIT.LICENSE",
|
||||||
|
"README.markdown",
|
||||||
|
"Rakefile",
|
||||||
|
"VERSION.yml",
|
||||||
|
"bin/jasmine",
|
||||||
|
"jasmine-ruby.gemspec",
|
||||||
|
"jasmine/MIT.LICENSE",
|
||||||
|
"jasmine/README.markdown",
|
||||||
|
"jasmine/Rakefile",
|
||||||
|
"jasmine/contrib/ruby/jasmine_runner.rb",
|
||||||
|
"jasmine/contrib/ruby/jasmine_spec_builder.rb",
|
||||||
|
"jasmine/contrib/ruby/run.html",
|
||||||
|
"jasmine/contrib/ruby/spec/jasmine_runner_spec.rb",
|
||||||
|
"jasmine/doc/files.html",
|
||||||
|
"jasmine/doc/index.html",
|
||||||
|
"jasmine/doc/symbols/_global_.html",
|
||||||
|
"jasmine/doc/symbols/jasmine.Block.html",
|
||||||
|
"jasmine/doc/symbols/jasmine.Env.html",
|
||||||
|
"jasmine/doc/symbols/jasmine.JsApiReporter.html",
|
||||||
|
"jasmine/doc/symbols/jasmine.MultiReporter.html",
|
||||||
|
"jasmine/doc/symbols/jasmine.NestedResults.html",
|
||||||
|
"jasmine/doc/symbols/jasmine.Reporter.html",
|
||||||
|
"jasmine/doc/symbols/jasmine.Runner.html",
|
||||||
|
"jasmine/doc/symbols/jasmine.Spec.html",
|
||||||
|
"jasmine/doc/symbols/jasmine.Spy.html",
|
||||||
|
"jasmine/doc/symbols/jasmine.Suite.html",
|
||||||
|
"jasmine/doc/symbols/jasmine.html",
|
||||||
|
"jasmine/doc/symbols/jasmine.util.html",
|
||||||
|
"jasmine/doc/symbols/src/lib_TrivialReporter.js.html",
|
||||||
|
"jasmine/doc/symbols/src/lib_jasmine-0.9.0.js.html",
|
||||||
|
"jasmine/doc/symbols/src/lib_json2.js.html",
|
||||||
|
"jasmine/examples/html/example_suite.html",
|
||||||
|
"jasmine/examples/html/spec/example_suite.js",
|
||||||
|
"jasmine/examples/ruby/Rakefile",
|
||||||
|
"jasmine/examples/ruby/spec/example/example_spec.js",
|
||||||
|
"jasmine/examples/ruby/spec/jasmine_helper.rb",
|
||||||
|
"jasmine/examples/ruby/spec/jasmine_spec.rb",
|
||||||
|
"jasmine/images/fail-16.png",
|
||||||
|
"jasmine/images/fail.png",
|
||||||
|
"jasmine/images/go-16.png",
|
||||||
|
"jasmine/images/go.png",
|
||||||
|
"jasmine/images/pending-16.png",
|
||||||
|
"jasmine/images/pending.png",
|
||||||
|
"jasmine/images/question-bk.png",
|
||||||
|
"jasmine/images/questionbk-16.png",
|
||||||
|
"jasmine/images/spinner.gif",
|
||||||
|
"jasmine/lib/TrivialReporter.js",
|
||||||
|
"jasmine/lib/jasmine-0.9.0.js",
|
||||||
|
"jasmine/lib/jasmine.css",
|
||||||
|
"jasmine/lib/json2.js",
|
||||||
|
"jasmine/spec/jasmine_helper.rb",
|
||||||
|
"jasmine/spec/jasmine_spec.rb",
|
||||||
|
"jasmine/spec/suites/EnvSpec.js",
|
||||||
|
"jasmine/spec/suites/ExceptionsSpec.js",
|
||||||
|
"jasmine/spec/suites/MatchersSpec.js",
|
||||||
|
"jasmine/spec/suites/MultiReporterSpec.js",
|
||||||
|
"jasmine/spec/suites/NestedResultsSpec.js",
|
||||||
|
"jasmine/spec/suites/PrettyPrintSpec.js",
|
||||||
|
"jasmine/spec/suites/ReporterSpec.js",
|
||||||
|
"jasmine/spec/suites/RunnerSpec.js",
|
||||||
|
"jasmine/spec/suites/SpecRunningSpec.js",
|
||||||
|
"jasmine/spec/suites/SpySpec.js",
|
||||||
|
"jasmine/spec/suites/SuiteSpec.js",
|
||||||
|
"jasmine/spec/suites/TrivialReporterSpec.js",
|
||||||
|
"jasmine/src/Block.js",
|
||||||
|
"jasmine/src/Env.js",
|
||||||
|
"jasmine/src/JsApiReporter.js",
|
||||||
|
"jasmine/src/Matchers.js",
|
||||||
|
"jasmine/src/MultiReporter.js",
|
||||||
|
"jasmine/src/NestedResults.js",
|
||||||
|
"jasmine/src/PrettyPrinter.js",
|
||||||
|
"jasmine/src/Queue.js",
|
||||||
|
"jasmine/src/Reporter.js",
|
||||||
|
"jasmine/src/Reporters.js",
|
||||||
|
"jasmine/src/Runner.js",
|
||||||
|
"jasmine/src/Spec.js",
|
||||||
|
"jasmine/src/Suite.js",
|
||||||
|
"jasmine/src/WaitsBlock.js",
|
||||||
|
"jasmine/src/WaitsForBlock.js",
|
||||||
|
"jasmine/src/base.js",
|
||||||
|
"jasmine/src/mock-timeout.js",
|
||||||
|
"jasmine/src/util.js",
|
||||||
|
"jasmine/src/version.json",
|
||||||
|
"lib/jasmine-ruby/jasmine_helper.rb",
|
||||||
|
"spec/jasmine_spec.rb",
|
||||||
|
"tasks/jasmine.rake"
|
||||||
|
]
|
||||||
|
s.homepage = %q{http://github.com/ragaskar/jasmine-ruby}
|
||||||
|
s.rdoc_options = ["--charset=UTF-8"]
|
||||||
|
s.require_paths = ["lib"]
|
||||||
|
s.rubygems_version = %q{1.3.4}
|
||||||
|
s.summary = %q{Jasmine Ruby}
|
||||||
|
s.test_files = [
|
||||||
|
"spec/jasmine_spec.rb"
|
||||||
|
]
|
||||||
|
|
||||||
|
if s.respond_to? :specification_version then
|
||||||
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
||||||
|
s.specification_version = 3
|
||||||
|
|
||||||
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
||||||
|
else
|
||||||
|
end
|
||||||
|
else
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
Copyright (c) 2008 Pivotal Labs
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
@@ -0,0 +1,479 @@
|
|||||||
|
Jasmine
|
||||||
|
=======
|
||||||
|
**YET ANOTHER JavaScript testing framework**
|
||||||
|
|
||||||
|
Quick Start
|
||||||
|
----------
|
||||||
|
|
||||||
|
### Ruby Suite Running
|
||||||
|
|
||||||
|
sudo gem sources -a http://gems.github.com
|
||||||
|
sudo gem install json thin
|
||||||
|
git clone git://github.com/pivotal/jasmine.git
|
||||||
|
cd jasmine/examples/ruby
|
||||||
|
rake jasmine_server
|
||||||
|
|
||||||
|
open `http://localhost:8888/` in your favorite browser.
|
||||||
|
|
||||||
|
### HTML Suite Running
|
||||||
|
|
||||||
|
git clone git://github.com/pivotal/jasmine.git
|
||||||
|
|
||||||
|
open `examples/test/html/example_suite.html` in your favorite browser.
|
||||||
|
|
||||||
|
### Automatic Suite Running (w/ Selenium)
|
||||||
|
|
||||||
|
sudo gem sources -a http://gems.github.com
|
||||||
|
sudo gem install json thin pivotal-selenium-rc selenium-client
|
||||||
|
git clone git://github.com/pivotal/jasmine.git
|
||||||
|
cd jasmine/examples/ruby
|
||||||
|
rake test:ci
|
||||||
|
|
||||||
|
Releases
|
||||||
|
----------
|
||||||
|
0.9.0 beta [[download]](http://github.com/pivotal/jasmine/zipball/master)
|
||||||
|
`git clone git://github.com/pivotal/jasmine.git`
|
||||||
|
|
||||||
|
0.8.0 [[download]](http://github.com/pivotal/jasmine/zipball/0.8.0)
|
||||||
|
|
||||||
|
### Which Release Should I Use?
|
||||||
|
|
||||||
|
Please use the latest version unless you have a good reason not to. Some of this documentation may not be applicable to older versions.
|
||||||
|
|
||||||
|
|
||||||
|
Why Another Frickin' JS TDD/BDD Framework?
|
||||||
|
-----------
|
||||||
|
|
||||||
|
There are some situations when you want to test-drive JavaScript, but you don't want to be bothered with or even have an explicit document. You have no DOM to work with and thus lack HTML elements on which to hang event handlers. You may need to make asynchronous calls (say, to an AJAX API) and cannot mock/stub them.
|
||||||
|
|
||||||
|
But you still need to write tests.
|
||||||
|
|
||||||
|
What's an Agile Engineer to do?
|
||||||
|
|
||||||
|
Enter Jasmine
|
||||||
|
------------
|
||||||
|
|
||||||
|
Jasmine is yet another JavaScript testing framework. It's *heavily* influenced by JSSpec, ScrewUnit & [JSpec](http://github.com/visionmedia/jspec/tree/master), which are all influenced by RSpec. But each of those was lacking in some way: JSSpec & ScrewUnit require a DOM. JSpec's DOM-less assumption was a great start, but it needed asynchronous support.
|
||||||
|
|
||||||
|
So we started over. And TDD'd a whole new framework. Enjoy.
|
||||||
|
|
||||||
|
How To
|
||||||
|
------
|
||||||
|
|
||||||
|
There is a nice example of how to use Jasmine in the /example directory. But here's more information.
|
||||||
|
|
||||||
|
Exciting changes are afoot and many syntax changes have been made to make Jasmine more usable. Please read the examples below for updates.
|
||||||
|
|
||||||
|
### Specs
|
||||||
|
|
||||||
|
Each spec is, naturally, a JavaScript function. You tell Jasmine about this spec with a call to `it()` with a string and the function. The string is a description that will be helpful to you when reading a report.
|
||||||
|
|
||||||
|
it('should be a test', function () {
|
||||||
|
var foo = 0
|
||||||
|
foo++;
|
||||||
|
});
|
||||||
|
|
||||||
|
### Expectations
|
||||||
|
|
||||||
|
Within your spec you will want/need to make expectations. These are made with the `expect()` funciton and expectation matchers. like this:
|
||||||
|
|
||||||
|
it('should be a test', function () {
|
||||||
|
var foo = 0
|
||||||
|
foo++;
|
||||||
|
|
||||||
|
expect(foo).toEqual(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
Results of the expectations are logged for later for reporting.
|
||||||
|
|
||||||
|
#### Expectation Matchers
|
||||||
|
|
||||||
|
Jasmine has several built-in matchers. Here are a few:
|
||||||
|
|
||||||
|
`toEqual()` compares objects or primitives and returns true if they are equal
|
||||||
|
|
||||||
|
`toNotEqual()` compares objects or primitives and returns true if they are not equal
|
||||||
|
|
||||||
|
`toMatch()` takes a regex or a string and returns true if it matches
|
||||||
|
|
||||||
|
`toNotMatch()` takes a regex or a string and returns true if it does not match
|
||||||
|
|
||||||
|
`toBeDefined()` returns true if the object or primitive is not `undefined`
|
||||||
|
|
||||||
|
`toBeNull()` returns true if the object or primitive is not `null`
|
||||||
|
|
||||||
|
`toBeTruthy()` returns true if the object or primitive evaluates to true
|
||||||
|
|
||||||
|
`toBeFalsy()` returns true if the object or primitive evaluates to false
|
||||||
|
|
||||||
|
`toContain()` returns true if an array or string contains the passed variable.
|
||||||
|
|
||||||
|
`toNotContain()` returns true if an array or string does not contain the passed variable.
|
||||||
|
|
||||||
|
#### Writing New Matchers
|
||||||
|
|
||||||
|
A Matcher has a method name, takes an expected value as it's only parameter, has access to the actual value in this, and then makes a call to this.report with true/false with a failure message. Here's the definition of `toEqual()`:
|
||||||
|
|
||||||
|
Jasmine.Matchers.prototype.toEqual = function (expected) {
|
||||||
|
return this.report((this.actual === expected),
|
||||||
|
'Expected ' + expected + ' but got ' + this.actual + '.');
|
||||||
|
});
|
||||||
|
|
||||||
|
Feel free to define your own matcher as needed in your code. If you'd like to add Matchers to Jasmine, please write tests.
|
||||||
|
|
||||||
|
### Asynchronous Specs
|
||||||
|
|
||||||
|
You may be thinking, "That's all well and good, but you mentioned something about asynchronous tests."
|
||||||
|
|
||||||
|
Well, say you need to make a call that is asynchronous - an AJAX API, or some other JavaScript library. That is, the call returns immediately, yet you want to make expectations 'at some point in the future' after some magic happens in the background.
|
||||||
|
|
||||||
|
Jasmine allows you to do this with `runs()` and `waits()` blocks.
|
||||||
|
|
||||||
|
`runs()` blocks by themselves simply run as if they were called directly. The following snippets of code should provide similar results:
|
||||||
|
|
||||||
|
it('should be a test', function () {
|
||||||
|
var foo = 0
|
||||||
|
foo++;
|
||||||
|
|
||||||
|
expect(foo).toEqual(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
and
|
||||||
|
|
||||||
|
it('should be a test', function () {
|
||||||
|
runs( function () {
|
||||||
|
var foo = 0
|
||||||
|
foo++;
|
||||||
|
|
||||||
|
expect(foo).toEqual(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
multiple `runs()` blocks in a spec will run serially. For example,
|
||||||
|
|
||||||
|
it('should be a test', function () {
|
||||||
|
runs( function () {
|
||||||
|
var foo = 0
|
||||||
|
foo++;
|
||||||
|
|
||||||
|
expect(foo).toEqual(1);
|
||||||
|
});
|
||||||
|
runs( function () {
|
||||||
|
var bar = 0
|
||||||
|
bar++;
|
||||||
|
|
||||||
|
expect(bar).toEqual(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
`runs()` blocks share functional scope -- `this` properties will be common to all blocks, but declared `var`'s will not!
|
||||||
|
|
||||||
|
it('should be a test', function () {
|
||||||
|
runs( function () {
|
||||||
|
this.foo = 0
|
||||||
|
this.foo++;
|
||||||
|
var bar = 0;
|
||||||
|
bar++;
|
||||||
|
|
||||||
|
expect(this.foo).toEqual(1);
|
||||||
|
expect(bar).toEqual(1);
|
||||||
|
});
|
||||||
|
runs( function () {
|
||||||
|
this.foo++;
|
||||||
|
var bar = 0
|
||||||
|
bar++;
|
||||||
|
|
||||||
|
expect(foo).toEqual(2);
|
||||||
|
expect(bar).toEqual(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
`runs()` blocks exist so you can test asynchronous processes. The function `waits()` works with `runs()` to provide a naive
|
||||||
|
timeout before the next block is run. You supply a time to wait before the next `runs()` function is executed. For example:
|
||||||
|
|
||||||
|
it('should be a test', function () {
|
||||||
|
runs(function () {
|
||||||
|
this.foo = 0;
|
||||||
|
var that = this;
|
||||||
|
setTimeout(function () {
|
||||||
|
that.foo++;
|
||||||
|
}, 250);
|
||||||
|
});
|
||||||
|
|
||||||
|
runs(function () {
|
||||||
|
this.expects(this.foo).toEqual(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
waits(500);
|
||||||
|
|
||||||
|
runs(function () {
|
||||||
|
this.expects(this.foo).toEqual(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
What's happening here?
|
||||||
|
|
||||||
|
* The first call to `runs()` sets call for 1/4 of a second in the future that increments `this.foo`.
|
||||||
|
* The second `runs()` is executed immediately and then verifies that `this.foo` was indeed initialized to zero in the previous `runs()`.
|
||||||
|
* Then we wait for half a second.
|
||||||
|
* Then the last call to `runs()` expects that `this.foo` was incremented by the `setTimeout`.
|
||||||
|
|
||||||
|
|
||||||
|
### Suites
|
||||||
|
|
||||||
|
Specs are grouped in Suites. Suites are defined using the global `describe()` function:
|
||||||
|
|
||||||
|
describe('One suite', function () {
|
||||||
|
it('has a test', function () {
|
||||||
|
...
|
||||||
|
});
|
||||||
|
|
||||||
|
it('has another test', function () {
|
||||||
|
...
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
The Suite name is so that reporting is more descriptive.
|
||||||
|
|
||||||
|
Suites are executed in the order in which `describe()` calls are made, usually in the order in which their script files are included. Additionally, specs within a suite share a functional scope. So you may declare variables inside a describe block and they are accessible from within your specs. For example:
|
||||||
|
|
||||||
|
describe('A suite with some variables', function () {
|
||||||
|
var bar = 0
|
||||||
|
|
||||||
|
it('has a test', function () {
|
||||||
|
bar++;
|
||||||
|
expect(bar).toEqual(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('has another test', function () {
|
||||||
|
bar++;
|
||||||
|
expect(bar).toEqual(2);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
#### beforeEach
|
||||||
|
|
||||||
|
A suite can have a beforeEach declaration. It takes a function that is run before each spec. For example:
|
||||||
|
|
||||||
|
describe('some suite', function () {
|
||||||
|
|
||||||
|
var suiteWideFoo;
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
suiteWideFoo = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
it('should equal bar', function () {
|
||||||
|
expect(suiteWideFoo).toEqual(1);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
#### afterEach
|
||||||
|
|
||||||
|
Similarly, there is an afterEach declaration. It takes a function that is run after each spec. For example:
|
||||||
|
|
||||||
|
describe('some suite', function () {
|
||||||
|
|
||||||
|
var suiteWideFoo;
|
||||||
|
afterEach(function () {
|
||||||
|
suiteWideFoo = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
it('should equal 1', function () {
|
||||||
|
expect(suiteWideFoo).toEqual(1);
|
||||||
|
};
|
||||||
|
|
||||||
|
it('should equal 0 after', function () {
|
||||||
|
expect(suiteWideFoo).toEqual(0);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
### Nested Describes
|
||||||
|
Jasmine supports nested describes. An example:
|
||||||
|
|
||||||
|
describe('some suite', function () {
|
||||||
|
|
||||||
|
var suiteWideFoo;
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
suiteWideFoo = 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('some nested suite', function() {
|
||||||
|
var nestedSuiteBar;
|
||||||
|
beforeEach(function() {
|
||||||
|
nestedSuiteBar=1;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('nested expectation', function () {
|
||||||
|
expect(suiteWideFoo).toEqual(0);
|
||||||
|
expect(nestedSuiteBar).toEqual(1);
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
it('top-level describe', function () {
|
||||||
|
expect(suiteWideFoo).toEqual(0);
|
||||||
|
expect(nestedSuiteBar).toEqual(undefined);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
### Spies
|
||||||
|
|
||||||
|
Jasmine integrates 'spies' that permit many spying, mocking, and faking behaviors.
|
||||||
|
|
||||||
|
Here are a few examples:
|
||||||
|
|
||||||
|
var Klass = function () {
|
||||||
|
}
|
||||||
|
|
||||||
|
var Klass.prototype.method = function (arg) {
|
||||||
|
return arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
var Klass.prototype.methodWithCallback = function (callback) {
|
||||||
|
return callback('foo');
|
||||||
|
}
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
it('should spy on Klass#method') {
|
||||||
|
spyOn(Klass, 'method');
|
||||||
|
Klass.method('foo argument');
|
||||||
|
|
||||||
|
expect(Klass.method).wasCalledWith('foo argument');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should spy on Klass#methodWithCallback') {
|
||||||
|
var callback = Jasmine.createSpy();
|
||||||
|
Klass.method(callback);
|
||||||
|
|
||||||
|
expect(callback).wasCalledWith('foo');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Spies can be very useful for testing AJAX or other asynchronous behaviors that take callbacks by faking the method firing an async call.
|
||||||
|
|
||||||
|
var Klass = function () {
|
||||||
|
};
|
||||||
|
|
||||||
|
var Klass.prototype.asyncMethod = function (callback) {
|
||||||
|
someAsyncCall(callback);
|
||||||
|
};
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
it('should test async call') {
|
||||||
|
spyOn(Klass, 'asyncMethod');
|
||||||
|
var callback = Jasmine.createSpy();
|
||||||
|
|
||||||
|
Klass.asyncMethod(callback);
|
||||||
|
expect(callback).wasNotCalled();
|
||||||
|
|
||||||
|
var someResponseData = 'foo';
|
||||||
|
Klass.asyncMethod.mostRecentCall.args[0](someResponseData);
|
||||||
|
expect(callback).wasCalledWith(someResponseData);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
There are spy-specfic matchers that are very handy.
|
||||||
|
|
||||||
|
`wasCalled()` returns true if the object is a spy and was called
|
||||||
|
|
||||||
|
`wasCalledWith(arguments)` returns true if the object is a spy and was called with the passed arguments
|
||||||
|
|
||||||
|
`wasNotCalled()` returns true if the object is a spy and was not called
|
||||||
|
|
||||||
|
`wasNotCalledWith(arguments)` returns true if the object is a spy and was not called with the passed arguments
|
||||||
|
|
||||||
|
Spies can be trained to respond in a variety of ways when invoked:
|
||||||
|
|
||||||
|
`andCallThrough()`: spies on AND calls the original function spied on
|
||||||
|
|
||||||
|
`andReturn(arguments)`: returns passed arguments when spy is called
|
||||||
|
|
||||||
|
`andThrow(exception)`: throws passed exception when spy is called
|
||||||
|
|
||||||
|
`andCallFake(function)`: calls passed function when spy is called
|
||||||
|
|
||||||
|
Spies have some useful properties:
|
||||||
|
|
||||||
|
`callCount`: returns number of times spy was called
|
||||||
|
|
||||||
|
`mostRecentCall.args`: returns argument array from last call to spy.
|
||||||
|
|
||||||
|
`argsForCall[i]` returns arguments array for call `i` to spy.
|
||||||
|
|
||||||
|
Spies are automatically removed after each spec. They may be set in the beforeEach function.
|
||||||
|
|
||||||
|
### Runner
|
||||||
|
|
||||||
|
You don't need a DOM to run your tests, but you do need a page on which to load & execute your JS. Include the `jasmine.js` file in a script tag as well as the JS file with your specs. You can also use this page for reporting. More on that in a moment.
|
||||||
|
|
||||||
|
Here's the example HTML file (in `jasmine/example`):
|
||||||
|
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Jasmine Example</title>
|
||||||
|
<script type="text/javascript" src="../lib/jasmine.js"></script>
|
||||||
|
<script type="text/javascript" src="example.js"></script>
|
||||||
|
<link type="text/css" rel="stylesheet" href="../lib/jasmine.css"/>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>
|
||||||
|
Running Jasmine Example Specs
|
||||||
|
</h1>
|
||||||
|
<div id="results"></div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
jasmine.execute();
|
||||||
|
setTimeout(function () {
|
||||||
|
document.getElementById('results').innerHTML = 'It\'s alive! :' +
|
||||||
|
(jasmine.currentRunner.results.passedCount === 1);
|
||||||
|
}, 250);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
It's the call to `jasmine.execute()` that runs all of the defined specs, gathering reports of each expectation.
|
||||||
|
|
||||||
|
### Reports
|
||||||
|
|
||||||
|
If a reporter exists on the Jasmine instance (named `jasmine`), it will be called when each spec, suite and the overall runner complete. If you're at the single-spec result level, you'll get a spec description, whether it passed or failed, and what the failure message was. At the suite & runner report level, you'll get the total specs run so far, the passed counts, failed counts, and a description (of the suite or runner).
|
||||||
|
|
||||||
|
There is a `Jasmine.Reporters` namespace for you to see how to handle reporting. See the file `json_reporter.js`, which takes the results objects and turns them into JSON strings, for two examples of how to make the results callbacks work for you.
|
||||||
|
|
||||||
|
|
||||||
|
### Disabling Tests & Suites
|
||||||
|
|
||||||
|
Specs may be disabled by calling `xit()` instead of `it()`. Suites may be disabled by calling `xdescribe()` instead of `describe()`. A simple find/replace in your editor of choice will allow you to run a subset of your specs.
|
||||||
|
|
||||||
|
Contributing and Tests
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
Sometimes it's hard to test a framework with the framework itself. Either the framework isn't mature enough or it just hurts your head. Jasmine is affected by both.
|
||||||
|
|
||||||
|
So we made a little bootstrappy test reporter that lets us test Jasmine's pieces in isolation. See test/bootstrap.js. Feel free to use the bootstrap test suite to test your custom Matchers or extensions/changes to Jasmine.
|
||||||
|
|
||||||
|
Your contributions are welcome. Please submit tests with your pull request.
|
||||||
|
|
||||||
|
## Support
|
||||||
|
We now have a Google Group for support & discussion.
|
||||||
|
|
||||||
|
* Homepage: [http://groups.google.com/group/jasmine-js](http://groups.google.com/group/jasmine-js)
|
||||||
|
* Group email: [jasmine-js@googlegroups.com](jasmine-js@googlegroups.com)
|
||||||
|
|
||||||
|
## Maintainers
|
||||||
|
|
||||||
|
* [Davis W. Frank](mailto:dwfrank@pivotallabs.com), Pivotal Labs
|
||||||
|
* [Rajan Agaskar](mailto:rajan@pivotallabs.com), Pivotal Labs
|
||||||
|
|
||||||
|
## Acknowledgments
|
||||||
|
* A big shout out to the various JavaScript test framework authors, especially TJ for [JSpec](http://github.com/visionmedia/jspec/tree/master) - we played with it a bit before deciding that we really needed to roll our own.
|
||||||
|
* Thanks to Pivot [Jessica Miller](http://www.jessicamillerworks.com/) for our fancy pass/fail/pending icons
|
||||||
|
* Huge contributions have been made by [Christian Williams](mailto:xian@pivotallabs.com) (the master "spy" coder), [Erik Hanson](mailto:erik@pivotallabs.com), [Adam Abrons](mailto:adam@pivotallabs.com) and [Carl Jackson](mailto:carl@pivotallabs.com), and many other Pivots.
|
||||||
|
|
||||||
|
## TODO List
|
||||||
|
|
||||||
|
* Pending & Disabled counts should be included in results
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
require File.expand_path(File.join(File.dirname(__FILE__), "spec/jasmine_helper.rb"))
|
||||||
|
|
||||||
|
def jasmine_sources
|
||||||
|
sources = ["src/base.js", "src/util.js", "src/Env.js", "src/Reporter.js", "src/Block.js"]
|
||||||
|
sources += Dir.glob('src/*.js').reject{|f| f == 'src/base.js' || sources.include?(f)}.sort
|
||||||
|
end
|
||||||
|
|
||||||
|
def jasmine_filename(version)
|
||||||
|
"jasmine-#{version['major']}.#{version['minor']}.#{version['build']}.js"
|
||||||
|
end
|
||||||
|
|
||||||
|
def version_hash
|
||||||
|
JSON.parse(File.new("src/version.json").read);
|
||||||
|
end
|
||||||
|
|
||||||
|
def start_jasmine_server(jasmine_includes = nil)
|
||||||
|
require File.expand_path(File.join(JasmineHelper.jasmine_root, "contrib/ruby/jasmine_spec_builder"))
|
||||||
|
|
||||||
|
puts "your tests are here:"
|
||||||
|
puts " http://localhost:8888/run.html"
|
||||||
|
|
||||||
|
Jasmine::SimpleServer.start(8888,
|
||||||
|
lambda { JasmineHelper.spec_file_urls },
|
||||||
|
JasmineHelper.dir_mappings,
|
||||||
|
jasmine_includes)
|
||||||
|
end
|
||||||
|
|
||||||
|
namespace :jasmine do
|
||||||
|
desc 'Builds lib/jasmine from source'
|
||||||
|
task :build => 'jasmine:doc' do
|
||||||
|
puts 'Building Jasmine from source'
|
||||||
|
require 'json'
|
||||||
|
sources = jasmine_sources
|
||||||
|
version = version_hash
|
||||||
|
old_jasmine_files = Dir.glob('lib/jasmine*.js')
|
||||||
|
old_jasmine_files.each do |file|
|
||||||
|
File.delete(file)
|
||||||
|
end
|
||||||
|
jasmine = File.new("lib/#{jasmine_filename version}", 'w')
|
||||||
|
jasmine.puts(File.read(sources.shift))
|
||||||
|
jasmine.puts %{
|
||||||
|
jasmine.version_= {
|
||||||
|
"major": #{version['major']},
|
||||||
|
"minor": #{version['minor']},
|
||||||
|
"build": #{version['build']},
|
||||||
|
"revision": #{Time.now.to_i}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
sources.each do |source_filename|
|
||||||
|
jasmine.puts(File.read(source_filename))
|
||||||
|
end
|
||||||
|
jasmine.close
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Build jasmine documentation"
|
||||||
|
task :doc do
|
||||||
|
puts 'Creating Jasmine Documentation'
|
||||||
|
require 'rubygems'
|
||||||
|
#sudo gem install ragaskar-jsdoc_helper
|
||||||
|
require 'jsdoc_helper'
|
||||||
|
|
||||||
|
|
||||||
|
JsdocHelper::Rake::Task.new(:lambda_jsdoc)
|
||||||
|
Rake::Task[:lambda_jsdoc].invoke
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
desc "Run jasmine tests of source via server"
|
||||||
|
task :server do
|
||||||
|
jasmine_includes = lambda { jasmine_sources + ['lib/TrivialReporter.js'] }
|
||||||
|
start_jasmine_server(jasmine_includes)
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Build jasmine and run tests via server"
|
||||||
|
task :server_build => 'jasmine:build' do
|
||||||
|
|
||||||
|
start_jasmine_server
|
||||||
|
end
|
||||||
|
|
||||||
|
namespace :test do
|
||||||
|
desc "Run continuous integration tests"
|
||||||
|
task :ci => 'jasmine:build' do
|
||||||
|
require "spec"
|
||||||
|
require 'spec/rake/spectask'
|
||||||
|
Spec::Rake::SpecTask.new(:lambda_ci) do |t|
|
||||||
|
t.spec_opts = ["--color", "--format", "specdoc"]
|
||||||
|
t.spec_files = ["spec/jasmine_spec.rb"]
|
||||||
|
end
|
||||||
|
Rake::Task[:lambda_ci].invoke
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -0,0 +1,249 @@
|
|||||||
|
require 'socket'
|
||||||
|
require 'erb'
|
||||||
|
require 'json'
|
||||||
|
|
||||||
|
module Jasmine
|
||||||
|
def self.root
|
||||||
|
File.expand_path(File.join(File.dirname(__FILE__), '../..'))
|
||||||
|
end
|
||||||
|
|
||||||
|
# this seemingly-over-complex method is necessary to get an open port on at least some of our Macs
|
||||||
|
def self.open_socket_on_unused_port
|
||||||
|
infos = Socket::getaddrinfo("localhost", nil, Socket::AF_UNSPEC, Socket::SOCK_STREAM, 0, Socket::AI_PASSIVE)
|
||||||
|
families = Hash[*infos.collect { |af, *_| af }.uniq.zip([]).flatten]
|
||||||
|
|
||||||
|
return TCPServer.open('0.0.0.0', 0) if families.has_key?('AF_INET')
|
||||||
|
return TCPServer.open('::', 0) if families.has_key?('AF_INET6')
|
||||||
|
return TCPServer.open(0)
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.find_unused_port
|
||||||
|
socket = open_socket_on_unused_port
|
||||||
|
port = socket.addr[1]
|
||||||
|
socket.close
|
||||||
|
port
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.server_is_listening_on(hostname, port)
|
||||||
|
require 'socket'
|
||||||
|
begin
|
||||||
|
socket = TCPSocket.open(hostname, port)
|
||||||
|
rescue Errno::ECONNREFUSED
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
socket.close
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.wait_for_listener(port, name = "required process", seconds_to_wait = 10)
|
||||||
|
time_out_at = Time.now + seconds_to_wait
|
||||||
|
until server_is_listening_on "localhost", port
|
||||||
|
sleep 0.1
|
||||||
|
puts "Waiting for #{name} on #{port}..."
|
||||||
|
raise "#{name} didn't show up on port #{port} after #{seconds_to_wait} seconds." if Time.now > time_out_at
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.kill_process_group(process_group_id, signal="TERM")
|
||||||
|
Process.kill signal, -process_group_id # negative pid means kill process group. (see man 2 kill)
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.cachebust(files, root_dir="", replace=nil, replace_with=nil)
|
||||||
|
files.collect do |file_name|
|
||||||
|
real_file_name = replace && replace_with ? file_name.sub(replace, replace_with) : file_name
|
||||||
|
begin
|
||||||
|
digest = Digest::MD5.hexdigest(File.read("#{root_dir}#{real_file_name}"))
|
||||||
|
rescue
|
||||||
|
digest = "MISSING-FILE"
|
||||||
|
end
|
||||||
|
"#{file_name}?cachebust=#{digest}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class RunAdapter
|
||||||
|
def initialize(spec_files_or_proc, jasmine_files = nil)
|
||||||
|
@spec_files_or_proc = spec_files_or_proc
|
||||||
|
@jasmine_files = jasmine_files || [
|
||||||
|
"/__JASMINE_ROOT__/lib/" + File.basename(Dir.glob("#{Jasmine.root}/lib/jasmine*.js").first),
|
||||||
|
"/__JASMINE_ROOT__/lib/TrivialReporter.js",
|
||||||
|
"/__JASMINE_ROOT__/lib/json2.js"
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
|
def call(env)
|
||||||
|
spec_files = @spec_files_or_proc
|
||||||
|
spec_files = spec_files.call if spec_files.respond_to?(:call)
|
||||||
|
|
||||||
|
jasmine_files = @jasmine_files
|
||||||
|
jasmine_files = jasmine_files.call if jasmine_files.respond_to?(:call)
|
||||||
|
|
||||||
|
css_files = ["/__JASMINE_ROOT__/lib/jasmine.css"]
|
||||||
|
|
||||||
|
body = ERB.new(File.read(File.join(File.dirname(__FILE__), "run.html"))).result(binding)
|
||||||
|
[
|
||||||
|
200,
|
||||||
|
{ 'Content-Type' => 'text/html' },
|
||||||
|
body
|
||||||
|
]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class Redirect
|
||||||
|
def initialize(url)
|
||||||
|
@url = url
|
||||||
|
end
|
||||||
|
|
||||||
|
def call(env)
|
||||||
|
[
|
||||||
|
302,
|
||||||
|
{ 'Location' => @url },
|
||||||
|
[]
|
||||||
|
]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class JsAlert
|
||||||
|
def call(env)
|
||||||
|
[
|
||||||
|
200,
|
||||||
|
{ 'Content-Type' => 'application/javascript' },
|
||||||
|
"document.write('<p>Couldn\\'t load #{env["PATH_INFO"]}!</p>');"
|
||||||
|
]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class SimpleServer
|
||||||
|
def self.start(port, spec_files_or_proc, mappings, jasmine_files = nil)
|
||||||
|
require 'thin'
|
||||||
|
|
||||||
|
config = {
|
||||||
|
'/run.html' => Jasmine::Redirect.new('/'),
|
||||||
|
'/' => Jasmine::RunAdapter.new(spec_files_or_proc, jasmine_files)
|
||||||
|
}
|
||||||
|
mappings.each do |from, to|
|
||||||
|
config[from] = Rack::File.new(to)
|
||||||
|
end
|
||||||
|
|
||||||
|
config["/__JASMINE_ROOT__"] = Rack::File.new(Jasmine.root)
|
||||||
|
|
||||||
|
app = Rack::Cascade.new([
|
||||||
|
Rack::URLMap.new(config),
|
||||||
|
JsAlert.new
|
||||||
|
])
|
||||||
|
|
||||||
|
Thin::Server.start('0.0.0.0', port, app)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class SimpleClient
|
||||||
|
def initialize(selenium_host, selenium_port, selenium_browser_start_command, http_address)
|
||||||
|
require 'selenium/client'
|
||||||
|
@driver = Selenium::Client::Driver.new(
|
||||||
|
selenium_host,
|
||||||
|
selenium_port,
|
||||||
|
selenium_browser_start_command,
|
||||||
|
http_address
|
||||||
|
)
|
||||||
|
@http_address = http_address
|
||||||
|
end
|
||||||
|
|
||||||
|
def tests_have_finished?
|
||||||
|
@driver.get_eval("window.jasmine.getEnv().currentRunner.finished") == "true"
|
||||||
|
end
|
||||||
|
|
||||||
|
def connect
|
||||||
|
@driver.start
|
||||||
|
@driver.open("/")
|
||||||
|
end
|
||||||
|
|
||||||
|
def disconnect
|
||||||
|
@driver.stop
|
||||||
|
end
|
||||||
|
|
||||||
|
def run
|
||||||
|
until tests_have_finished? do
|
||||||
|
sleep 0.1
|
||||||
|
end
|
||||||
|
|
||||||
|
puts @driver.get_eval("window.getResults()")
|
||||||
|
failed_count = @driver.get_eval("window.jasmine.getEnv().currentRunner.getResults().failedCount").to_i
|
||||||
|
failed_count == 0
|
||||||
|
end
|
||||||
|
|
||||||
|
def eval_js(script)
|
||||||
|
escaped_script = "'" + script.gsub(/(['\\])/) { '\\' + $1 } + "'"
|
||||||
|
|
||||||
|
begin
|
||||||
|
result = @driver.get_eval("window.eval(#{escaped_script})")
|
||||||
|
rescue Selenium::CommandError
|
||||||
|
result = @driver.get_eval("eval(#{escaped_script}, window)")
|
||||||
|
end
|
||||||
|
JSON.parse("[#{result}]")[0]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class Runner
|
||||||
|
def initialize(selenium_jar_path, spec_files, dir_mappings, jasmine_files = nil)
|
||||||
|
@selenium_jar_path = selenium_jar_path
|
||||||
|
@spec_files = spec_files
|
||||||
|
@dir_mappings = dir_mappings
|
||||||
|
@jasmine_files = jasmine_files
|
||||||
|
|
||||||
|
@selenium_pid = nil
|
||||||
|
@jasmine_server_pid = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def start
|
||||||
|
start_servers
|
||||||
|
@client = Jasmine::SimpleClient.new("localhost", @selenium_server_port, "*firefox", "http://localhost:#{@jasmine_server_port}/")
|
||||||
|
@client.connect
|
||||||
|
end
|
||||||
|
|
||||||
|
def stop
|
||||||
|
@client.disconnect
|
||||||
|
stop_servers
|
||||||
|
end
|
||||||
|
|
||||||
|
def start_servers
|
||||||
|
@jasmine_server_port = Jasmine::find_unused_port
|
||||||
|
@selenium_server_port = Jasmine::find_unused_port
|
||||||
|
|
||||||
|
@selenium_pid = fork do
|
||||||
|
Process.setpgrp
|
||||||
|
exec "java -jar #{@selenium_jar_path} -port #{@selenium_server_port} > /dev/null 2>&1"
|
||||||
|
end
|
||||||
|
puts "selenium started. pid is #{@selenium_pid}"
|
||||||
|
|
||||||
|
@jasmine_server_pid = fork do
|
||||||
|
Process.setpgrp
|
||||||
|
Jasmine::SimpleServer.start(@jasmine_server_port, @spec_files, @dir_mappings, @jasmine_files)
|
||||||
|
exit! 0
|
||||||
|
end
|
||||||
|
puts "jasmine server started. pid is #{@jasmine_server_pid}"
|
||||||
|
|
||||||
|
Jasmine::wait_for_listener(@selenium_server_port, "selenium server")
|
||||||
|
Jasmine::wait_for_listener(@jasmine_server_port, "jasmine server")
|
||||||
|
end
|
||||||
|
|
||||||
|
def stop_servers
|
||||||
|
puts "shutting down the servers..."
|
||||||
|
Jasmine::kill_process_group(@selenium_pid) if @selenium_pid
|
||||||
|
Jasmine::kill_process_group(@jasmine_server_pid) if @jasmine_server_pid
|
||||||
|
end
|
||||||
|
|
||||||
|
def run
|
||||||
|
begin
|
||||||
|
start
|
||||||
|
puts "servers are listening on their ports -- running the test script..."
|
||||||
|
tests_passed = @client.run
|
||||||
|
ensure
|
||||||
|
stop
|
||||||
|
end
|
||||||
|
return tests_passed
|
||||||
|
end
|
||||||
|
|
||||||
|
def eval_js(script)
|
||||||
|
@client.eval_js(script)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,146 @@
|
|||||||
|
require File.expand_path(File.join(File.dirname(__FILE__), "jasmine_runner.rb"))
|
||||||
|
|
||||||
|
module Jasmine
|
||||||
|
|
||||||
|
class SpecBuilder
|
||||||
|
attr_accessor :suites
|
||||||
|
|
||||||
|
def initialize(spec_files, runner)
|
||||||
|
@spec_files = spec_files
|
||||||
|
@runner = runner
|
||||||
|
end
|
||||||
|
|
||||||
|
def start
|
||||||
|
guess_example_locations
|
||||||
|
|
||||||
|
@runner.start
|
||||||
|
load_suite_info
|
||||||
|
@spec_results = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
def stop
|
||||||
|
@runner.stop
|
||||||
|
end
|
||||||
|
|
||||||
|
def script_path
|
||||||
|
File.expand_path(__FILE__)
|
||||||
|
end
|
||||||
|
|
||||||
|
def guess_example_locations
|
||||||
|
@example_locations = {}
|
||||||
|
|
||||||
|
example_name_parts = []
|
||||||
|
previous_indent_level = 0
|
||||||
|
@spec_files.each do |filename|
|
||||||
|
line_number = 1
|
||||||
|
File.open(filename, "r") do |file|
|
||||||
|
file.readlines.each do |line|
|
||||||
|
match = /^(\s*)(describe|it)\s*\(\s*["'](.*)["']\s*,\s*function/.match(line)
|
||||||
|
if (match)
|
||||||
|
indent_level = match[1].length / 2
|
||||||
|
example_name = match[3]
|
||||||
|
example_name_parts[indent_level] = example_name
|
||||||
|
|
||||||
|
full_example_name = example_name_parts.slice(0, indent_level + 1).join(" ")
|
||||||
|
@example_locations[full_example_name] = "#{filename}:#{line_number}: in `it'"
|
||||||
|
end
|
||||||
|
line_number += 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def load_suite_info
|
||||||
|
started = Time.now
|
||||||
|
while !eval_js('jsApiReporter && jsApiReporter.started') do
|
||||||
|
raise "couldn't connect to Jasmine after 60 seconds" if (started + 60 < Time.now)
|
||||||
|
sleep 0.1
|
||||||
|
end
|
||||||
|
|
||||||
|
@suites = eval_js('JSON.stringify(jsApiReporter.suites)')
|
||||||
|
end
|
||||||
|
|
||||||
|
def results_for(spec_id)
|
||||||
|
spec_id = spec_id.to_s
|
||||||
|
return @spec_results[spec_id] if @spec_results[spec_id]
|
||||||
|
|
||||||
|
@spec_results[spec_id] = eval_js("JSON.stringify(jsApiReporter.results[#{spec_id}])")
|
||||||
|
while @spec_results[spec_id].nil? do
|
||||||
|
sleep 0.1
|
||||||
|
@spec_results[spec_id] = eval_js("JSON.stringify(jsApiReporter.results[#{spec_id}])")
|
||||||
|
end
|
||||||
|
|
||||||
|
@spec_results[spec_id]
|
||||||
|
end
|
||||||
|
|
||||||
|
def declare_suites
|
||||||
|
me = self
|
||||||
|
suites.each do |suite|
|
||||||
|
declare_suite(self, suite)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def declare_suite(parent, suite)
|
||||||
|
me = self
|
||||||
|
parent.describe suite["name"] do
|
||||||
|
suite["children"].each do |suite_or_spec|
|
||||||
|
type = suite_or_spec["type"]
|
||||||
|
if type == "suite"
|
||||||
|
me.declare_suite(self, suite_or_spec)
|
||||||
|
elsif type == "spec"
|
||||||
|
me.declare_spec(self, suite_or_spec)
|
||||||
|
else
|
||||||
|
raise "unknown type #{type} for #{suite_or_spec.inspect}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def declare_spec(parent, spec)
|
||||||
|
me = self
|
||||||
|
example_name = spec["name"]
|
||||||
|
|
||||||
|
backtrace = @example_locations[parent.description + " " + example_name]
|
||||||
|
parent.it example_name, {}, backtrace do
|
||||||
|
me.report_spec(spec["id"])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def report_spec(spec_id)
|
||||||
|
spec_results = results_for(spec_id)
|
||||||
|
|
||||||
|
out = ""
|
||||||
|
messages = spec_results['messages'].each do |message|
|
||||||
|
case
|
||||||
|
when message["type"] == "MessageResult"
|
||||||
|
puts message["text"]
|
||||||
|
puts "\n"
|
||||||
|
else
|
||||||
|
unless message["message"] =~ /^Passed.$/
|
||||||
|
STDERR << message["message"]
|
||||||
|
STDERR << "\n"
|
||||||
|
|
||||||
|
out << message["message"]
|
||||||
|
out << "\n"
|
||||||
|
end
|
||||||
|
|
||||||
|
unless message["passed_"]
|
||||||
|
stack_trace = message["trace"]["stack"].gsub(/<br \/>/, "\n").gsub(/<\/?b>/, " ")
|
||||||
|
STDERR << stack_trace.gsub(/\(.*\)@http:\/\/localhost:[0-9]+\/specs\//, "/spec/")
|
||||||
|
STDERR << "\n"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
fail out unless spec_results['result'] == 'passed'
|
||||||
|
puts out unless out.empty?
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def eval_js(js)
|
||||||
|
@runner.eval_js(js)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||||
|
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type"/>
|
||||||
|
<title>Jasmine suite</title>
|
||||||
|
<% css_files.each do |css_file| %>
|
||||||
|
<link rel="stylesheet" href="<%= css_file %>" type="text/css" media="screen" />
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% jasmine_files.each do |jasmine_file| %>
|
||||||
|
<script src="<%= jasmine_file %>" type="text/javascript"></script>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var jsApiReporter;
|
||||||
|
(function() {
|
||||||
|
var jasmineEnv = jasmine.getEnv();
|
||||||
|
jasmineEnv.updateInterval = 1000;
|
||||||
|
|
||||||
|
jsApiReporter = new jasmine.JsApiReporter();
|
||||||
|
var trivialReporter = new jasmine.TrivialReporter();
|
||||||
|
|
||||||
|
jasmineEnv.addReporter(jsApiReporter);
|
||||||
|
jasmineEnv.addReporter(trivialReporter);
|
||||||
|
|
||||||
|
jasmineEnv.specFilter = function(spec) {
|
||||||
|
return trivialReporter.specFilter(spec);
|
||||||
|
};
|
||||||
|
|
||||||
|
window.onload = function() {
|
||||||
|
jasmineEnv.execute();
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<% spec_files.each do |spec_file| %>
|
||||||
|
<script src="<%= spec_file %>" type="text/javascript"></script>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="jasmine_content"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
require 'spec'
|
||||||
|
require 'open-uri'
|
||||||
|
require File.dirname(__FILE__) + '/../jasmine_runner'
|
||||||
|
|
||||||
|
describe Jasmine::SimpleServer do
|
||||||
|
before do
|
||||||
|
@port = Jasmine::find_unused_port
|
||||||
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
Jasmine::kill_process_group(@jasmine_server_pid) if @jasmine_server_pid
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should start and print script tags" do
|
||||||
|
@jasmine_server_pid = fork do
|
||||||
|
Process.setpgrp
|
||||||
|
Jasmine::SimpleServer.start(@port, ["file1", "file2"], {})
|
||||||
|
exit! 0
|
||||||
|
end
|
||||||
|
|
||||||
|
Jasmine::wait_for_listener(@port)
|
||||||
|
|
||||||
|
run_html = open("http://localhost:#{@port}/").read
|
||||||
|
run_html.should =~ /<script src="file1"/
|
||||||
|
run_html.should =~ /<script src="file2"/
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should take a proc that returns a list of spec files" do
|
||||||
|
spec_fileses = [["file1", "file2"], ["file1", "file2", "file3"]]
|
||||||
|
spec_files_proc = lambda do
|
||||||
|
spec_fileses.shift
|
||||||
|
end
|
||||||
|
|
||||||
|
@jasmine_server_pid = fork do
|
||||||
|
Process.setpgrp
|
||||||
|
Jasmine::SimpleServer.start(@port, spec_files_proc, {})
|
||||||
|
exit! 0
|
||||||
|
end
|
||||||
|
|
||||||
|
Jasmine::wait_for_listener(@port)
|
||||||
|
|
||||||
|
run_html = open("http://localhost:#{@port}/").read
|
||||||
|
run_html.should =~ /<script src="file1"/
|
||||||
|
run_html.should =~ /<script src="file2"/
|
||||||
|
|
||||||
|
run_html = open("http://localhost:#{@port}/").read
|
||||||
|
run_html.should =~ /<script src="file1"/
|
||||||
|
run_html.should =~ /<script src="file2"/
|
||||||
|
run_html.should =~ /<script src="file3"/
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,264 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8"" />
|
||||||
|
|
||||||
|
<title>JsDoc Reference - File Index</title>
|
||||||
|
<meta name="generator" content="JsDoc Toolkit" />
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
/* default.css */
|
||||||
|
body
|
||||||
|
{
|
||||||
|
font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
|
||||||
|
width: 800px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header
|
||||||
|
{
|
||||||
|
clear: both;
|
||||||
|
background-color: #ccc;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1
|
||||||
|
{
|
||||||
|
font-size: 150%;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 0;
|
||||||
|
margin: 1em 0 0 .3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr
|
||||||
|
{
|
||||||
|
border: none 0;
|
||||||
|
border-top: 1px solid #7F8FB1;
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre.code
|
||||||
|
{
|
||||||
|
display: block;
|
||||||
|
padding: 8px;
|
||||||
|
border: 1px dashed #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#index
|
||||||
|
{
|
||||||
|
margin-top: 24px;
|
||||||
|
float: left;
|
||||||
|
width: 160px;
|
||||||
|
position: absolute;
|
||||||
|
left: 8px;
|
||||||
|
background-color: #F3F3F3;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content
|
||||||
|
{
|
||||||
|
margin-left: 190px;
|
||||||
|
width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList
|
||||||
|
{
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 0 8px;
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
font-size: 1em;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList li
|
||||||
|
{
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 8px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { width: 100%; }
|
||||||
|
|
||||||
|
h1.classTitle
|
||||||
|
{
|
||||||
|
font-size:170%;
|
||||||
|
line-height:130%;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 { font-size: 110%; }
|
||||||
|
caption, div.sectionTitle
|
||||||
|
{
|
||||||
|
background-color: #7F8FB1;
|
||||||
|
color: #fff;
|
||||||
|
font-size:130%;
|
||||||
|
text-align: left;
|
||||||
|
padding: 2px 6px 2px 6px;
|
||||||
|
border: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sectionTitle { margin-bottom: 8px; }
|
||||||
|
.summaryTable thead { display: none; }
|
||||||
|
|
||||||
|
.summaryTable td
|
||||||
|
{
|
||||||
|
vertical-align: top;
|
||||||
|
padding: 4px;
|
||||||
|
border-bottom: 1px #7F8FB1 solid;
|
||||||
|
border-right: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*col#summaryAttributes {}*/
|
||||||
|
.summaryTable td.attributes
|
||||||
|
{
|
||||||
|
border-left: 1px #7F8FB1 solid;
|
||||||
|
width: 140px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.attributes, .fixedFont
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
color: #002EBE;
|
||||||
|
font-family: "Courier New",Courier,monospace;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription
|
||||||
|
{
|
||||||
|
text-align: left;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription, .description
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
padding: 4px;
|
||||||
|
padding-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { margin-bottom: 8px; }
|
||||||
|
|
||||||
|
ul.inheritsList
|
||||||
|
{
|
||||||
|
list-style: square;
|
||||||
|
margin-left: 20px;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detailList {
|
||||||
|
margin-left: 20px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
.detailList dt { margin-left: 20px; }
|
||||||
|
|
||||||
|
.detailList .heading
|
||||||
|
{
|
||||||
|
font-weight: bold;
|
||||||
|
padding-bottom: 6px;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.light, td.attributes, .light a:link, .light a:visited
|
||||||
|
{
|
||||||
|
color: #777;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fineprint
|
||||||
|
{
|
||||||
|
text-align: right;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="header">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="index">
|
||||||
|
<div align="center"><a href="index.html">Class Index</a>
|
||||||
|
| <a href="files.html">File Index</a></div>
|
||||||
|
<hr />
|
||||||
|
<h2>Classes</h2>
|
||||||
|
<ul class="classList">
|
||||||
|
|
||||||
|
<li><i><a href="symbols/_global_.html">_global_</a></i></li>
|
||||||
|
|
||||||
|
<li><a href="symbols/jasmine.html">jasmine</a></li>
|
||||||
|
|
||||||
|
<li><a href="symbols/jasmine.Block.html">jasmine.Block</a></li>
|
||||||
|
|
||||||
|
<li><a href="symbols/jasmine.Env.html">jasmine.Env</a></li>
|
||||||
|
|
||||||
|
<li><a href="symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||||
|
|
||||||
|
<li><a href="symbols/jasmine.Reporter.html">jasmine.Reporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="symbols/jasmine.Runner.html">jasmine.Runner</a></li>
|
||||||
|
|
||||||
|
<li><a href="symbols/jasmine.Spec.html">jasmine.Spec</a></li>
|
||||||
|
|
||||||
|
<li><a href="symbols/jasmine.Spy.html">jasmine.Spy</a></li>
|
||||||
|
|
||||||
|
<li><a href="symbols/jasmine.Suite.html">jasmine.Suite</a></li>
|
||||||
|
|
||||||
|
<li><a href="symbols/jasmine.util.html">jasmine.util</a></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
<h1 class="classTitle">File Index</h1>
|
||||||
|
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h2><a href="symbols/src/lib_jasmine-0.9.0.js.html">lib/jasmine-0.9.0.js</a></h2>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h2><a href="symbols/src/lib_json2.js.html">lib/json2.js</a></h2>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h2><a href="symbols/src/lib_TrivialReporter.js.html">lib/TrivialReporter.js</a></h2>
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,306 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8"" />
|
||||||
|
|
||||||
|
<title>JsDoc Reference - Index</title>
|
||||||
|
<meta name="generator" content="JsDoc Toolkit" />
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
/* default.css */
|
||||||
|
body
|
||||||
|
{
|
||||||
|
font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
|
||||||
|
width: 800px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header
|
||||||
|
{
|
||||||
|
clear: both;
|
||||||
|
background-color: #ccc;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1
|
||||||
|
{
|
||||||
|
font-size: 150%;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 0;
|
||||||
|
margin: 1em 0 0 .3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr
|
||||||
|
{
|
||||||
|
border: none 0;
|
||||||
|
border-top: 1px solid #7F8FB1;
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre.code
|
||||||
|
{
|
||||||
|
display: block;
|
||||||
|
padding: 8px;
|
||||||
|
border: 1px dashed #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#index
|
||||||
|
{
|
||||||
|
margin-top: 24px;
|
||||||
|
float: left;
|
||||||
|
width: 160px;
|
||||||
|
position: absolute;
|
||||||
|
left: 8px;
|
||||||
|
background-color: #F3F3F3;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content
|
||||||
|
{
|
||||||
|
margin-left: 190px;
|
||||||
|
width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList
|
||||||
|
{
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 0 8px;
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
font-size: 1em;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList li
|
||||||
|
{
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 8px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { width: 100%; }
|
||||||
|
|
||||||
|
h1.classTitle
|
||||||
|
{
|
||||||
|
font-size:170%;
|
||||||
|
line-height:130%;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 { font-size: 110%; }
|
||||||
|
caption, div.sectionTitle
|
||||||
|
{
|
||||||
|
background-color: #7F8FB1;
|
||||||
|
color: #fff;
|
||||||
|
font-size:130%;
|
||||||
|
text-align: left;
|
||||||
|
padding: 2px 6px 2px 6px;
|
||||||
|
border: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sectionTitle { margin-bottom: 8px; }
|
||||||
|
.summaryTable thead { display: none; }
|
||||||
|
|
||||||
|
.summaryTable td
|
||||||
|
{
|
||||||
|
vertical-align: top;
|
||||||
|
padding: 4px;
|
||||||
|
border-bottom: 1px #7F8FB1 solid;
|
||||||
|
border-right: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*col#summaryAttributes {}*/
|
||||||
|
.summaryTable td.attributes
|
||||||
|
{
|
||||||
|
border-left: 1px #7F8FB1 solid;
|
||||||
|
width: 140px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.attributes, .fixedFont
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
color: #002EBE;
|
||||||
|
font-family: "Courier New",Courier,monospace;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription
|
||||||
|
{
|
||||||
|
text-align: left;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription, .description
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
padding: 4px;
|
||||||
|
padding-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { margin-bottom: 8px; }
|
||||||
|
|
||||||
|
ul.inheritsList
|
||||||
|
{
|
||||||
|
list-style: square;
|
||||||
|
margin-left: 20px;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detailList {
|
||||||
|
margin-left: 20px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
.detailList dt { margin-left: 20px; }
|
||||||
|
|
||||||
|
.detailList .heading
|
||||||
|
{
|
||||||
|
font-weight: bold;
|
||||||
|
padding-bottom: 6px;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.light, td.attributes, .light a:link, .light a:visited
|
||||||
|
{
|
||||||
|
color: #777;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fineprint
|
||||||
|
{
|
||||||
|
text-align: right;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="header">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="index">
|
||||||
|
<div align="center"><a href="index.html">Class Index</a>
|
||||||
|
| <a href="files.html">File Index</a></div>
|
||||||
|
<hr />
|
||||||
|
<h2>Classes</h2>
|
||||||
|
<ul class="classList">
|
||||||
|
|
||||||
|
<li><i><a href="symbols/_global_.html">_global_</a></i></li>
|
||||||
|
|
||||||
|
<li><a href="symbols/jasmine.html">jasmine</a></li>
|
||||||
|
|
||||||
|
<li><a href="symbols/jasmine.Block.html">jasmine.Block</a></li>
|
||||||
|
|
||||||
|
<li><a href="symbols/jasmine.Env.html">jasmine.Env</a></li>
|
||||||
|
|
||||||
|
<li><a href="symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||||
|
|
||||||
|
<li><a href="symbols/jasmine.Reporter.html">jasmine.Reporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="symbols/jasmine.Runner.html">jasmine.Runner</a></li>
|
||||||
|
|
||||||
|
<li><a href="symbols/jasmine.Spec.html">jasmine.Spec</a></li>
|
||||||
|
|
||||||
|
<li><a href="symbols/jasmine.Spy.html">jasmine.Spy</a></li>
|
||||||
|
|
||||||
|
<li><a href="symbols/jasmine.Suite.html">jasmine.Suite</a></li>
|
||||||
|
|
||||||
|
<li><a href="symbols/jasmine.util.html">jasmine.util</a></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
<h1 class="classTitle">Class Index</h1>
|
||||||
|
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h2><a href="symbols/_global_.html">_global_</a></h2>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h2><a href="symbols/jasmine.html">jasmine</a></h2>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h2><a href="symbols/jasmine.Block.html">jasmine.Block</a></h2>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h2><a href="symbols/jasmine.Env.html">jasmine.Env</a></h2>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h2><a href="symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></h2>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h2><a href="symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></h2>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h2><a href="symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></h2>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h2><a href="symbols/jasmine.Reporter.html">jasmine.Reporter</a></h2>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h2><a href="symbols/jasmine.Runner.html">jasmine.Runner</a></h2>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h2><a href="symbols/jasmine.Spec.html">jasmine.Spec</a></h2>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h2><a href="symbols/jasmine.Spy.html">jasmine.Spy</a></h2>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h2><a href="symbols/jasmine.Suite.html">jasmine.Suite</a></h2>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h2><a href="symbols/jasmine.util.html">jasmine.util</a></h2>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,914 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
|
<meta name="generator" content="JsDoc Toolkit" />
|
||||||
|
|
||||||
|
<title>JsDoc Reference - _global_</title>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
/* default.css */
|
||||||
|
body
|
||||||
|
{
|
||||||
|
font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
|
||||||
|
width: 800px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header
|
||||||
|
{
|
||||||
|
clear: both;
|
||||||
|
background-color: #ccc;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1
|
||||||
|
{
|
||||||
|
font-size: 150%;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 0;
|
||||||
|
margin: 1em 0 0 .3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr
|
||||||
|
{
|
||||||
|
border: none 0;
|
||||||
|
border-top: 1px solid #7F8FB1;
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre.code
|
||||||
|
{
|
||||||
|
display: block;
|
||||||
|
padding: 8px;
|
||||||
|
border: 1px dashed #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#index
|
||||||
|
{
|
||||||
|
margin-top: 24px;
|
||||||
|
float: left;
|
||||||
|
width: 160px;
|
||||||
|
position: absolute;
|
||||||
|
left: 8px;
|
||||||
|
background-color: #F3F3F3;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content
|
||||||
|
{
|
||||||
|
margin-left: 190px;
|
||||||
|
width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList
|
||||||
|
{
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 0 8px;
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
font-size: 1em;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList li
|
||||||
|
{
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 8px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { width: 100%; }
|
||||||
|
|
||||||
|
h1.classTitle
|
||||||
|
{
|
||||||
|
font-size:170%;
|
||||||
|
line-height:130%;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 { font-size: 110%; }
|
||||||
|
caption, div.sectionTitle
|
||||||
|
{
|
||||||
|
background-color: #7F8FB1;
|
||||||
|
color: #fff;
|
||||||
|
font-size:130%;
|
||||||
|
text-align: left;
|
||||||
|
padding: 2px 6px 2px 6px;
|
||||||
|
border: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sectionTitle { margin-bottom: 8px; }
|
||||||
|
.summaryTable thead { display: none; }
|
||||||
|
|
||||||
|
.summaryTable td
|
||||||
|
{
|
||||||
|
vertical-align: top;
|
||||||
|
padding: 4px;
|
||||||
|
border-bottom: 1px #7F8FB1 solid;
|
||||||
|
border-right: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*col#summaryAttributes {}*/
|
||||||
|
.summaryTable td.attributes
|
||||||
|
{
|
||||||
|
border-left: 1px #7F8FB1 solid;
|
||||||
|
width: 140px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.attributes, .fixedFont
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
color: #002EBE;
|
||||||
|
font-family: "Courier New",Courier,monospace;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription
|
||||||
|
{
|
||||||
|
text-align: left;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription, .description
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
padding: 4px;
|
||||||
|
padding-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { margin-bottom: 8px; }
|
||||||
|
|
||||||
|
ul.inheritsList
|
||||||
|
{
|
||||||
|
list-style: square;
|
||||||
|
margin-left: 20px;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detailList {
|
||||||
|
margin-left: 20px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
.detailList dt { margin-left: 20px; }
|
||||||
|
|
||||||
|
.detailList .heading
|
||||||
|
{
|
||||||
|
font-weight: bold;
|
||||||
|
padding-bottom: 6px;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.light, td.attributes, .light a:link, .light a:visited
|
||||||
|
{
|
||||||
|
color: #777;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fineprint
|
||||||
|
{
|
||||||
|
text-align: right;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- ============================== header ================================= -->
|
||||||
|
<!-- begin static/header.html -->
|
||||||
|
<div id="header">
|
||||||
|
</div>
|
||||||
|
<!-- end static/header.html -->
|
||||||
|
|
||||||
|
<!-- ============================== classes index ============================ -->
|
||||||
|
<div id="index">
|
||||||
|
<!-- begin publish.classesIndex -->
|
||||||
|
<div align="center"><a href="../index.html">Class Index</a>
|
||||||
|
| <a href="../files.html">File Index</a></div>
|
||||||
|
<hr />
|
||||||
|
<h2>Classes</h2>
|
||||||
|
<ul class="classList">
|
||||||
|
|
||||||
|
<li><i><a href="../symbols/_global_.html">_global_</a></i></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.html">jasmine</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Block.html">jasmine.Block</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Env.html">jasmine.Env</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Reporter.html">jasmine.Reporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Runner.html">jasmine.Runner</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Spec.html">jasmine.Spec</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Spy.html">jasmine.Spy</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Suite.html">jasmine.Suite</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.util.html">jasmine.util</a></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<hr />
|
||||||
|
<!-- end publish.classesIndex -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
<!-- ============================== class title ============================ -->
|
||||||
|
<h1 class="classTitle">
|
||||||
|
|
||||||
|
Built-In Namespace _global_
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<!-- ============================== class summary ========================== -->
|
||||||
|
<p class="description">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ============================== constructor summary ==================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== properties summary ===================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== methods summary ======================== -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<table class="summaryTable" cellspacing="0" summary="A summary of the methods documented in the class _global_.">
|
||||||
|
<caption>Method Summary</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Method Attributes</th>
|
||||||
|
<th scope="col">Method Name and Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont"><b><a href="../symbols/_global_.html#afterEach">afterEach</a></b>(afterEachFunction)
|
||||||
|
</div>
|
||||||
|
<div class="description">A function that is called after each spec in a suite.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont"><b><a href="../symbols/_global_.html#beforeEach">beforeEach</a></b>(beforeEachFunction)
|
||||||
|
</div>
|
||||||
|
<div class="description">A function that is called before each spec in a suite.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont"><b><a href="../symbols/_global_.html#describe">describe</a></b>(description, specDefinitions)
|
||||||
|
</div>
|
||||||
|
<div class="description">Defines a suite of specifications.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont"><b><a href="../symbols/_global_.html#expect">expect</a></b>(actual)
|
||||||
|
</div>
|
||||||
|
<div class="description">Starts a chain for a Jasmine expectation.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont"><b><a href="../symbols/_global_.html#it">it</a></b>(desc, func)
|
||||||
|
</div>
|
||||||
|
<div class="description">Creates a Jasmine spec that will be added to the current suite.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont"><b><a href="../symbols/_global_.html#runs">runs</a></b>(func)
|
||||||
|
</div>
|
||||||
|
<div class="description">Defines part of a jasmine spec.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont"><b><a href="../symbols/_global_.html#spyOn">spyOn</a></b>(obj, methodName)
|
||||||
|
</div>
|
||||||
|
<div class="description">Function that installs a spy on an existing object's method name.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont"><b><a href="../symbols/_global_.html#waits">waits</a></b>(timeout)
|
||||||
|
</div>
|
||||||
|
<div class="description">Waits for a timeout before moving to the next runs()-defined block.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont"><b><a href="../symbols/_global_.html#waitsFor">waitsFor</a></b>(timeout, latchFunction, message)
|
||||||
|
</div>
|
||||||
|
<div class="description">Waits for the latchFunction to return true before proceeding to the next runs()-defined block.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont"><b><a href="../symbols/_global_.html#xdescribe">xdescribe</a></b>(description, specDefinitions)
|
||||||
|
</div>
|
||||||
|
<div class="description">Disables a suite of specifications.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont"><b><a href="../symbols/_global_.html#xit">xit</a></b>(desc, func)
|
||||||
|
</div>
|
||||||
|
<div class="description">Creates a <em>disabled</em> Jasmine spec.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== events summary ======================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== constructor details ==================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== field details ========================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== method details ========================= -->
|
||||||
|
|
||||||
|
<div class="sectionTitle">
|
||||||
|
Method Detail
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a name="afterEach"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>afterEach</b>(afterEachFunction)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
A function that is called after each spec in a suite.
|
||||||
|
|
||||||
|
Used for restoring any state that is hijacked during spec execution.
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{Function}</span> <b>afterEachFunction</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name="beforeEach"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>beforeEach</b>(beforeEachFunction)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
A function that is called before each spec in a suite.
|
||||||
|
|
||||||
|
Used for spec setup, including validating assumptions.
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{Function}</span> <b>beforeEachFunction</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name="describe"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>describe</b>(description, specDefinitions)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Defines a suite of specifications.
|
||||||
|
|
||||||
|
Stores the description and all defined specs in the Jasmine environment as one suite of specs. Variables declared
|
||||||
|
are accessible by calls to beforeEach, it, and afterEach. Describe blocks can be nested, allowing for specialization
|
||||||
|
of setup in some tests.
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<pre class="code">// TODO: a simple suite
|
||||||
|
|
||||||
|
// TODO: a simple suite with a nested describe block</pre>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{String}</span> <b>description</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd>A string, usually the class under test.</dd>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{Function}</span> <b>specDefinitions</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd>function that defines several specs.</dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name="expect"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>expect</b>(actual)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Starts a chain for a Jasmine expectation.
|
||||||
|
|
||||||
|
It is passed an Object that is the actual value and should chain to one of the many
|
||||||
|
jasmine.Matchers functions.
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{Object}</span> <b>actual</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd>Actual value to test against and expected value</dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name="it"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>it</b>(desc, func)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Creates a Jasmine spec that will be added to the current suite.
|
||||||
|
|
||||||
|
// TODO: pending tests
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<pre class="code">it('should be true', function() {
|
||||||
|
expect(true).toEqual(true);
|
||||||
|
});</pre>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{String}</span> <b>desc</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd>description of this specification</dd>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{Function}</span> <b>func</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd>defines the preconditions and expectations of the spec</dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name="runs"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>runs</b>(func)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Defines part of a jasmine spec. Used in cominbination with waits or waitsFor in asynchrnous specs.
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{Function}</span> <b>func</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd>Function that defines part of a jasmine spec.</dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name="spyOn"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>spyOn</b>(obj, methodName)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Function that installs a spy on an existing object's method name. Used within a Spec to create a spy.
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<pre class="code">// spy example
|
||||||
|
var foo = {
|
||||||
|
not: function(bool) { return !bool; }
|
||||||
|
}
|
||||||
|
spyOn(foo, 'not'); // actual foo.not will not be called, execution stops</pre>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<b>obj</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<b>methodName</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Returns:</dt>
|
||||||
|
|
||||||
|
<dd>a Jasmine spy that can be chained with all spy methods</dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">See:</dt>
|
||||||
|
|
||||||
|
<dd>jasmine.createSpy</dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name="waits"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>waits</b>(timeout)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Waits for a timeout before moving to the next runs()-defined block.
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{Number}</span> <b>timeout</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name="waitsFor"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>waitsFor</b>(timeout, latchFunction, message)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Waits for the latchFunction to return true before proceeding to the next runs()-defined block.
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{Number}</span> <b>timeout</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{Function}</span> <b>latchFunction</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{String}</span> <b>message</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name="xdescribe"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>xdescribe</b>(description, specDefinitions)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Disables a suite of specifications. Used to disable some suites in a file, or files, temporarily during development.
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{String}</span> <b>description</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd>A string, usually the class under test.</dd>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{Function}</span> <b>specDefinitions</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd>function that defines several specs.</dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name="xit"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>xit</b>(desc, func)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Creates a <em>disabled</em> Jasmine spec.
|
||||||
|
|
||||||
|
A convenience method that allows existing specs to be disabled temporarily during development.
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{String}</span> <b>desc</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd>description of this specification</dd>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{Function}</span> <b>func</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd>defines the preconditions and expectations of the spec</dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== event details ========================= -->
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== footer ================================= -->
|
||||||
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,345 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
|
<meta name="generator" content="JsDoc Toolkit" />
|
||||||
|
|
||||||
|
<title>JsDoc Reference - jasmine.Block</title>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
/* default.css */
|
||||||
|
body
|
||||||
|
{
|
||||||
|
font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
|
||||||
|
width: 800px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header
|
||||||
|
{
|
||||||
|
clear: both;
|
||||||
|
background-color: #ccc;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1
|
||||||
|
{
|
||||||
|
font-size: 150%;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 0;
|
||||||
|
margin: 1em 0 0 .3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr
|
||||||
|
{
|
||||||
|
border: none 0;
|
||||||
|
border-top: 1px solid #7F8FB1;
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre.code
|
||||||
|
{
|
||||||
|
display: block;
|
||||||
|
padding: 8px;
|
||||||
|
border: 1px dashed #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#index
|
||||||
|
{
|
||||||
|
margin-top: 24px;
|
||||||
|
float: left;
|
||||||
|
width: 160px;
|
||||||
|
position: absolute;
|
||||||
|
left: 8px;
|
||||||
|
background-color: #F3F3F3;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content
|
||||||
|
{
|
||||||
|
margin-left: 190px;
|
||||||
|
width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList
|
||||||
|
{
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 0 8px;
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
font-size: 1em;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList li
|
||||||
|
{
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 8px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { width: 100%; }
|
||||||
|
|
||||||
|
h1.classTitle
|
||||||
|
{
|
||||||
|
font-size:170%;
|
||||||
|
line-height:130%;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 { font-size: 110%; }
|
||||||
|
caption, div.sectionTitle
|
||||||
|
{
|
||||||
|
background-color: #7F8FB1;
|
||||||
|
color: #fff;
|
||||||
|
font-size:130%;
|
||||||
|
text-align: left;
|
||||||
|
padding: 2px 6px 2px 6px;
|
||||||
|
border: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sectionTitle { margin-bottom: 8px; }
|
||||||
|
.summaryTable thead { display: none; }
|
||||||
|
|
||||||
|
.summaryTable td
|
||||||
|
{
|
||||||
|
vertical-align: top;
|
||||||
|
padding: 4px;
|
||||||
|
border-bottom: 1px #7F8FB1 solid;
|
||||||
|
border-right: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*col#summaryAttributes {}*/
|
||||||
|
.summaryTable td.attributes
|
||||||
|
{
|
||||||
|
border-left: 1px #7F8FB1 solid;
|
||||||
|
width: 140px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.attributes, .fixedFont
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
color: #002EBE;
|
||||||
|
font-family: "Courier New",Courier,monospace;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription
|
||||||
|
{
|
||||||
|
text-align: left;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription, .description
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
padding: 4px;
|
||||||
|
padding-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { margin-bottom: 8px; }
|
||||||
|
|
||||||
|
ul.inheritsList
|
||||||
|
{
|
||||||
|
list-style: square;
|
||||||
|
margin-left: 20px;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detailList {
|
||||||
|
margin-left: 20px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
.detailList dt { margin-left: 20px; }
|
||||||
|
|
||||||
|
.detailList .heading
|
||||||
|
{
|
||||||
|
font-weight: bold;
|
||||||
|
padding-bottom: 6px;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.light, td.attributes, .light a:link, .light a:visited
|
||||||
|
{
|
||||||
|
color: #777;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fineprint
|
||||||
|
{
|
||||||
|
text-align: right;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- ============================== header ================================= -->
|
||||||
|
<!-- begin static/header.html -->
|
||||||
|
<div id="header">
|
||||||
|
</div>
|
||||||
|
<!-- end static/header.html -->
|
||||||
|
|
||||||
|
<!-- ============================== classes index ============================ -->
|
||||||
|
<div id="index">
|
||||||
|
<!-- begin publish.classesIndex -->
|
||||||
|
<div align="center"><a href="../index.html">Class Index</a>
|
||||||
|
| <a href="../files.html">File Index</a></div>
|
||||||
|
<hr />
|
||||||
|
<h2>Classes</h2>
|
||||||
|
<ul class="classList">
|
||||||
|
|
||||||
|
<li><i><a href="../symbols/_global_.html">_global_</a></i></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.html">jasmine</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Block.html">jasmine.Block</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Env.html">jasmine.Env</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Reporter.html">jasmine.Reporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Runner.html">jasmine.Runner</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Spec.html">jasmine.Spec</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Spy.html">jasmine.Spy</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Suite.html">jasmine.Suite</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.util.html">jasmine.util</a></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<hr />
|
||||||
|
<!-- end publish.classesIndex -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
<!-- ============================== class title ============================ -->
|
||||||
|
<h1 class="classTitle">
|
||||||
|
|
||||||
|
Class jasmine.Block
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<!-- ============================== class summary ========================== -->
|
||||||
|
<p class="description">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ============================== constructor summary ==================== -->
|
||||||
|
|
||||||
|
<table class="summaryTable" cellspacing="0" summary="A summary of the constructor documented in the class jasmine.Block.">
|
||||||
|
<caption>Class Summary</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Constructor Attributes</th>
|
||||||
|
<th scope="col">Constructor Name and Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription" >
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b><a href="../symbols/jasmine.Block.html">jasmine.Block</a></b>(env, func, spec)
|
||||||
|
</div>
|
||||||
|
<div class="description">Blocks are functions with executable code that make up a spec.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== properties summary ===================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== methods summary ======================== -->
|
||||||
|
|
||||||
|
<!-- ============================== events summary ======================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== constructor details ==================== -->
|
||||||
|
|
||||||
|
<div class="details"><a name="constructor"> </a>
|
||||||
|
<div class="sectionTitle">
|
||||||
|
Class Detail
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b>jasmine.Block</b>(env, func, spec)
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="description">
|
||||||
|
Blocks are functions with executable code that make up a spec.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{<a href="../symbols/jasmine.Env.html">jasmine.Env</a>}</span> <b>env</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{Function}</span> <b>func</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{<a href="../symbols/jasmine.Spec.html">jasmine.Spec</a>}</span> <b>spec</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== field details ========================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== method details ========================= -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== event details ========================= -->
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== footer ================================= -->
|
||||||
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,390 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
|
<meta name="generator" content="JsDoc Toolkit" />
|
||||||
|
|
||||||
|
<title>JsDoc Reference - jasmine.Env</title>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
/* default.css */
|
||||||
|
body
|
||||||
|
{
|
||||||
|
font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
|
||||||
|
width: 800px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header
|
||||||
|
{
|
||||||
|
clear: both;
|
||||||
|
background-color: #ccc;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1
|
||||||
|
{
|
||||||
|
font-size: 150%;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 0;
|
||||||
|
margin: 1em 0 0 .3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr
|
||||||
|
{
|
||||||
|
border: none 0;
|
||||||
|
border-top: 1px solid #7F8FB1;
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre.code
|
||||||
|
{
|
||||||
|
display: block;
|
||||||
|
padding: 8px;
|
||||||
|
border: 1px dashed #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#index
|
||||||
|
{
|
||||||
|
margin-top: 24px;
|
||||||
|
float: left;
|
||||||
|
width: 160px;
|
||||||
|
position: absolute;
|
||||||
|
left: 8px;
|
||||||
|
background-color: #F3F3F3;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content
|
||||||
|
{
|
||||||
|
margin-left: 190px;
|
||||||
|
width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList
|
||||||
|
{
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 0 8px;
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
font-size: 1em;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList li
|
||||||
|
{
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 8px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { width: 100%; }
|
||||||
|
|
||||||
|
h1.classTitle
|
||||||
|
{
|
||||||
|
font-size:170%;
|
||||||
|
line-height:130%;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 { font-size: 110%; }
|
||||||
|
caption, div.sectionTitle
|
||||||
|
{
|
||||||
|
background-color: #7F8FB1;
|
||||||
|
color: #fff;
|
||||||
|
font-size:130%;
|
||||||
|
text-align: left;
|
||||||
|
padding: 2px 6px 2px 6px;
|
||||||
|
border: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sectionTitle { margin-bottom: 8px; }
|
||||||
|
.summaryTable thead { display: none; }
|
||||||
|
|
||||||
|
.summaryTable td
|
||||||
|
{
|
||||||
|
vertical-align: top;
|
||||||
|
padding: 4px;
|
||||||
|
border-bottom: 1px #7F8FB1 solid;
|
||||||
|
border-right: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*col#summaryAttributes {}*/
|
||||||
|
.summaryTable td.attributes
|
||||||
|
{
|
||||||
|
border-left: 1px #7F8FB1 solid;
|
||||||
|
width: 140px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.attributes, .fixedFont
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
color: #002EBE;
|
||||||
|
font-family: "Courier New",Courier,monospace;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription
|
||||||
|
{
|
||||||
|
text-align: left;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription, .description
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
padding: 4px;
|
||||||
|
padding-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { margin-bottom: 8px; }
|
||||||
|
|
||||||
|
ul.inheritsList
|
||||||
|
{
|
||||||
|
list-style: square;
|
||||||
|
margin-left: 20px;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detailList {
|
||||||
|
margin-left: 20px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
.detailList dt { margin-left: 20px; }
|
||||||
|
|
||||||
|
.detailList .heading
|
||||||
|
{
|
||||||
|
font-weight: bold;
|
||||||
|
padding-bottom: 6px;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.light, td.attributes, .light a:link, .light a:visited
|
||||||
|
{
|
||||||
|
color: #777;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fineprint
|
||||||
|
{
|
||||||
|
text-align: right;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- ============================== header ================================= -->
|
||||||
|
<!-- begin static/header.html -->
|
||||||
|
<div id="header">
|
||||||
|
</div>
|
||||||
|
<!-- end static/header.html -->
|
||||||
|
|
||||||
|
<!-- ============================== classes index ============================ -->
|
||||||
|
<div id="index">
|
||||||
|
<!-- begin publish.classesIndex -->
|
||||||
|
<div align="center"><a href="../index.html">Class Index</a>
|
||||||
|
| <a href="../files.html">File Index</a></div>
|
||||||
|
<hr />
|
||||||
|
<h2>Classes</h2>
|
||||||
|
<ul class="classList">
|
||||||
|
|
||||||
|
<li><i><a href="../symbols/_global_.html">_global_</a></i></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.html">jasmine</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Block.html">jasmine.Block</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Env.html">jasmine.Env</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Reporter.html">jasmine.Reporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Runner.html">jasmine.Runner</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Spec.html">jasmine.Spec</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Spy.html">jasmine.Spy</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Suite.html">jasmine.Suite</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.util.html">jasmine.util</a></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<hr />
|
||||||
|
<!-- end publish.classesIndex -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
<!-- ============================== class title ============================ -->
|
||||||
|
<h1 class="classTitle">
|
||||||
|
|
||||||
|
Class jasmine.Env
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<!-- ============================== class summary ========================== -->
|
||||||
|
<p class="description">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ============================== constructor summary ==================== -->
|
||||||
|
|
||||||
|
<table class="summaryTable" cellspacing="0" summary="A summary of the constructor documented in the class jasmine.Env.">
|
||||||
|
<caption>Class Summary</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Constructor Attributes</th>
|
||||||
|
<th scope="col">Constructor Name and Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription" >
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b><a href="../symbols/jasmine.Env.html">jasmine.Env</a></b>()
|
||||||
|
</div>
|
||||||
|
<div class="description">Environment for Jasmine</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== properties summary ===================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== methods summary ======================== -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<table class="summaryTable" cellspacing="0" summary="A summary of the methods documented in the class jasmine.Env.">
|
||||||
|
<caption>Method Summary</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Method Attributes</th>
|
||||||
|
<th scope="col">Method Name and Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont"><b><a href="../symbols/jasmine.Env.html#addReporter">addReporter</a></b>(reporter)
|
||||||
|
</div>
|
||||||
|
<div class="description">Register a reporter to receive status updates from Jasmine.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== events summary ======================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== constructor details ==================== -->
|
||||||
|
|
||||||
|
<div class="details"><a name="constructor"> </a>
|
||||||
|
<div class="sectionTitle">
|
||||||
|
Class Detail
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b>jasmine.Env</b>()
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="description">
|
||||||
|
Environment for Jasmine
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== field details ========================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== method details ========================= -->
|
||||||
|
|
||||||
|
<div class="sectionTitle">
|
||||||
|
Method Detail
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a name="addReporter"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>addReporter</b>(reporter)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Register a reporter to receive status updates from Jasmine.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{<a href="../symbols/jasmine.Reporter.html">jasmine.Reporter</a>}</span> <b>reporter</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd>An object which will receive status updates.</dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== event details ========================= -->
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== footer ================================= -->
|
||||||
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,322 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
|
<meta name="generator" content="JsDoc Toolkit" />
|
||||||
|
|
||||||
|
<title>JsDoc Reference - jasmine.JsApiReporter</title>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
/* default.css */
|
||||||
|
body
|
||||||
|
{
|
||||||
|
font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
|
||||||
|
width: 800px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header
|
||||||
|
{
|
||||||
|
clear: both;
|
||||||
|
background-color: #ccc;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1
|
||||||
|
{
|
||||||
|
font-size: 150%;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 0;
|
||||||
|
margin: 1em 0 0 .3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr
|
||||||
|
{
|
||||||
|
border: none 0;
|
||||||
|
border-top: 1px solid #7F8FB1;
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre.code
|
||||||
|
{
|
||||||
|
display: block;
|
||||||
|
padding: 8px;
|
||||||
|
border: 1px dashed #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#index
|
||||||
|
{
|
||||||
|
margin-top: 24px;
|
||||||
|
float: left;
|
||||||
|
width: 160px;
|
||||||
|
position: absolute;
|
||||||
|
left: 8px;
|
||||||
|
background-color: #F3F3F3;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content
|
||||||
|
{
|
||||||
|
margin-left: 190px;
|
||||||
|
width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList
|
||||||
|
{
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 0 8px;
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
font-size: 1em;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList li
|
||||||
|
{
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 8px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { width: 100%; }
|
||||||
|
|
||||||
|
h1.classTitle
|
||||||
|
{
|
||||||
|
font-size:170%;
|
||||||
|
line-height:130%;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 { font-size: 110%; }
|
||||||
|
caption, div.sectionTitle
|
||||||
|
{
|
||||||
|
background-color: #7F8FB1;
|
||||||
|
color: #fff;
|
||||||
|
font-size:130%;
|
||||||
|
text-align: left;
|
||||||
|
padding: 2px 6px 2px 6px;
|
||||||
|
border: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sectionTitle { margin-bottom: 8px; }
|
||||||
|
.summaryTable thead { display: none; }
|
||||||
|
|
||||||
|
.summaryTable td
|
||||||
|
{
|
||||||
|
vertical-align: top;
|
||||||
|
padding: 4px;
|
||||||
|
border-bottom: 1px #7F8FB1 solid;
|
||||||
|
border-right: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*col#summaryAttributes {}*/
|
||||||
|
.summaryTable td.attributes
|
||||||
|
{
|
||||||
|
border-left: 1px #7F8FB1 solid;
|
||||||
|
width: 140px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.attributes, .fixedFont
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
color: #002EBE;
|
||||||
|
font-family: "Courier New",Courier,monospace;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription
|
||||||
|
{
|
||||||
|
text-align: left;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription, .description
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
padding: 4px;
|
||||||
|
padding-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { margin-bottom: 8px; }
|
||||||
|
|
||||||
|
ul.inheritsList
|
||||||
|
{
|
||||||
|
list-style: square;
|
||||||
|
margin-left: 20px;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detailList {
|
||||||
|
margin-left: 20px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
.detailList dt { margin-left: 20px; }
|
||||||
|
|
||||||
|
.detailList .heading
|
||||||
|
{
|
||||||
|
font-weight: bold;
|
||||||
|
padding-bottom: 6px;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.light, td.attributes, .light a:link, .light a:visited
|
||||||
|
{
|
||||||
|
color: #777;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fineprint
|
||||||
|
{
|
||||||
|
text-align: right;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- ============================== header ================================= -->
|
||||||
|
<!-- begin static/header.html -->
|
||||||
|
<div id="header">
|
||||||
|
</div>
|
||||||
|
<!-- end static/header.html -->
|
||||||
|
|
||||||
|
<!-- ============================== classes index ============================ -->
|
||||||
|
<div id="index">
|
||||||
|
<!-- begin publish.classesIndex -->
|
||||||
|
<div align="center"><a href="../index.html">Class Index</a>
|
||||||
|
| <a href="../files.html">File Index</a></div>
|
||||||
|
<hr />
|
||||||
|
<h2>Classes</h2>
|
||||||
|
<ul class="classList">
|
||||||
|
|
||||||
|
<li><i><a href="../symbols/_global_.html">_global_</a></i></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.html">jasmine</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Block.html">jasmine.Block</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Env.html">jasmine.Env</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Reporter.html">jasmine.Reporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Runner.html">jasmine.Runner</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Spec.html">jasmine.Spec</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Spy.html">jasmine.Spy</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Suite.html">jasmine.Suite</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.util.html">jasmine.util</a></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<hr />
|
||||||
|
<!-- end publish.classesIndex -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
<!-- ============================== class title ============================ -->
|
||||||
|
<h1 class="classTitle">
|
||||||
|
|
||||||
|
Class jasmine.JsApiReporter
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<!-- ============================== class summary ========================== -->
|
||||||
|
<p class="description">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ============================== constructor summary ==================== -->
|
||||||
|
|
||||||
|
<table class="summaryTable" cellspacing="0" summary="A summary of the constructor documented in the class jasmine.JsApiReporter.">
|
||||||
|
<caption>Class Summary</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Constructor Attributes</th>
|
||||||
|
<th scope="col">Constructor Name and Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription" >
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></b>()
|
||||||
|
</div>
|
||||||
|
<div class="description">JavaScript API reporter.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== properties summary ===================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== methods summary ======================== -->
|
||||||
|
|
||||||
|
<!-- ============================== events summary ======================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== constructor details ==================== -->
|
||||||
|
|
||||||
|
<div class="details"><a name="constructor"> </a>
|
||||||
|
<div class="sectionTitle">
|
||||||
|
Class Detail
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b>jasmine.JsApiReporter</b>()
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="description">
|
||||||
|
JavaScript API reporter.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== field details ========================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== method details ========================= -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== event details ========================= -->
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== footer ================================= -->
|
||||||
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,322 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
|
<meta name="generator" content="JsDoc Toolkit" />
|
||||||
|
|
||||||
|
<title>JsDoc Reference - jasmine.MultiReporter</title>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
/* default.css */
|
||||||
|
body
|
||||||
|
{
|
||||||
|
font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
|
||||||
|
width: 800px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header
|
||||||
|
{
|
||||||
|
clear: both;
|
||||||
|
background-color: #ccc;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1
|
||||||
|
{
|
||||||
|
font-size: 150%;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 0;
|
||||||
|
margin: 1em 0 0 .3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr
|
||||||
|
{
|
||||||
|
border: none 0;
|
||||||
|
border-top: 1px solid #7F8FB1;
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre.code
|
||||||
|
{
|
||||||
|
display: block;
|
||||||
|
padding: 8px;
|
||||||
|
border: 1px dashed #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#index
|
||||||
|
{
|
||||||
|
margin-top: 24px;
|
||||||
|
float: left;
|
||||||
|
width: 160px;
|
||||||
|
position: absolute;
|
||||||
|
left: 8px;
|
||||||
|
background-color: #F3F3F3;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content
|
||||||
|
{
|
||||||
|
margin-left: 190px;
|
||||||
|
width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList
|
||||||
|
{
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 0 8px;
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
font-size: 1em;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList li
|
||||||
|
{
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 8px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { width: 100%; }
|
||||||
|
|
||||||
|
h1.classTitle
|
||||||
|
{
|
||||||
|
font-size:170%;
|
||||||
|
line-height:130%;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 { font-size: 110%; }
|
||||||
|
caption, div.sectionTitle
|
||||||
|
{
|
||||||
|
background-color: #7F8FB1;
|
||||||
|
color: #fff;
|
||||||
|
font-size:130%;
|
||||||
|
text-align: left;
|
||||||
|
padding: 2px 6px 2px 6px;
|
||||||
|
border: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sectionTitle { margin-bottom: 8px; }
|
||||||
|
.summaryTable thead { display: none; }
|
||||||
|
|
||||||
|
.summaryTable td
|
||||||
|
{
|
||||||
|
vertical-align: top;
|
||||||
|
padding: 4px;
|
||||||
|
border-bottom: 1px #7F8FB1 solid;
|
||||||
|
border-right: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*col#summaryAttributes {}*/
|
||||||
|
.summaryTable td.attributes
|
||||||
|
{
|
||||||
|
border-left: 1px #7F8FB1 solid;
|
||||||
|
width: 140px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.attributes, .fixedFont
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
color: #002EBE;
|
||||||
|
font-family: "Courier New",Courier,monospace;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription
|
||||||
|
{
|
||||||
|
text-align: left;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription, .description
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
padding: 4px;
|
||||||
|
padding-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { margin-bottom: 8px; }
|
||||||
|
|
||||||
|
ul.inheritsList
|
||||||
|
{
|
||||||
|
list-style: square;
|
||||||
|
margin-left: 20px;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detailList {
|
||||||
|
margin-left: 20px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
.detailList dt { margin-left: 20px; }
|
||||||
|
|
||||||
|
.detailList .heading
|
||||||
|
{
|
||||||
|
font-weight: bold;
|
||||||
|
padding-bottom: 6px;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.light, td.attributes, .light a:link, .light a:visited
|
||||||
|
{
|
||||||
|
color: #777;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fineprint
|
||||||
|
{
|
||||||
|
text-align: right;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- ============================== header ================================= -->
|
||||||
|
<!-- begin static/header.html -->
|
||||||
|
<div id="header">
|
||||||
|
</div>
|
||||||
|
<!-- end static/header.html -->
|
||||||
|
|
||||||
|
<!-- ============================== classes index ============================ -->
|
||||||
|
<div id="index">
|
||||||
|
<!-- begin publish.classesIndex -->
|
||||||
|
<div align="center"><a href="../index.html">Class Index</a>
|
||||||
|
| <a href="../files.html">File Index</a></div>
|
||||||
|
<hr />
|
||||||
|
<h2>Classes</h2>
|
||||||
|
<ul class="classList">
|
||||||
|
|
||||||
|
<li><i><a href="../symbols/_global_.html">_global_</a></i></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.html">jasmine</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Block.html">jasmine.Block</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Env.html">jasmine.Env</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Reporter.html">jasmine.Reporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Runner.html">jasmine.Runner</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Spec.html">jasmine.Spec</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Spy.html">jasmine.Spy</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Suite.html">jasmine.Suite</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.util.html">jasmine.util</a></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<hr />
|
||||||
|
<!-- end publish.classesIndex -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
<!-- ============================== class title ============================ -->
|
||||||
|
<h1 class="classTitle">
|
||||||
|
|
||||||
|
Class jasmine.MultiReporter
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<!-- ============================== class summary ========================== -->
|
||||||
|
<p class="description">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ============================== constructor summary ==================== -->
|
||||||
|
|
||||||
|
<table class="summaryTable" cellspacing="0" summary="A summary of the constructor documented in the class jasmine.MultiReporter.">
|
||||||
|
<caption>Class Summary</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Constructor Attributes</th>
|
||||||
|
<th scope="col">Constructor Name and Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription" >
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></b>()
|
||||||
|
</div>
|
||||||
|
<div class="description"></div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== properties summary ===================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== methods summary ======================== -->
|
||||||
|
|
||||||
|
<!-- ============================== events summary ======================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== constructor details ==================== -->
|
||||||
|
|
||||||
|
<div class="details"><a name="constructor"> </a>
|
||||||
|
<div class="sectionTitle">
|
||||||
|
Class Detail
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b>jasmine.MultiReporter</b>()
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="description">
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== field details ========================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== method details ========================= -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== event details ========================= -->
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== footer ================================= -->
|
||||||
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,706 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
|
<meta name="generator" content="JsDoc Toolkit" />
|
||||||
|
|
||||||
|
<title>JsDoc Reference - jasmine.NestedResults</title>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
/* default.css */
|
||||||
|
body
|
||||||
|
{
|
||||||
|
font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
|
||||||
|
width: 800px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header
|
||||||
|
{
|
||||||
|
clear: both;
|
||||||
|
background-color: #ccc;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1
|
||||||
|
{
|
||||||
|
font-size: 150%;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 0;
|
||||||
|
margin: 1em 0 0 .3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr
|
||||||
|
{
|
||||||
|
border: none 0;
|
||||||
|
border-top: 1px solid #7F8FB1;
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre.code
|
||||||
|
{
|
||||||
|
display: block;
|
||||||
|
padding: 8px;
|
||||||
|
border: 1px dashed #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#index
|
||||||
|
{
|
||||||
|
margin-top: 24px;
|
||||||
|
float: left;
|
||||||
|
width: 160px;
|
||||||
|
position: absolute;
|
||||||
|
left: 8px;
|
||||||
|
background-color: #F3F3F3;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content
|
||||||
|
{
|
||||||
|
margin-left: 190px;
|
||||||
|
width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList
|
||||||
|
{
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 0 8px;
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
font-size: 1em;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList li
|
||||||
|
{
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 8px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { width: 100%; }
|
||||||
|
|
||||||
|
h1.classTitle
|
||||||
|
{
|
||||||
|
font-size:170%;
|
||||||
|
line-height:130%;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 { font-size: 110%; }
|
||||||
|
caption, div.sectionTitle
|
||||||
|
{
|
||||||
|
background-color: #7F8FB1;
|
||||||
|
color: #fff;
|
||||||
|
font-size:130%;
|
||||||
|
text-align: left;
|
||||||
|
padding: 2px 6px 2px 6px;
|
||||||
|
border: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sectionTitle { margin-bottom: 8px; }
|
||||||
|
.summaryTable thead { display: none; }
|
||||||
|
|
||||||
|
.summaryTable td
|
||||||
|
{
|
||||||
|
vertical-align: top;
|
||||||
|
padding: 4px;
|
||||||
|
border-bottom: 1px #7F8FB1 solid;
|
||||||
|
border-right: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*col#summaryAttributes {}*/
|
||||||
|
.summaryTable td.attributes
|
||||||
|
{
|
||||||
|
border-left: 1px #7F8FB1 solid;
|
||||||
|
width: 140px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.attributes, .fixedFont
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
color: #002EBE;
|
||||||
|
font-family: "Courier New",Courier,monospace;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription
|
||||||
|
{
|
||||||
|
text-align: left;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription, .description
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
padding: 4px;
|
||||||
|
padding-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { margin-bottom: 8px; }
|
||||||
|
|
||||||
|
ul.inheritsList
|
||||||
|
{
|
||||||
|
list-style: square;
|
||||||
|
margin-left: 20px;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detailList {
|
||||||
|
margin-left: 20px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
.detailList dt { margin-left: 20px; }
|
||||||
|
|
||||||
|
.detailList .heading
|
||||||
|
{
|
||||||
|
font-weight: bold;
|
||||||
|
padding-bottom: 6px;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.light, td.attributes, .light a:link, .light a:visited
|
||||||
|
{
|
||||||
|
color: #777;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fineprint
|
||||||
|
{
|
||||||
|
text-align: right;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- ============================== header ================================= -->
|
||||||
|
<!-- begin static/header.html -->
|
||||||
|
<div id="header">
|
||||||
|
</div>
|
||||||
|
<!-- end static/header.html -->
|
||||||
|
|
||||||
|
<!-- ============================== classes index ============================ -->
|
||||||
|
<div id="index">
|
||||||
|
<!-- begin publish.classesIndex -->
|
||||||
|
<div align="center"><a href="../index.html">Class Index</a>
|
||||||
|
| <a href="../files.html">File Index</a></div>
|
||||||
|
<hr />
|
||||||
|
<h2>Classes</h2>
|
||||||
|
<ul class="classList">
|
||||||
|
|
||||||
|
<li><i><a href="../symbols/_global_.html">_global_</a></i></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.html">jasmine</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Block.html">jasmine.Block</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Env.html">jasmine.Env</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Reporter.html">jasmine.Reporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Runner.html">jasmine.Runner</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Spec.html">jasmine.Spec</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Spy.html">jasmine.Spy</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Suite.html">jasmine.Suite</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.util.html">jasmine.util</a></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<hr />
|
||||||
|
<!-- end publish.classesIndex -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
<!-- ============================== class title ============================ -->
|
||||||
|
<h1 class="classTitle">
|
||||||
|
|
||||||
|
Class jasmine.NestedResults
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<!-- ============================== class summary ========================== -->
|
||||||
|
<p class="description">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ============================== constructor summary ==================== -->
|
||||||
|
|
||||||
|
<table class="summaryTable" cellspacing="0" summary="A summary of the constructor documented in the class jasmine.NestedResults.">
|
||||||
|
<caption>Class Summary</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Constructor Attributes</th>
|
||||||
|
<th scope="col">Constructor Name and Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription" >
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></b>()
|
||||||
|
</div>
|
||||||
|
<div class="description">Holds results for a set of Jasmine spec.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== properties summary ===================== -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<table class="summaryTable" cellspacing="0" summary="A summary of the fields documented in the class jasmine.NestedResults.">
|
||||||
|
<caption>Field Summary</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Field Attributes</th>
|
||||||
|
<th scope="col">Field Name and Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b><a href="../symbols/jasmine.NestedResults.html#failedCount">failedCount</a></b>
|
||||||
|
</div>
|
||||||
|
<div class="description">Number of failed results</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b><a href="../symbols/jasmine.NestedResults.html#passedCount">passedCount</a></b>
|
||||||
|
</div>
|
||||||
|
<div class="description">Number of passed results</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b><a href="../symbols/jasmine.NestedResults.html#skipped">skipped</a></b>
|
||||||
|
</div>
|
||||||
|
<div class="description">Was this suite/spec skipped?</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b><a href="../symbols/jasmine.NestedResults.html#totalCount">totalCount</a></b>
|
||||||
|
</div>
|
||||||
|
<div class="description">The total count of results</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== methods summary ======================== -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<table class="summaryTable" cellspacing="0" summary="A summary of the methods documented in the class jasmine.NestedResults.">
|
||||||
|
<caption>Method Summary</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Method Attributes</th>
|
||||||
|
<th scope="col">Method Name and Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont"><b><a href="../symbols/jasmine.NestedResults.html#addResult">addResult</a></b>(result)
|
||||||
|
</div>
|
||||||
|
<div class="description">Adds a result, tracking counts (total, passed, & failed)</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont"><b><a href="../symbols/jasmine.NestedResults.html#getItems">getItems</a></b>()
|
||||||
|
</div>
|
||||||
|
<div class="description">Getter for the results: message & results.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont"><b><a href="../symbols/jasmine.NestedResults.html#log">log</a></b>(message)
|
||||||
|
</div>
|
||||||
|
<div class="description">Tracks a result's message.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont"><b><a href="../symbols/jasmine.NestedResults.html#passed">passed</a></b>()
|
||||||
|
</div>
|
||||||
|
<div class="description"></div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont"><b><a href="../symbols/jasmine.NestedResults.html#rollupCounts">rollupCounts</a></b>(result)
|
||||||
|
</div>
|
||||||
|
<div class="description">Roll up the result counts.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== events summary ======================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== constructor details ==================== -->
|
||||||
|
|
||||||
|
<div class="details"><a name="constructor"> </a>
|
||||||
|
<div class="sectionTitle">
|
||||||
|
Class Detail
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b>jasmine.NestedResults</b>()
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="description">
|
||||||
|
Holds results for a set of Jasmine spec. Allows for the results array to hold another jasmine.NestedResults
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== field details ========================== -->
|
||||||
|
|
||||||
|
<div class="sectionTitle">
|
||||||
|
Field Detail
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a name="failedCount"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>failedCount</b>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Number of failed results
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name="passedCount"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>passedCount</b>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Number of passed results
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name="skipped"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>skipped</b>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Was this suite/spec skipped?
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name="totalCount"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>totalCount</b>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
The total count of results
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== method details ========================= -->
|
||||||
|
|
||||||
|
<div class="sectionTitle">
|
||||||
|
Method Detail
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a name="addResult"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>addResult</b>(result)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Adds a result, tracking counts (total, passed, & failed)
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{jasmine.ExpectationResult|<a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a>}</span> <b>result</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name="getItems"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>getItems</b>()
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Getter for the results: message & results.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name="log"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>log</b>(message)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Tracks a result's message.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<b>message</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name="passed"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
<span class="light">{Boolean}</span>
|
||||||
|
<b>passed</b>()
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Returns:</dt>
|
||||||
|
|
||||||
|
<dd><span class="light fixedFont">{Boolean}</span> True if <b>everything</b> below passed</dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name="rollupCounts"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>rollupCounts</b>(result)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Roll up the result counts.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<b>result</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== event details ========================= -->
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== footer ================================= -->
|
||||||
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,322 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
|
<meta name="generator" content="JsDoc Toolkit" />
|
||||||
|
|
||||||
|
<title>JsDoc Reference - jasmine.Reporter</title>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
/* default.css */
|
||||||
|
body
|
||||||
|
{
|
||||||
|
font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
|
||||||
|
width: 800px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header
|
||||||
|
{
|
||||||
|
clear: both;
|
||||||
|
background-color: #ccc;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1
|
||||||
|
{
|
||||||
|
font-size: 150%;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 0;
|
||||||
|
margin: 1em 0 0 .3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr
|
||||||
|
{
|
||||||
|
border: none 0;
|
||||||
|
border-top: 1px solid #7F8FB1;
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre.code
|
||||||
|
{
|
||||||
|
display: block;
|
||||||
|
padding: 8px;
|
||||||
|
border: 1px dashed #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#index
|
||||||
|
{
|
||||||
|
margin-top: 24px;
|
||||||
|
float: left;
|
||||||
|
width: 160px;
|
||||||
|
position: absolute;
|
||||||
|
left: 8px;
|
||||||
|
background-color: #F3F3F3;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content
|
||||||
|
{
|
||||||
|
margin-left: 190px;
|
||||||
|
width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList
|
||||||
|
{
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 0 8px;
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
font-size: 1em;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList li
|
||||||
|
{
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 8px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { width: 100%; }
|
||||||
|
|
||||||
|
h1.classTitle
|
||||||
|
{
|
||||||
|
font-size:170%;
|
||||||
|
line-height:130%;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 { font-size: 110%; }
|
||||||
|
caption, div.sectionTitle
|
||||||
|
{
|
||||||
|
background-color: #7F8FB1;
|
||||||
|
color: #fff;
|
||||||
|
font-size:130%;
|
||||||
|
text-align: left;
|
||||||
|
padding: 2px 6px 2px 6px;
|
||||||
|
border: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sectionTitle { margin-bottom: 8px; }
|
||||||
|
.summaryTable thead { display: none; }
|
||||||
|
|
||||||
|
.summaryTable td
|
||||||
|
{
|
||||||
|
vertical-align: top;
|
||||||
|
padding: 4px;
|
||||||
|
border-bottom: 1px #7F8FB1 solid;
|
||||||
|
border-right: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*col#summaryAttributes {}*/
|
||||||
|
.summaryTable td.attributes
|
||||||
|
{
|
||||||
|
border-left: 1px #7F8FB1 solid;
|
||||||
|
width: 140px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.attributes, .fixedFont
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
color: #002EBE;
|
||||||
|
font-family: "Courier New",Courier,monospace;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription
|
||||||
|
{
|
||||||
|
text-align: left;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription, .description
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
padding: 4px;
|
||||||
|
padding-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { margin-bottom: 8px; }
|
||||||
|
|
||||||
|
ul.inheritsList
|
||||||
|
{
|
||||||
|
list-style: square;
|
||||||
|
margin-left: 20px;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detailList {
|
||||||
|
margin-left: 20px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
.detailList dt { margin-left: 20px; }
|
||||||
|
|
||||||
|
.detailList .heading
|
||||||
|
{
|
||||||
|
font-weight: bold;
|
||||||
|
padding-bottom: 6px;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.light, td.attributes, .light a:link, .light a:visited
|
||||||
|
{
|
||||||
|
color: #777;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fineprint
|
||||||
|
{
|
||||||
|
text-align: right;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- ============================== header ================================= -->
|
||||||
|
<!-- begin static/header.html -->
|
||||||
|
<div id="header">
|
||||||
|
</div>
|
||||||
|
<!-- end static/header.html -->
|
||||||
|
|
||||||
|
<!-- ============================== classes index ============================ -->
|
||||||
|
<div id="index">
|
||||||
|
<!-- begin publish.classesIndex -->
|
||||||
|
<div align="center"><a href="../index.html">Class Index</a>
|
||||||
|
| <a href="../files.html">File Index</a></div>
|
||||||
|
<hr />
|
||||||
|
<h2>Classes</h2>
|
||||||
|
<ul class="classList">
|
||||||
|
|
||||||
|
<li><i><a href="../symbols/_global_.html">_global_</a></i></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.html">jasmine</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Block.html">jasmine.Block</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Env.html">jasmine.Env</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Reporter.html">jasmine.Reporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Runner.html">jasmine.Runner</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Spec.html">jasmine.Spec</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Spy.html">jasmine.Spy</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Suite.html">jasmine.Suite</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.util.html">jasmine.util</a></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<hr />
|
||||||
|
<!-- end publish.classesIndex -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
<!-- ============================== class title ============================ -->
|
||||||
|
<h1 class="classTitle">
|
||||||
|
|
||||||
|
Class jasmine.Reporter
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<!-- ============================== class summary ========================== -->
|
||||||
|
<p class="description">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ============================== constructor summary ==================== -->
|
||||||
|
|
||||||
|
<table class="summaryTable" cellspacing="0" summary="A summary of the constructor documented in the class jasmine.Reporter.">
|
||||||
|
<caption>Class Summary</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Constructor Attributes</th>
|
||||||
|
<th scope="col">Constructor Name and Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription" >
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b><a href="../symbols/jasmine.Reporter.html">jasmine.Reporter</a></b>()
|
||||||
|
</div>
|
||||||
|
<div class="description">No-op base class for Jasmine reporters.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== properties summary ===================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== methods summary ======================== -->
|
||||||
|
|
||||||
|
<!-- ============================== events summary ======================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== constructor details ==================== -->
|
||||||
|
|
||||||
|
<div class="details"><a name="constructor"> </a>
|
||||||
|
<div class="sectionTitle">
|
||||||
|
Class Detail
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b>jasmine.Reporter</b>()
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="description">
|
||||||
|
No-op base class for Jasmine reporters.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== field details ========================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== method details ========================= -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== event details ========================= -->
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== footer ================================= -->
|
||||||
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,390 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
|
<meta name="generator" content="JsDoc Toolkit" />
|
||||||
|
|
||||||
|
<title>JsDoc Reference - jasmine.Runner</title>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
/* default.css */
|
||||||
|
body
|
||||||
|
{
|
||||||
|
font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
|
||||||
|
width: 800px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header
|
||||||
|
{
|
||||||
|
clear: both;
|
||||||
|
background-color: #ccc;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1
|
||||||
|
{
|
||||||
|
font-size: 150%;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 0;
|
||||||
|
margin: 1em 0 0 .3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr
|
||||||
|
{
|
||||||
|
border: none 0;
|
||||||
|
border-top: 1px solid #7F8FB1;
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre.code
|
||||||
|
{
|
||||||
|
display: block;
|
||||||
|
padding: 8px;
|
||||||
|
border: 1px dashed #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#index
|
||||||
|
{
|
||||||
|
margin-top: 24px;
|
||||||
|
float: left;
|
||||||
|
width: 160px;
|
||||||
|
position: absolute;
|
||||||
|
left: 8px;
|
||||||
|
background-color: #F3F3F3;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content
|
||||||
|
{
|
||||||
|
margin-left: 190px;
|
||||||
|
width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList
|
||||||
|
{
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 0 8px;
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
font-size: 1em;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList li
|
||||||
|
{
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 8px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { width: 100%; }
|
||||||
|
|
||||||
|
h1.classTitle
|
||||||
|
{
|
||||||
|
font-size:170%;
|
||||||
|
line-height:130%;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 { font-size: 110%; }
|
||||||
|
caption, div.sectionTitle
|
||||||
|
{
|
||||||
|
background-color: #7F8FB1;
|
||||||
|
color: #fff;
|
||||||
|
font-size:130%;
|
||||||
|
text-align: left;
|
||||||
|
padding: 2px 6px 2px 6px;
|
||||||
|
border: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sectionTitle { margin-bottom: 8px; }
|
||||||
|
.summaryTable thead { display: none; }
|
||||||
|
|
||||||
|
.summaryTable td
|
||||||
|
{
|
||||||
|
vertical-align: top;
|
||||||
|
padding: 4px;
|
||||||
|
border-bottom: 1px #7F8FB1 solid;
|
||||||
|
border-right: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*col#summaryAttributes {}*/
|
||||||
|
.summaryTable td.attributes
|
||||||
|
{
|
||||||
|
border-left: 1px #7F8FB1 solid;
|
||||||
|
width: 140px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.attributes, .fixedFont
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
color: #002EBE;
|
||||||
|
font-family: "Courier New",Courier,monospace;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription
|
||||||
|
{
|
||||||
|
text-align: left;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription, .description
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
padding: 4px;
|
||||||
|
padding-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { margin-bottom: 8px; }
|
||||||
|
|
||||||
|
ul.inheritsList
|
||||||
|
{
|
||||||
|
list-style: square;
|
||||||
|
margin-left: 20px;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detailList {
|
||||||
|
margin-left: 20px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
.detailList dt { margin-left: 20px; }
|
||||||
|
|
||||||
|
.detailList .heading
|
||||||
|
{
|
||||||
|
font-weight: bold;
|
||||||
|
padding-bottom: 6px;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.light, td.attributes, .light a:link, .light a:visited
|
||||||
|
{
|
||||||
|
color: #777;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fineprint
|
||||||
|
{
|
||||||
|
text-align: right;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- ============================== header ================================= -->
|
||||||
|
<!-- begin static/header.html -->
|
||||||
|
<div id="header">
|
||||||
|
</div>
|
||||||
|
<!-- end static/header.html -->
|
||||||
|
|
||||||
|
<!-- ============================== classes index ============================ -->
|
||||||
|
<div id="index">
|
||||||
|
<!-- begin publish.classesIndex -->
|
||||||
|
<div align="center"><a href="../index.html">Class Index</a>
|
||||||
|
| <a href="../files.html">File Index</a></div>
|
||||||
|
<hr />
|
||||||
|
<h2>Classes</h2>
|
||||||
|
<ul class="classList">
|
||||||
|
|
||||||
|
<li><i><a href="../symbols/_global_.html">_global_</a></i></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.html">jasmine</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Block.html">jasmine.Block</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Env.html">jasmine.Env</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Reporter.html">jasmine.Reporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Runner.html">jasmine.Runner</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Spec.html">jasmine.Spec</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Spy.html">jasmine.Spy</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Suite.html">jasmine.Suite</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.util.html">jasmine.util</a></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<hr />
|
||||||
|
<!-- end publish.classesIndex -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
<!-- ============================== class title ============================ -->
|
||||||
|
<h1 class="classTitle">
|
||||||
|
|
||||||
|
Class jasmine.Runner
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<!-- ============================== class summary ========================== -->
|
||||||
|
<p class="description">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ============================== constructor summary ==================== -->
|
||||||
|
|
||||||
|
<table class="summaryTable" cellspacing="0" summary="A summary of the constructor documented in the class jasmine.Runner.">
|
||||||
|
<caption>Class Summary</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Constructor Attributes</th>
|
||||||
|
<th scope="col">Constructor Name and Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription" >
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b><a href="../symbols/jasmine.Runner.html">jasmine.Runner</a></b>(env)
|
||||||
|
</div>
|
||||||
|
<div class="description">Runner</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== properties summary ===================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== methods summary ======================== -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<table class="summaryTable" cellspacing="0" summary="A summary of the methods documented in the class jasmine.Runner.">
|
||||||
|
<caption>Method Summary</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Method Attributes</th>
|
||||||
|
<th scope="col">Method Name and Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont"><b><a href="../symbols/jasmine.Runner.html#getAllSuites">getAllSuites</a></b>()
|
||||||
|
</div>
|
||||||
|
<div class="description"></div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== events summary ======================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== constructor details ==================== -->
|
||||||
|
|
||||||
|
<div class="details"><a name="constructor"> </a>
|
||||||
|
<div class="sectionTitle">
|
||||||
|
Class Detail
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b>jasmine.Runner</b>(env)
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="description">
|
||||||
|
Runner
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{<a href="../symbols/jasmine.Env.html">jasmine.Env</a>}</span> <b>env</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== field details ========================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== method details ========================= -->
|
||||||
|
|
||||||
|
<div class="sectionTitle">
|
||||||
|
Method Detail
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a name="getAllSuites"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>getAllSuites</b>()
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== event details ========================= -->
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== footer ================================= -->
|
||||||
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,345 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
|
<meta name="generator" content="JsDoc Toolkit" />
|
||||||
|
|
||||||
|
<title>JsDoc Reference - jasmine.Spec</title>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
/* default.css */
|
||||||
|
body
|
||||||
|
{
|
||||||
|
font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
|
||||||
|
width: 800px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header
|
||||||
|
{
|
||||||
|
clear: both;
|
||||||
|
background-color: #ccc;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1
|
||||||
|
{
|
||||||
|
font-size: 150%;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 0;
|
||||||
|
margin: 1em 0 0 .3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr
|
||||||
|
{
|
||||||
|
border: none 0;
|
||||||
|
border-top: 1px solid #7F8FB1;
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre.code
|
||||||
|
{
|
||||||
|
display: block;
|
||||||
|
padding: 8px;
|
||||||
|
border: 1px dashed #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#index
|
||||||
|
{
|
||||||
|
margin-top: 24px;
|
||||||
|
float: left;
|
||||||
|
width: 160px;
|
||||||
|
position: absolute;
|
||||||
|
left: 8px;
|
||||||
|
background-color: #F3F3F3;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content
|
||||||
|
{
|
||||||
|
margin-left: 190px;
|
||||||
|
width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList
|
||||||
|
{
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 0 8px;
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
font-size: 1em;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList li
|
||||||
|
{
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 8px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { width: 100%; }
|
||||||
|
|
||||||
|
h1.classTitle
|
||||||
|
{
|
||||||
|
font-size:170%;
|
||||||
|
line-height:130%;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 { font-size: 110%; }
|
||||||
|
caption, div.sectionTitle
|
||||||
|
{
|
||||||
|
background-color: #7F8FB1;
|
||||||
|
color: #fff;
|
||||||
|
font-size:130%;
|
||||||
|
text-align: left;
|
||||||
|
padding: 2px 6px 2px 6px;
|
||||||
|
border: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sectionTitle { margin-bottom: 8px; }
|
||||||
|
.summaryTable thead { display: none; }
|
||||||
|
|
||||||
|
.summaryTable td
|
||||||
|
{
|
||||||
|
vertical-align: top;
|
||||||
|
padding: 4px;
|
||||||
|
border-bottom: 1px #7F8FB1 solid;
|
||||||
|
border-right: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*col#summaryAttributes {}*/
|
||||||
|
.summaryTable td.attributes
|
||||||
|
{
|
||||||
|
border-left: 1px #7F8FB1 solid;
|
||||||
|
width: 140px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.attributes, .fixedFont
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
color: #002EBE;
|
||||||
|
font-family: "Courier New",Courier,monospace;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription
|
||||||
|
{
|
||||||
|
text-align: left;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription, .description
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
padding: 4px;
|
||||||
|
padding-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { margin-bottom: 8px; }
|
||||||
|
|
||||||
|
ul.inheritsList
|
||||||
|
{
|
||||||
|
list-style: square;
|
||||||
|
margin-left: 20px;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detailList {
|
||||||
|
margin-left: 20px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
.detailList dt { margin-left: 20px; }
|
||||||
|
|
||||||
|
.detailList .heading
|
||||||
|
{
|
||||||
|
font-weight: bold;
|
||||||
|
padding-bottom: 6px;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.light, td.attributes, .light a:link, .light a:visited
|
||||||
|
{
|
||||||
|
color: #777;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fineprint
|
||||||
|
{
|
||||||
|
text-align: right;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- ============================== header ================================= -->
|
||||||
|
<!-- begin static/header.html -->
|
||||||
|
<div id="header">
|
||||||
|
</div>
|
||||||
|
<!-- end static/header.html -->
|
||||||
|
|
||||||
|
<!-- ============================== classes index ============================ -->
|
||||||
|
<div id="index">
|
||||||
|
<!-- begin publish.classesIndex -->
|
||||||
|
<div align="center"><a href="../index.html">Class Index</a>
|
||||||
|
| <a href="../files.html">File Index</a></div>
|
||||||
|
<hr />
|
||||||
|
<h2>Classes</h2>
|
||||||
|
<ul class="classList">
|
||||||
|
|
||||||
|
<li><i><a href="../symbols/_global_.html">_global_</a></i></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.html">jasmine</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Block.html">jasmine.Block</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Env.html">jasmine.Env</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Reporter.html">jasmine.Reporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Runner.html">jasmine.Runner</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Spec.html">jasmine.Spec</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Spy.html">jasmine.Spy</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Suite.html">jasmine.Suite</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.util.html">jasmine.util</a></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<hr />
|
||||||
|
<!-- end publish.classesIndex -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
<!-- ============================== class title ============================ -->
|
||||||
|
<h1 class="classTitle">
|
||||||
|
|
||||||
|
Class jasmine.Spec
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<!-- ============================== class summary ========================== -->
|
||||||
|
<p class="description">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ============================== constructor summary ==================== -->
|
||||||
|
|
||||||
|
<table class="summaryTable" cellspacing="0" summary="A summary of the constructor documented in the class jasmine.Spec.">
|
||||||
|
<caption>Class Summary</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Constructor Attributes</th>
|
||||||
|
<th scope="col">Constructor Name and Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription" >
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b><a href="../symbols/jasmine.Spec.html">jasmine.Spec</a></b>(env, suite, description)
|
||||||
|
</div>
|
||||||
|
<div class="description">Internal representation of a Jasmine specification, or test.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== properties summary ===================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== methods summary ======================== -->
|
||||||
|
|
||||||
|
<!-- ============================== events summary ======================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== constructor details ==================== -->
|
||||||
|
|
||||||
|
<div class="details"><a name="constructor"> </a>
|
||||||
|
<div class="sectionTitle">
|
||||||
|
Class Detail
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b>jasmine.Spec</b>(env, suite, description)
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="description">
|
||||||
|
Internal representation of a Jasmine specification, or test.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{<a href="../symbols/jasmine.Env.html">jasmine.Env</a>}</span> <b>env</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{<a href="../symbols/jasmine.Suite.html">jasmine.Suite</a>}</span> <b>suite</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{String}</span> <b>description</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== field details ========================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== method details ========================= -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== event details ========================= -->
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== footer ================================= -->
|
||||||
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,851 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
|
<meta name="generator" content="JsDoc Toolkit" />
|
||||||
|
|
||||||
|
<title>JsDoc Reference - jasmine.Spy</title>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
/* default.css */
|
||||||
|
body
|
||||||
|
{
|
||||||
|
font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
|
||||||
|
width: 800px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header
|
||||||
|
{
|
||||||
|
clear: both;
|
||||||
|
background-color: #ccc;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1
|
||||||
|
{
|
||||||
|
font-size: 150%;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 0;
|
||||||
|
margin: 1em 0 0 .3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr
|
||||||
|
{
|
||||||
|
border: none 0;
|
||||||
|
border-top: 1px solid #7F8FB1;
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre.code
|
||||||
|
{
|
||||||
|
display: block;
|
||||||
|
padding: 8px;
|
||||||
|
border: 1px dashed #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#index
|
||||||
|
{
|
||||||
|
margin-top: 24px;
|
||||||
|
float: left;
|
||||||
|
width: 160px;
|
||||||
|
position: absolute;
|
||||||
|
left: 8px;
|
||||||
|
background-color: #F3F3F3;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content
|
||||||
|
{
|
||||||
|
margin-left: 190px;
|
||||||
|
width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList
|
||||||
|
{
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 0 8px;
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
font-size: 1em;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList li
|
||||||
|
{
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 8px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { width: 100%; }
|
||||||
|
|
||||||
|
h1.classTitle
|
||||||
|
{
|
||||||
|
font-size:170%;
|
||||||
|
line-height:130%;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 { font-size: 110%; }
|
||||||
|
caption, div.sectionTitle
|
||||||
|
{
|
||||||
|
background-color: #7F8FB1;
|
||||||
|
color: #fff;
|
||||||
|
font-size:130%;
|
||||||
|
text-align: left;
|
||||||
|
padding: 2px 6px 2px 6px;
|
||||||
|
border: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sectionTitle { margin-bottom: 8px; }
|
||||||
|
.summaryTable thead { display: none; }
|
||||||
|
|
||||||
|
.summaryTable td
|
||||||
|
{
|
||||||
|
vertical-align: top;
|
||||||
|
padding: 4px;
|
||||||
|
border-bottom: 1px #7F8FB1 solid;
|
||||||
|
border-right: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*col#summaryAttributes {}*/
|
||||||
|
.summaryTable td.attributes
|
||||||
|
{
|
||||||
|
border-left: 1px #7F8FB1 solid;
|
||||||
|
width: 140px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.attributes, .fixedFont
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
color: #002EBE;
|
||||||
|
font-family: "Courier New",Courier,monospace;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription
|
||||||
|
{
|
||||||
|
text-align: left;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription, .description
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
padding: 4px;
|
||||||
|
padding-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { margin-bottom: 8px; }
|
||||||
|
|
||||||
|
ul.inheritsList
|
||||||
|
{
|
||||||
|
list-style: square;
|
||||||
|
margin-left: 20px;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detailList {
|
||||||
|
margin-left: 20px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
.detailList dt { margin-left: 20px; }
|
||||||
|
|
||||||
|
.detailList .heading
|
||||||
|
{
|
||||||
|
font-weight: bold;
|
||||||
|
padding-bottom: 6px;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.light, td.attributes, .light a:link, .light a:visited
|
||||||
|
{
|
||||||
|
color: #777;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fineprint
|
||||||
|
{
|
||||||
|
text-align: right;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- ============================== header ================================= -->
|
||||||
|
<!-- begin static/header.html -->
|
||||||
|
<div id="header">
|
||||||
|
</div>
|
||||||
|
<!-- end static/header.html -->
|
||||||
|
|
||||||
|
<!-- ============================== classes index ============================ -->
|
||||||
|
<div id="index">
|
||||||
|
<!-- begin publish.classesIndex -->
|
||||||
|
<div align="center"><a href="../index.html">Class Index</a>
|
||||||
|
| <a href="../files.html">File Index</a></div>
|
||||||
|
<hr />
|
||||||
|
<h2>Classes</h2>
|
||||||
|
<ul class="classList">
|
||||||
|
|
||||||
|
<li><i><a href="../symbols/_global_.html">_global_</a></i></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.html">jasmine</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Block.html">jasmine.Block</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Env.html">jasmine.Env</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Reporter.html">jasmine.Reporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Runner.html">jasmine.Runner</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Spec.html">jasmine.Spec</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Spy.html">jasmine.Spy</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Suite.html">jasmine.Suite</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.util.html">jasmine.util</a></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<hr />
|
||||||
|
<!-- end publish.classesIndex -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
<!-- ============================== class title ============================ -->
|
||||||
|
<h1 class="classTitle">
|
||||||
|
|
||||||
|
Class jasmine.Spy
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<!-- ============================== class summary ========================== -->
|
||||||
|
<p class="description">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ============================== constructor summary ==================== -->
|
||||||
|
|
||||||
|
<table class="summaryTable" cellspacing="0" summary="A summary of the constructor documented in the class jasmine.Spy.">
|
||||||
|
<caption>Class Summary</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Constructor Attributes</th>
|
||||||
|
<th scope="col">Constructor Name and Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription" >
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b><a href="../symbols/jasmine.Spy.html">jasmine.Spy</a></b>(name)
|
||||||
|
</div>
|
||||||
|
<div class="description">Jasmine Spies are test doubles that can act as stubs, spies, fakes or when used in an expecation, mocks.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== properties summary ===================== -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<table class="summaryTable" cellspacing="0" summary="A summary of the fields documented in the class jasmine.Spy.">
|
||||||
|
<caption>Field Summary</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Field Attributes</th>
|
||||||
|
<th scope="col">Field Name and Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b><a href="../symbols/jasmine.Spy.html#argsForCall">argsForCall</a></b>
|
||||||
|
</div>
|
||||||
|
<div class="description">Holds arguments for each call to the spy, indexed by call count</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b><a href="../symbols/jasmine.Spy.html#identity">identity</a></b>
|
||||||
|
</div>
|
||||||
|
<div class="description">The name of the spy, if provided.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b><a href="../symbols/jasmine.Spy.html#isSpy">isSpy</a></b>
|
||||||
|
</div>
|
||||||
|
<div class="description">Is this Object a spy?</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b><a href="../symbols/jasmine.Spy.html#mostRecentCall">mostRecentCall</a></b>
|
||||||
|
</div>
|
||||||
|
<div class="description">Tracking of the most recent call to the spy.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== methods summary ======================== -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<table class="summaryTable" cellspacing="0" summary="A summary of the methods documented in the class jasmine.Spy.">
|
||||||
|
<caption>Method Summary</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Method Attributes</th>
|
||||||
|
<th scope="col">Method Name and Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont"><b><a href="../symbols/jasmine.Spy.html#andCallFake">andCallFake</a></b>(fakeFunc)
|
||||||
|
</div>
|
||||||
|
<div class="description">Calls an alternate implementation when a spy is called.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont"><b><a href="../symbols/jasmine.Spy.html#andCallThrough">andCallThrough</a></b>()
|
||||||
|
</div>
|
||||||
|
<div class="description">Tells a spy to call through to the actual implemenatation.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont"><b><a href="../symbols/jasmine.Spy.html#andReturn">andReturn</a></b>(value)
|
||||||
|
</div>
|
||||||
|
<div class="description">For setting the return value of a spy.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont"><b><a href="../symbols/jasmine.Spy.html#andThrow">andThrow</a></b>(exceptionMsg)
|
||||||
|
</div>
|
||||||
|
<div class="description">For throwing an exception when a spy is called.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont"><b><a href="../symbols/jasmine.Spy.html#plan">plan</a></b>()
|
||||||
|
</div>
|
||||||
|
<div class="description">The acutal function this spy stubs.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont"><b><a href="../symbols/jasmine.Spy.html#reset">reset</a></b>()
|
||||||
|
</div>
|
||||||
|
<div class="description">Resets all of a spy's the tracking variables so that it can be used again.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== events summary ======================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== constructor details ==================== -->
|
||||||
|
|
||||||
|
<div class="details"><a name="constructor"> </a>
|
||||||
|
<div class="sectionTitle">
|
||||||
|
Class Detail
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b>jasmine.Spy</b>(name)
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="description">
|
||||||
|
Jasmine Spies are test doubles that can act as stubs, spies, fakes or when used in an expecation, mocks.
|
||||||
|
|
||||||
|
Spies should be created in test setup, before expectations. They can then be checked, using the standard Jasmine
|
||||||
|
expectation syntax. Spies can be checked if they were called or not and what the calling params were.
|
||||||
|
|
||||||
|
A Spy has the following mehtod: wasCalled, callCount, mostRecentCall, and argsForCall (see docs)
|
||||||
|
Spies are torn down at the end of every spec.
|
||||||
|
|
||||||
|
Note: Do <b>not</b> call new jasmine.Spy() directly - a spy must be created using spyOn, jasmine.createSpy or jasmine.createSpyObj.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<pre class="code">// a stub
|
||||||
|
var myStub = jasmine.createSpy('myStub'); // can be used anywhere
|
||||||
|
|
||||||
|
// spy example
|
||||||
|
var foo = {
|
||||||
|
not: function(bool) { return !bool; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// actual foo.not will not be called, execution stops
|
||||||
|
spyOn(foo, 'not');
|
||||||
|
|
||||||
|
// foo.not spied upon, execution will continue to implementation
|
||||||
|
spyOn(foo, 'not').andCallThrough();
|
||||||
|
|
||||||
|
// fake example
|
||||||
|
var foo = {
|
||||||
|
not: function(bool) { return !bool; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// foo.not(val) will return val
|
||||||
|
spyOn(foo, 'not').andCallFake(function(value) {return value;});
|
||||||
|
|
||||||
|
// mock example
|
||||||
|
foo.not(7 == 7);
|
||||||
|
expect(foo.not).wasCalled();
|
||||||
|
expect(foo.not).wasCalledWith(true);</pre>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{String}</span> <b>name</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">See:</dt>
|
||||||
|
|
||||||
|
<dd><a href="../symbols/_global_.html#spyOn">spyOn</a>, jasmine.createSpy, jasmine.createSpyObj</dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== field details ========================== -->
|
||||||
|
|
||||||
|
<div class="sectionTitle">
|
||||||
|
Field Detail
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a name="argsForCall"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>argsForCall</b>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Holds arguments for each call to the spy, indexed by call count
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<pre class="code">var mySpy = jasmine.createSpy('foo');
|
||||||
|
mySpy(1, 2);
|
||||||
|
mySpy(7, 8);
|
||||||
|
mySpy.mostRecentCall.args = [7, 8];
|
||||||
|
mySpy.argsForCall[0] = [1, 2];
|
||||||
|
mySpy.argsForCall[1] = [7, 8];</pre>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name="identity"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>identity</b>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
The name of the spy, if provided.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name="isSpy"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>isSpy</b>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Is this Object a spy?
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name="mostRecentCall"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>mostRecentCall</b>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Tracking of the most recent call to the spy.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<pre class="code">var mySpy = jasmine.createSpy('foo');
|
||||||
|
mySpy(1, 2);
|
||||||
|
mySpy.mostRecentCall.args = [1, 2];</pre>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== method details ========================= -->
|
||||||
|
|
||||||
|
<div class="sectionTitle">
|
||||||
|
Method Detail
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a name="andCallFake"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>andCallFake</b>(fakeFunc)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Calls an alternate implementation when a spy is called.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<pre class="code">var baz = function() {
|
||||||
|
// do some stuff, return something
|
||||||
|
}
|
||||||
|
// defining a spy from scratch: foo() calls the function baz
|
||||||
|
var foo = jasmine.createSpy('spy on foo').andCall(baz);
|
||||||
|
|
||||||
|
// defining a spy on an existing property: foo.bar() calls an anonymnous function
|
||||||
|
spyOn(foo, 'bar').andCall(function() { return 'baz';} );</pre>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{Function}</span> <b>fakeFunc</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name="andCallThrough"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>andCallThrough</b>()
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Tells a spy to call through to the actual implemenatation.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<pre class="code">var foo = {
|
||||||
|
bar: function() { // do some stuff }
|
||||||
|
}
|
||||||
|
|
||||||
|
// defining a spy on an existing property: foo.bar
|
||||||
|
spyOn(foo, 'bar').andCallThrough();</pre>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name="andReturn"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>andReturn</b>(value)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
For setting the return value of a spy.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<pre class="code">// defining a spy from scratch: foo() returns 'baz'
|
||||||
|
var foo = jasmine.createSpy('spy on foo').andReturn('baz');
|
||||||
|
|
||||||
|
// defining a spy on an existing property: foo.bar() returns 'baz'
|
||||||
|
spyOn(foo, 'bar').andReturn('baz');</pre>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{Object}</span> <b>value</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name="andThrow"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>andThrow</b>(exceptionMsg)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
For throwing an exception when a spy is called.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<pre class="code">// defining a spy from scratch: foo() throws an exception w/ message 'ouch'
|
||||||
|
var foo = jasmine.createSpy('spy on foo').andThrow('baz');
|
||||||
|
|
||||||
|
// defining a spy on an existing property: foo.bar() throws an exception w/ message 'ouch'
|
||||||
|
spyOn(foo, 'bar').andThrow('baz');</pre>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{String}</span> <b>exceptionMsg</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name="plan"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>plan</b>()
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
The acutal function this spy stubs.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name="reset"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>reset</b>()
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Resets all of a spy's the tracking variables so that it can be used again.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<pre class="code">spyOn(foo, 'bar');
|
||||||
|
|
||||||
|
foo.bar();
|
||||||
|
|
||||||
|
expect(foo.bar.callCount).toEqual(1);
|
||||||
|
|
||||||
|
foo.bar.reset();
|
||||||
|
|
||||||
|
expect(foo.bar.callCount).toEqual(0);</pre>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== event details ========================= -->
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== footer ================================= -->
|
||||||
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,408 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
|
<meta name="generator" content="JsDoc Toolkit" />
|
||||||
|
|
||||||
|
<title>JsDoc Reference - jasmine.Suite</title>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
/* default.css */
|
||||||
|
body
|
||||||
|
{
|
||||||
|
font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
|
||||||
|
width: 800px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header
|
||||||
|
{
|
||||||
|
clear: both;
|
||||||
|
background-color: #ccc;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1
|
||||||
|
{
|
||||||
|
font-size: 150%;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 0;
|
||||||
|
margin: 1em 0 0 .3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr
|
||||||
|
{
|
||||||
|
border: none 0;
|
||||||
|
border-top: 1px solid #7F8FB1;
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre.code
|
||||||
|
{
|
||||||
|
display: block;
|
||||||
|
padding: 8px;
|
||||||
|
border: 1px dashed #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#index
|
||||||
|
{
|
||||||
|
margin-top: 24px;
|
||||||
|
float: left;
|
||||||
|
width: 160px;
|
||||||
|
position: absolute;
|
||||||
|
left: 8px;
|
||||||
|
background-color: #F3F3F3;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content
|
||||||
|
{
|
||||||
|
margin-left: 190px;
|
||||||
|
width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList
|
||||||
|
{
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 0 8px;
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
font-size: 1em;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList li
|
||||||
|
{
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 8px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { width: 100%; }
|
||||||
|
|
||||||
|
h1.classTitle
|
||||||
|
{
|
||||||
|
font-size:170%;
|
||||||
|
line-height:130%;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 { font-size: 110%; }
|
||||||
|
caption, div.sectionTitle
|
||||||
|
{
|
||||||
|
background-color: #7F8FB1;
|
||||||
|
color: #fff;
|
||||||
|
font-size:130%;
|
||||||
|
text-align: left;
|
||||||
|
padding: 2px 6px 2px 6px;
|
||||||
|
border: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sectionTitle { margin-bottom: 8px; }
|
||||||
|
.summaryTable thead { display: none; }
|
||||||
|
|
||||||
|
.summaryTable td
|
||||||
|
{
|
||||||
|
vertical-align: top;
|
||||||
|
padding: 4px;
|
||||||
|
border-bottom: 1px #7F8FB1 solid;
|
||||||
|
border-right: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*col#summaryAttributes {}*/
|
||||||
|
.summaryTable td.attributes
|
||||||
|
{
|
||||||
|
border-left: 1px #7F8FB1 solid;
|
||||||
|
width: 140px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.attributes, .fixedFont
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
color: #002EBE;
|
||||||
|
font-family: "Courier New",Courier,monospace;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription
|
||||||
|
{
|
||||||
|
text-align: left;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription, .description
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
padding: 4px;
|
||||||
|
padding-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { margin-bottom: 8px; }
|
||||||
|
|
||||||
|
ul.inheritsList
|
||||||
|
{
|
||||||
|
list-style: square;
|
||||||
|
margin-left: 20px;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detailList {
|
||||||
|
margin-left: 20px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
.detailList dt { margin-left: 20px; }
|
||||||
|
|
||||||
|
.detailList .heading
|
||||||
|
{
|
||||||
|
font-weight: bold;
|
||||||
|
padding-bottom: 6px;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.light, td.attributes, .light a:link, .light a:visited
|
||||||
|
{
|
||||||
|
color: #777;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fineprint
|
||||||
|
{
|
||||||
|
text-align: right;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- ============================== header ================================= -->
|
||||||
|
<!-- begin static/header.html -->
|
||||||
|
<div id="header">
|
||||||
|
</div>
|
||||||
|
<!-- end static/header.html -->
|
||||||
|
|
||||||
|
<!-- ============================== classes index ============================ -->
|
||||||
|
<div id="index">
|
||||||
|
<!-- begin publish.classesIndex -->
|
||||||
|
<div align="center"><a href="../index.html">Class Index</a>
|
||||||
|
| <a href="../files.html">File Index</a></div>
|
||||||
|
<hr />
|
||||||
|
<h2>Classes</h2>
|
||||||
|
<ul class="classList">
|
||||||
|
|
||||||
|
<li><i><a href="../symbols/_global_.html">_global_</a></i></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.html">jasmine</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Block.html">jasmine.Block</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Env.html">jasmine.Env</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Reporter.html">jasmine.Reporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Runner.html">jasmine.Runner</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Spec.html">jasmine.Spec</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Spy.html">jasmine.Spy</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Suite.html">jasmine.Suite</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.util.html">jasmine.util</a></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<hr />
|
||||||
|
<!-- end publish.classesIndex -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
<!-- ============================== class title ============================ -->
|
||||||
|
<h1 class="classTitle">
|
||||||
|
|
||||||
|
Class jasmine.Suite
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<!-- ============================== class summary ========================== -->
|
||||||
|
<p class="description">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ============================== constructor summary ==================== -->
|
||||||
|
|
||||||
|
<table class="summaryTable" cellspacing="0" summary="A summary of the constructor documented in the class jasmine.Suite.">
|
||||||
|
<caption>Class Summary</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Constructor Attributes</th>
|
||||||
|
<th scope="col">Constructor Name and Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription" >
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b><a href="../symbols/jasmine.Suite.html">jasmine.Suite</a></b>(env, description, specDefinitions, parentSuite)
|
||||||
|
</div>
|
||||||
|
<div class="description">Internal representation of a Jasmine suite.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== properties summary ===================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== methods summary ======================== -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<table class="summaryTable" cellspacing="0" summary="A summary of the methods documented in the class jasmine.Suite.">
|
||||||
|
<caption>Method Summary</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Method Attributes</th>
|
||||||
|
<th scope="col">Method Name and Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont"><b><a href="../symbols/jasmine.Suite.html#specCount">specCount</a></b>()
|
||||||
|
</div>
|
||||||
|
<div class="description"></div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== events summary ======================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== constructor details ==================== -->
|
||||||
|
|
||||||
|
<div class="details"><a name="constructor"> </a>
|
||||||
|
<div class="sectionTitle">
|
||||||
|
Class Detail
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b>jasmine.Suite</b>(env, description, specDefinitions, parentSuite)
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="description">
|
||||||
|
Internal representation of a Jasmine suite.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{<a href="../symbols/jasmine.Env.html">jasmine.Env</a>}</span> <b>env</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{String}</span> <b>description</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{Function}</span> <b>specDefinitions</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{<a href="../symbols/jasmine.Suite.html">jasmine.Suite</a>}</span> <b>parentSuite</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== field details ========================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== method details ========================= -->
|
||||||
|
|
||||||
|
<div class="sectionTitle">
|
||||||
|
Method Detail
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a name="specCount"> </a>
|
||||||
|
<div class="fixedFont">
|
||||||
|
|
||||||
|
|
||||||
|
<b>specCount</b>()
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== event details ========================= -->
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== footer ================================= -->
|
||||||
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,684 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
|
<meta name="generator" content="JsDoc Toolkit" />
|
||||||
|
|
||||||
|
<title>JsDoc Reference - jasmine</title>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
/* default.css */
|
||||||
|
body
|
||||||
|
{
|
||||||
|
font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
|
||||||
|
width: 800px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header
|
||||||
|
{
|
||||||
|
clear: both;
|
||||||
|
background-color: #ccc;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1
|
||||||
|
{
|
||||||
|
font-size: 150%;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 0;
|
||||||
|
margin: 1em 0 0 .3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr
|
||||||
|
{
|
||||||
|
border: none 0;
|
||||||
|
border-top: 1px solid #7F8FB1;
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre.code
|
||||||
|
{
|
||||||
|
display: block;
|
||||||
|
padding: 8px;
|
||||||
|
border: 1px dashed #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#index
|
||||||
|
{
|
||||||
|
margin-top: 24px;
|
||||||
|
float: left;
|
||||||
|
width: 160px;
|
||||||
|
position: absolute;
|
||||||
|
left: 8px;
|
||||||
|
background-color: #F3F3F3;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content
|
||||||
|
{
|
||||||
|
margin-left: 190px;
|
||||||
|
width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList
|
||||||
|
{
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 0 8px;
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
font-size: 1em;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList li
|
||||||
|
{
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 8px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { width: 100%; }
|
||||||
|
|
||||||
|
h1.classTitle
|
||||||
|
{
|
||||||
|
font-size:170%;
|
||||||
|
line-height:130%;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 { font-size: 110%; }
|
||||||
|
caption, div.sectionTitle
|
||||||
|
{
|
||||||
|
background-color: #7F8FB1;
|
||||||
|
color: #fff;
|
||||||
|
font-size:130%;
|
||||||
|
text-align: left;
|
||||||
|
padding: 2px 6px 2px 6px;
|
||||||
|
border: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sectionTitle { margin-bottom: 8px; }
|
||||||
|
.summaryTable thead { display: none; }
|
||||||
|
|
||||||
|
.summaryTable td
|
||||||
|
{
|
||||||
|
vertical-align: top;
|
||||||
|
padding: 4px;
|
||||||
|
border-bottom: 1px #7F8FB1 solid;
|
||||||
|
border-right: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*col#summaryAttributes {}*/
|
||||||
|
.summaryTable td.attributes
|
||||||
|
{
|
||||||
|
border-left: 1px #7F8FB1 solid;
|
||||||
|
width: 140px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.attributes, .fixedFont
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
color: #002EBE;
|
||||||
|
font-family: "Courier New",Courier,monospace;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription
|
||||||
|
{
|
||||||
|
text-align: left;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription, .description
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
padding: 4px;
|
||||||
|
padding-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { margin-bottom: 8px; }
|
||||||
|
|
||||||
|
ul.inheritsList
|
||||||
|
{
|
||||||
|
list-style: square;
|
||||||
|
margin-left: 20px;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detailList {
|
||||||
|
margin-left: 20px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
.detailList dt { margin-left: 20px; }
|
||||||
|
|
||||||
|
.detailList .heading
|
||||||
|
{
|
||||||
|
font-weight: bold;
|
||||||
|
padding-bottom: 6px;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.light, td.attributes, .light a:link, .light a:visited
|
||||||
|
{
|
||||||
|
color: #777;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fineprint
|
||||||
|
{
|
||||||
|
text-align: right;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- ============================== header ================================= -->
|
||||||
|
<!-- begin static/header.html -->
|
||||||
|
<div id="header">
|
||||||
|
</div>
|
||||||
|
<!-- end static/header.html -->
|
||||||
|
|
||||||
|
<!-- ============================== classes index ============================ -->
|
||||||
|
<div id="index">
|
||||||
|
<!-- begin publish.classesIndex -->
|
||||||
|
<div align="center"><a href="../index.html">Class Index</a>
|
||||||
|
| <a href="../files.html">File Index</a></div>
|
||||||
|
<hr />
|
||||||
|
<h2>Classes</h2>
|
||||||
|
<ul class="classList">
|
||||||
|
|
||||||
|
<li><i><a href="../symbols/_global_.html">_global_</a></i></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.html">jasmine</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Block.html">jasmine.Block</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Env.html">jasmine.Env</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Reporter.html">jasmine.Reporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Runner.html">jasmine.Runner</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Spec.html">jasmine.Spec</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Spy.html">jasmine.Spy</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Suite.html">jasmine.Suite</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.util.html">jasmine.util</a></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<hr />
|
||||||
|
<!-- end publish.classesIndex -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
<!-- ============================== class title ============================ -->
|
||||||
|
<h1 class="classTitle">
|
||||||
|
|
||||||
|
Namespace jasmine
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<!-- ============================== class summary ========================== -->
|
||||||
|
<p class="description">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ============================== constructor summary ==================== -->
|
||||||
|
|
||||||
|
<table class="summaryTable" cellspacing="0" summary="A summary of the constructor documented in the class jasmine.">
|
||||||
|
<caption>Namespace Summary</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Constructor Attributes</th>
|
||||||
|
<th scope="col">Constructor Name and Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription" >
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b><a href="../symbols/jasmine.html">jasmine</a></b>
|
||||||
|
</div>
|
||||||
|
<div class="description">Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== properties summary ===================== -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== methods summary ======================== -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<table class="summaryTable" cellspacing="0" summary="A summary of the methods documented in the class jasmine.">
|
||||||
|
<caption>Method Summary</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Method Attributes</th>
|
||||||
|
<th scope="col">Method Name and Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"><static> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont">jasmine.<b><a href="../symbols/jasmine.html#.any">any</a></b>(clazz)
|
||||||
|
</div>
|
||||||
|
<div class="description">Returns a matchable 'generic' object of the class type.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"><static> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont">jasmine.<b><a href="../symbols/jasmine.html#.createSpyObj">createSpyObj</a></b>(baseName, methodNames)
|
||||||
|
</div>
|
||||||
|
<div class="description">Creates a more complicated spy: an Object that has every property a function that is a spy.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"><static> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont">jasmine.<b><a href="../symbols/jasmine.html#.getEnv">getEnv</a></b>()
|
||||||
|
</div>
|
||||||
|
<div class="description">Getter for the Jasmine environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"><static> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont">jasmine.<b><a href="../symbols/jasmine.html#.include">include</a></b>(url, opt_global)
|
||||||
|
</div>
|
||||||
|
<div class="description">Adds suite files to an HTML document so that they are executed, thus adding them to the current
|
||||||
|
Jasmine environment.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"><static> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont">jasmine.<b><a href="../symbols/jasmine.html#.isDomNode">isDomNode</a></b>(obj)
|
||||||
|
</div>
|
||||||
|
<div class="description">Returns true if the object is a DOM Node.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"><static> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont">jasmine.<b><a href="../symbols/jasmine.html#.pp">pp</a></b>(value)
|
||||||
|
</div>
|
||||||
|
<div class="description">Pretty printer for expecations.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"><static> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont">jasmine.<b><a href="../symbols/jasmine.html#.PrettyPrinter">PrettyPrinter</a></b>()
|
||||||
|
</div>
|
||||||
|
<div class="description">Base class for pretty printing for expectation results.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== events summary ======================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== constructor details ==================== -->
|
||||||
|
|
||||||
|
<div class="details"><a name="constructor"> </a>
|
||||||
|
<div class="sectionTitle">
|
||||||
|
Namespace Detail
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b>jasmine</b>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="description">
|
||||||
|
Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== field details ========================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== method details ========================= -->
|
||||||
|
|
||||||
|
<div class="sectionTitle">
|
||||||
|
Method Detail
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a name=".any"> </a>
|
||||||
|
<div class="fixedFont"><static>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="light">jasmine.</span><b>any</b>(clazz)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Returns a matchable 'generic' object of the class type. For use in expecations of type when values don't matter.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<pre class="code">// don't care about which function is passed in, as long as it's a function
|
||||||
|
expect(mySpy).wasCalledWith(jasmine.any(Function));</pre>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{Class}</span> <b>clazz</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Returns:</dt>
|
||||||
|
|
||||||
|
<dd>matchable object of the type clazz</dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name=".createSpyObj"> </a>
|
||||||
|
<div class="fixedFont"><static>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="light">jasmine.</span><b>createSpyObj</b>(baseName, methodNames)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Creates a more complicated spy: an Object that has every property a function that is a spy. Used for stubbing something
|
||||||
|
large in one call.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{String}</span> <b>baseName</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd>name of spy class</dd>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{Array}</span> <b>methodNames</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd>array of names of methods to make spies</dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name=".getEnv"> </a>
|
||||||
|
<div class="fixedFont"><static>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="light">jasmine.</span><b>getEnv</b>()
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Getter for the Jasmine environment. Ensures one gets created
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name=".include"> </a>
|
||||||
|
<div class="fixedFont"><static>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="light">jasmine.</span><b>include</b>(url, opt_global)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Adds suite files to an HTML document so that they are executed, thus adding them to the current
|
||||||
|
Jasmine environment.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{String}</span> <b>url</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd>path to the file to include</dd>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{Boolean}</span> <b>opt_global</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name=".isDomNode"> </a>
|
||||||
|
<div class="fixedFont"><static>
|
||||||
|
|
||||||
|
<span class="light">{Boolean}</span>
|
||||||
|
<span class="light">jasmine.</span><b>isDomNode</b>(obj)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Returns true if the object is a DOM Node.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<span class="light fixedFont">{Object}</span> <b>obj</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd>object to check</dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Returns:</dt>
|
||||||
|
|
||||||
|
<dd><span class="light fixedFont">{Boolean}</span> </dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name=".pp"> </a>
|
||||||
|
<div class="fixedFont"><static>
|
||||||
|
|
||||||
|
<span class="light">{String}</span>
|
||||||
|
<span class="light">jasmine.</span><b>pp</b>(value)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Pretty printer for expecations. Takes any object and turns it into a human-readable string.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Parameters:</dt>
|
||||||
|
|
||||||
|
<dt>
|
||||||
|
<b>value</b>
|
||||||
|
|
||||||
|
</dt>
|
||||||
|
<dd>{Object} an object to be outputted</dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="detailList">
|
||||||
|
<dt class="heading">Returns:</dt>
|
||||||
|
|
||||||
|
<dd><span class="light fixedFont">{String}</span> </dd>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a name=".PrettyPrinter"> </a>
|
||||||
|
<div class="fixedFont"><static>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="light">jasmine.</span><b>PrettyPrinter</b>()
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Base class for pretty printing for expectation results.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== event details ========================= -->
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== footer ================================= -->
|
||||||
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,322 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
|
<meta name="generator" content="JsDoc Toolkit" />
|
||||||
|
|
||||||
|
<title>JsDoc Reference - jasmine.util</title>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
/* default.css */
|
||||||
|
body
|
||||||
|
{
|
||||||
|
font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
|
||||||
|
width: 800px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header
|
||||||
|
{
|
||||||
|
clear: both;
|
||||||
|
background-color: #ccc;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1
|
||||||
|
{
|
||||||
|
font-size: 150%;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 0;
|
||||||
|
margin: 1em 0 0 .3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr
|
||||||
|
{
|
||||||
|
border: none 0;
|
||||||
|
border-top: 1px solid #7F8FB1;
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre.code
|
||||||
|
{
|
||||||
|
display: block;
|
||||||
|
padding: 8px;
|
||||||
|
border: 1px dashed #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#index
|
||||||
|
{
|
||||||
|
margin-top: 24px;
|
||||||
|
float: left;
|
||||||
|
width: 160px;
|
||||||
|
position: absolute;
|
||||||
|
left: 8px;
|
||||||
|
background-color: #F3F3F3;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content
|
||||||
|
{
|
||||||
|
margin-left: 190px;
|
||||||
|
width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList
|
||||||
|
{
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 0 8px;
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
font-size: 1em;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.classList li
|
||||||
|
{
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 8px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { width: 100%; }
|
||||||
|
|
||||||
|
h1.classTitle
|
||||||
|
{
|
||||||
|
font-size:170%;
|
||||||
|
line-height:130%;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 { font-size: 110%; }
|
||||||
|
caption, div.sectionTitle
|
||||||
|
{
|
||||||
|
background-color: #7F8FB1;
|
||||||
|
color: #fff;
|
||||||
|
font-size:130%;
|
||||||
|
text-align: left;
|
||||||
|
padding: 2px 6px 2px 6px;
|
||||||
|
border: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sectionTitle { margin-bottom: 8px; }
|
||||||
|
.summaryTable thead { display: none; }
|
||||||
|
|
||||||
|
.summaryTable td
|
||||||
|
{
|
||||||
|
vertical-align: top;
|
||||||
|
padding: 4px;
|
||||||
|
border-bottom: 1px #7F8FB1 solid;
|
||||||
|
border-right: 1px #7F8FB1 solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*col#summaryAttributes {}*/
|
||||||
|
.summaryTable td.attributes
|
||||||
|
{
|
||||||
|
border-left: 1px #7F8FB1 solid;
|
||||||
|
width: 140px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.attributes, .fixedFont
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
color: #002EBE;
|
||||||
|
font-family: "Courier New",Courier,monospace;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription
|
||||||
|
{
|
||||||
|
text-align: left;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable td.nameDescription, .description
|
||||||
|
{
|
||||||
|
line-height: 15px;
|
||||||
|
padding: 4px;
|
||||||
|
padding-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summaryTable { margin-bottom: 8px; }
|
||||||
|
|
||||||
|
ul.inheritsList
|
||||||
|
{
|
||||||
|
list-style: square;
|
||||||
|
margin-left: 20px;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detailList {
|
||||||
|
margin-left: 20px;
|
||||||
|
line-height: 15px;
|
||||||
|
}
|
||||||
|
.detailList dt { margin-left: 20px; }
|
||||||
|
|
||||||
|
.detailList .heading
|
||||||
|
{
|
||||||
|
font-weight: bold;
|
||||||
|
padding-bottom: 6px;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.light, td.attributes, .light a:link, .light a:visited
|
||||||
|
{
|
||||||
|
color: #777;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fineprint
|
||||||
|
{
|
||||||
|
text-align: right;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- ============================== header ================================= -->
|
||||||
|
<!-- begin static/header.html -->
|
||||||
|
<div id="header">
|
||||||
|
</div>
|
||||||
|
<!-- end static/header.html -->
|
||||||
|
|
||||||
|
<!-- ============================== classes index ============================ -->
|
||||||
|
<div id="index">
|
||||||
|
<!-- begin publish.classesIndex -->
|
||||||
|
<div align="center"><a href="../index.html">Class Index</a>
|
||||||
|
| <a href="../files.html">File Index</a></div>
|
||||||
|
<hr />
|
||||||
|
<h2>Classes</h2>
|
||||||
|
<ul class="classList">
|
||||||
|
|
||||||
|
<li><i><a href="../symbols/_global_.html">_global_</a></i></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.html">jasmine</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Block.html">jasmine.Block</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Env.html">jasmine.Env</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Reporter.html">jasmine.Reporter</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Runner.html">jasmine.Runner</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Spec.html">jasmine.Spec</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Spy.html">jasmine.Spy</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.Suite.html">jasmine.Suite</a></li>
|
||||||
|
|
||||||
|
<li><a href="../symbols/jasmine.util.html">jasmine.util</a></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<hr />
|
||||||
|
<!-- end publish.classesIndex -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
<!-- ============================== class title ============================ -->
|
||||||
|
<h1 class="classTitle">
|
||||||
|
|
||||||
|
Namespace jasmine.util
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<!-- ============================== class summary ========================== -->
|
||||||
|
<p class="description">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- ============================== constructor summary ==================== -->
|
||||||
|
|
||||||
|
<table class="summaryTable" cellspacing="0" summary="A summary of the constructor documented in the class jasmine.util.">
|
||||||
|
<caption>Namespace Summary</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Constructor Attributes</th>
|
||||||
|
<th scope="col">Constructor Name and Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"> </td>
|
||||||
|
<td class="nameDescription" >
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b><a href="../symbols/jasmine.util.html">jasmine.util</a></b>
|
||||||
|
</div>
|
||||||
|
<div class="description"></div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== properties summary ===================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== methods summary ======================== -->
|
||||||
|
|
||||||
|
<!-- ============================== events summary ======================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== constructor details ==================== -->
|
||||||
|
|
||||||
|
<div class="details"><a name="constructor"> </a>
|
||||||
|
<div class="sectionTitle">
|
||||||
|
Namespace Detail
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="fixedFont">
|
||||||
|
<b>jasmine.util</b>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="description">
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== field details ========================== -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== method details ========================= -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== event details ========================= -->
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ============================== footer ================================= -->
|
||||||
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Wed Sep 09 2009 18:14:14 GMT-0700 (PDT)
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
|
||||||
|
.KEYW {color: #933;}
|
||||||
|
.COMM {color: #bbb; font-style: italic;}
|
||||||
|
.NUMB {color: #393;}
|
||||||
|
.STRN {color: #393;}
|
||||||
|
.REGX {color: #339;}
|
||||||
|
.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
|
||||||
|
</style></head><body><pre><span class='line'> 1</span> <span class="NAME">jasmine.TrivialReporter</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">doc</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'> 2</span> </span><span class="WHIT"> </span><span class="NAME">this.document</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">doc</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">document</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 3</span> </span><span class="WHIT"> </span><span class="NAME">this.suiteDivs</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 4</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 5</span>
|
||||||
|
<span class='line'> 6</span> </span><span class="NAME">jasmine.TrivialReporter.prototype.createDom</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">attrs</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">childrenVarArgs</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'> 7</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">el</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.createElement</span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 8</span>
|
||||||
|
<span class='line'> 9</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">2</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">arguments.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'> 10</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">child</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">arguments</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 11</span>
|
||||||
|
<span class='line'> 12</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">child</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'> 13</span> </span><span class="WHIT"> </span><span class="NAME">el.appendChild</span><span class="PUNC">(</span><span class="NAME">document.createTextNode</span><span class="PUNC">(</span><span class="NAME">child</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 14</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'> 15</span> </span><span class="WHIT"> </span><span class="NAME">el.appendChild</span><span class="PUNC">(</span><span class="NAME">child</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 16</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'> 17</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'> 18</span>
|
||||||
|
<span class='line'> 19</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">attr</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">attrs</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'> 20</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">attr</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'className'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'> 21</span> </span><span class="WHIT"> </span><span class="NAME">el.setAttribute</span><span class="PUNC">(</span><span class="STRN">'class'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">attrs</span><span class="PUNC">[</span><span class="NAME">attr</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 22</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'> 23</span> </span><span class="WHIT"> </span><span class="NAME">el</span><span class="PUNC">[</span><span class="NAME">attr</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">attrs</span><span class="PUNC">[</span><span class="NAME">attr</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 24</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'> 25</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'> 26</span>
|
||||||
|
<span class='line'> 27</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">el</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 28</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 29</span>
|
||||||
|
<span class='line'> 30</span> </span><span class="NAME">jasmine.TrivialReporter.prototype.reportRunnerStarting</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">runner</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'> 31</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">suites</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">runner.suites</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 32</span>
|
||||||
|
<span class='line'> 33</span> </span><span class="WHIT"> </span><span class="NAME">this.runnerDiv</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'div'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">className</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'runner running'</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
|
<span class='line'> 34</span> </span><span class="WHIT"> </span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'a'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">className</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'runSpec'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">href</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'?'</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"run all"</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
|
<span class='line'> 35</span> </span><span class="WHIT"> </span><span class="NAME">this.runnerMessageSpan</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'span'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"Running..."</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 36</span> </span><span class="WHIT"> </span><span class="NAME">this.document.body.appendChild</span><span class="PUNC">(</span><span class="NAME">this.runnerDiv</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 37</span>
|
||||||
|
<span class='line'> 38</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">suites.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'> 39</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">suite</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">suites</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 40</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">suiteDiv</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'div'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">className</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'suite'</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
|
<span class='line'> 41</span> </span><span class="WHIT"> </span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'a'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">className</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'runSpec'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">href</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'?spec='</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">encodeURIComponent</span><span class="PUNC">(</span><span class="NAME">suite.getFullName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"run"</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
|
<span class='line'> 42</span> </span><span class="WHIT"> </span><span class="NAME">suite.description</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 43</span> </span><span class="WHIT"> </span><span class="NAME">this.suiteDivs</span><span class="PUNC">[</span><span class="NAME">suite.getFullName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">suiteDiv</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 44</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">parentDiv</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.document.body</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 45</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">suite.parentSuite</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'> 46</span> </span><span class="WHIT"> </span><span class="NAME">parentDiv</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.suiteDivs</span><span class="PUNC">[</span><span class="NAME">suite.parentSuite.getFullName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 47</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'> 48</span> </span><span class="WHIT"> </span><span class="NAME">parentDiv.appendChild</span><span class="PUNC">(</span><span class="NAME">suiteDiv</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 49</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'> 50</span>
|
||||||
|
<span class='line'> 51</span> </span><span class="WHIT"> </span><span class="NAME">this.startedAt</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Date</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 52</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 53</span>
|
||||||
|
<span class='line'> 54</span> </span><span class="NAME">jasmine.TrivialReporter.prototype.reportRunnerResults</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">runner</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'> 55</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">results</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">runner.getResults</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 56</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">className</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">results.failedCount</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">"runner failed"</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"runner passed"</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 57</span> </span><span class="WHIT"> </span><span class="NAME">this.runnerDiv.setAttribute</span><span class="PUNC">(</span><span class="STRN">"class"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">className</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 58</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">message</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">results.failedCount</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">" failure"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">results.failedCount</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">""</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"s"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 59</span> </span><span class="WHIT"> </span><span class="NAME">message</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">" in "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Date</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">getTime</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">this.startedAt.getTime</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">/</span><span class="WHIT"> </span><span class="NUMB">1000</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"s"</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 60</span> </span><span class="WHIT"> </span><span class="NAME">this.runnerMessageSpan.replaceChild</span><span class="PUNC">(</span><span class="NAME">this.document.createTextNode</span><span class="PUNC">(</span><span class="NAME">message</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this.runnerMessageSpan.firstChild</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 61</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 62</span>
|
||||||
|
<span class='line'> 63</span> </span><span class="NAME">jasmine.TrivialReporter.prototype.reportSuiteResults</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">suite</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'> 64</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">results</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">suite.getResults</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 65</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">status</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">results.passed</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'passed'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'failed'</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 66</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">results.totalCount</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">// todo: change this to check results.skipped</span><span class="WHIT">
|
||||||
|
<span class='line'> 67</span> </span><span class="WHIT"> </span><span class="NAME">status</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'skipped'</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 68</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'> 69</span> </span><span class="WHIT"> </span><span class="NAME">this.suiteDivs</span><span class="PUNC">[</span><span class="NAME">suite.getFullName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">className</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">" "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">status</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 70</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 71</span>
|
||||||
|
<span class='line'> 72</span> </span><span class="NAME">jasmine.TrivialReporter.prototype.reportSpecResults</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">spec</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'> 73</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">results</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">spec.getResults</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 74</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">status</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">results.passed</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'passed'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'failed'</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 75</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">results.skipped</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'> 76</span> </span><span class="WHIT"> </span><span class="NAME">status</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'skipped'</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 77</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'> 78</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">specDiv</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'div'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">className</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'spec '</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">status</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
|
<span class='line'> 79</span> </span><span class="WHIT"> </span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'a'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">className</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'runSpec'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">href</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'?spec='</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">encodeURIComponent</span><span class="PUNC">(</span><span class="NAME">spec.getFullName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"run"</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
|
<span class='line'> 80</span> </span><span class="WHIT"> </span><span class="NAME">spec.getFullName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 81</span>
|
||||||
|
<span class='line'> 82</span>
|
||||||
|
<span class='line'> 83</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">resultItems</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">results.getItems</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 84</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">resultItems.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'> 85</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">resultItems</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 86</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">result.passed</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">result.passed</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'> 87</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">resultMessageDiv</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'div'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">className</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'resultMessage fail'</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 88</span> </span><span class="WHIT"> </span><span class="NAME">resultMessageDiv.innerHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">result.message</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// todo: lame; mend</span><span class="WHIT">
|
||||||
|
<span class='line'> 89</span> </span><span class="WHIT"> </span><span class="NAME">specDiv.appendChild</span><span class="PUNC">(</span><span class="NAME">resultMessageDiv</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 90</span> </span><span class="WHIT"> </span><span class="NAME">specDiv.appendChild</span><span class="PUNC">(</span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'div'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">className</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'stackTrace'</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">result.trace.stack</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 91</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'> 92</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'> 93</span>
|
||||||
|
<span class='line'> 94</span> </span><span class="WHIT"> </span><span class="NAME">this.suiteDivs</span><span class="PUNC">[</span><span class="NAME">spec.suite.getFullName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">appendChild</span><span class="PUNC">(</span><span class="NAME">specDiv</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 95</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 96</span>
|
||||||
|
<span class='line'> 97</span> </span><span class="NAME">jasmine.TrivialReporter.prototype.log</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'> 98</span> </span><span class="WHIT"> </span><span class="NAME">console.log.apply</span><span class="PUNC">(</span><span class="NAME">console</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">arguments</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'> 99</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>100</span>
|
||||||
|
<span class='line'>101</span> </span><span class="NAME">jasmine.TrivialReporter.prototype.getLocation</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>102</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.document.location</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>103</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>104</span>
|
||||||
|
<span class='line'>105</span> </span><span class="NAME">jasmine.TrivialReporter.prototype.specFilter</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">spec</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>106</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">paramMap</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>107</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">params</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.getLocation</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">search.substring</span><span class="PUNC">(</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">split</span><span class="PUNC">(</span><span class="STRN">'&'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>108</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">params.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>109</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">p</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">params</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">split</span><span class="PUNC">(</span><span class="STRN">'='</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>110</span> </span><span class="WHIT"> </span><span class="NAME">paramMap</span><span class="PUNC">[</span><span class="NAME">decodeURIComponent</span><span class="PUNC">(</span><span class="NAME">p</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">decodeURIComponent</span><span class="PUNC">(</span><span class="NAME">p</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>111</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>112</span>
|
||||||
|
<span class='line'>113</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">paramMap</span><span class="PUNC">[</span><span class="STRN">"spec"</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>114</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">spec.getFullName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">indexOf</span><span class="PUNC">(</span><span class="NAME">paramMap</span><span class="PUNC">[</span><span class="STRN">"spec"</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>115</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>116</span>
|
||||||
|
<span class='line'>117</span> </span><span class="COMM">//protect against console.log incidents</span><span class="WHIT">
|
||||||
|
<span class='line'>118</span> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="PUNC">(</span><span class="STRN">"console"</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">window</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="PUNC">(</span><span class="STRN">"firebug"</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">console</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>119</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">names</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="STRN">"log"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"debug"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"info"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"warn"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"error"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"assert"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"dir"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"dirxml"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"group"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"groupEnd"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"time"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"timeEnd"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"count"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"trace"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"profile"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"profileEnd"</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>120</span> </span><span class="WHIT"> </span><span class="NAME">window.console</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>121</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">names.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="PUNC">++</span><span class="NAME">i</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>122</span> </span><span class="WHIT"> </span><span class="NAME">window.console</span><span class="PUNC">[</span><span class="NAME">names</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>123</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>124</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>125</span> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>126</span> </span></pre></body></html>
|
||||||
@@ -0,0 +1,486 @@
|
|||||||
|
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
|
||||||
|
.KEYW {color: #933;}
|
||||||
|
.COMM {color: #bbb; font-style: italic;}
|
||||||
|
.NUMB {color: #393;}
|
||||||
|
.STRN {color: #393;}
|
||||||
|
.REGX {color: #339;}
|
||||||
|
.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
|
||||||
|
</style></head><body><pre><span class='line'> 1</span> <span class="COMM">/*
|
||||||
|
<span class='line'> 2</span> http://www.JSON.org/json2.js
|
||||||
|
<span class='line'> 3</span> 2008-11-19
|
||||||
|
<span class='line'> 4</span>
|
||||||
|
<span class='line'> 5</span> Public Domain.
|
||||||
|
<span class='line'> 6</span>
|
||||||
|
<span class='line'> 7</span> NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
|
||||||
|
<span class='line'> 8</span>
|
||||||
|
<span class='line'> 9</span> See http://www.JSON.org/js.html
|
||||||
|
<span class='line'> 10</span>
|
||||||
|
<span class='line'> 11</span> This file creates a global JSON object containing two methods: stringify
|
||||||
|
<span class='line'> 12</span> and parse.
|
||||||
|
<span class='line'> 13</span>
|
||||||
|
<span class='line'> 14</span> JSON.stringify(value, replacer, space)
|
||||||
|
<span class='line'> 15</span> value any JavaScript value, usually an object or array.
|
||||||
|
<span class='line'> 16</span>
|
||||||
|
<span class='line'> 17</span> replacer an optional parameter that determines how object
|
||||||
|
<span class='line'> 18</span> values are stringified for objects. It can be a
|
||||||
|
<span class='line'> 19</span> function or an array of strings.
|
||||||
|
<span class='line'> 20</span>
|
||||||
|
<span class='line'> 21</span> space an optional parameter that specifies the indentation
|
||||||
|
<span class='line'> 22</span> of nested structures. If it is omitted, the text will
|
||||||
|
<span class='line'> 23</span> be packed without extra whitespace. If it is a number,
|
||||||
|
<span class='line'> 24</span> it will specify the number of spaces to indent at each
|
||||||
|
<span class='line'> 25</span> level. If it is a string (such as '\t' or ' '),
|
||||||
|
<span class='line'> 26</span> it contains the characters used to indent at each level.
|
||||||
|
<span class='line'> 27</span>
|
||||||
|
<span class='line'> 28</span> This method produces a JSON text from a JavaScript value.
|
||||||
|
<span class='line'> 29</span>
|
||||||
|
<span class='line'> 30</span> When an object value is found, if the object contains a toJSON
|
||||||
|
<span class='line'> 31</span> method, its toJSON method will be called and the result will be
|
||||||
|
<span class='line'> 32</span> stringified. A toJSON method does not serialize: it returns the
|
||||||
|
<span class='line'> 33</span> value represented by the name/value pair that should be serialized,
|
||||||
|
<span class='line'> 34</span> or undefined if nothing should be serialized. The toJSON method
|
||||||
|
<span class='line'> 35</span> will be passed the key associated with the value, and this will be
|
||||||
|
<span class='line'> 36</span> bound to the object holding the key.
|
||||||
|
<span class='line'> 37</span>
|
||||||
|
<span class='line'> 38</span> For example, this would serialize Dates as ISO strings.
|
||||||
|
<span class='line'> 39</span>
|
||||||
|
<span class='line'> 40</span> Date.prototype.toJSON = function (key) {
|
||||||
|
<span class='line'> 41</span> function f(n) {
|
||||||
|
<span class='line'> 42</span> // Format integers to have at least two digits.
|
||||||
|
<span class='line'> 43</span> return n < 10 ? '0' + n : n;
|
||||||
|
<span class='line'> 44</span> }
|
||||||
|
<span class='line'> 45</span>
|
||||||
|
<span class='line'> 46</span> return this.getUTCFullYear() + '-' +
|
||||||
|
<span class='line'> 47</span> f(this.getUTCMonth() + 1) + '-' +
|
||||||
|
<span class='line'> 48</span> f(this.getUTCDate()) + 'T' +
|
||||||
|
<span class='line'> 49</span> f(this.getUTCHours()) + ':' +
|
||||||
|
<span class='line'> 50</span> f(this.getUTCMinutes()) + ':' +
|
||||||
|
<span class='line'> 51</span> f(this.getUTCSeconds()) + 'Z';
|
||||||
|
<span class='line'> 52</span> };
|
||||||
|
<span class='line'> 53</span>
|
||||||
|
<span class='line'> 54</span> You can provide an optional replacer method. It will be passed the
|
||||||
|
<span class='line'> 55</span> key and value of each member, with this bound to the containing
|
||||||
|
<span class='line'> 56</span> object. The value that is returned from your method will be
|
||||||
|
<span class='line'> 57</span> serialized. If your method returns undefined, then the member will
|
||||||
|
<span class='line'> 58</span> be excluded from the serialization.
|
||||||
|
<span class='line'> 59</span>
|
||||||
|
<span class='line'> 60</span> If the replacer parameter is an array of strings, then it will be
|
||||||
|
<span class='line'> 61</span> used to select the members to be serialized. It filters the results
|
||||||
|
<span class='line'> 62</span> such that only members with keys listed in the replacer array are
|
||||||
|
<span class='line'> 63</span> stringified.
|
||||||
|
<span class='line'> 64</span>
|
||||||
|
<span class='line'> 65</span> Values that do not have JSON representations, such as undefined or
|
||||||
|
<span class='line'> 66</span> functions, will not be serialized. Such values in objects will be
|
||||||
|
<span class='line'> 67</span> dropped; in arrays they will be replaced with null. You can use
|
||||||
|
<span class='line'> 68</span> a replacer function to replace those with JSON values.
|
||||||
|
<span class='line'> 69</span> JSON.stringify(undefined) returns undefined.
|
||||||
|
<span class='line'> 70</span>
|
||||||
|
<span class='line'> 71</span> The optional space parameter produces a stringification of the
|
||||||
|
<span class='line'> 72</span> value that is filled with line breaks and indentation to make it
|
||||||
|
<span class='line'> 73</span> easier to read.
|
||||||
|
<span class='line'> 74</span>
|
||||||
|
<span class='line'> 75</span> If the space parameter is a non-empty string, then that string will
|
||||||
|
<span class='line'> 76</span> be used for indentation. If the space parameter is a number, then
|
||||||
|
<span class='line'> 77</span> the indentation will be that many spaces.
|
||||||
|
<span class='line'> 78</span>
|
||||||
|
<span class='line'> 79</span> Example:
|
||||||
|
<span class='line'> 80</span>
|
||||||
|
<span class='line'> 81</span> text = JSON.stringify(['e', {pluribus: 'unum'}]);
|
||||||
|
<span class='line'> 82</span> // text is '["e",{"pluribus":"unum"}]'
|
||||||
|
<span class='line'> 83</span>
|
||||||
|
<span class='line'> 84</span>
|
||||||
|
<span class='line'> 85</span> text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
|
||||||
|
<span class='line'> 86</span> // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
|
||||||
|
<span class='line'> 87</span>
|
||||||
|
<span class='line'> 88</span> text = JSON.stringify([new Date()], function (key, value) {
|
||||||
|
<span class='line'> 89</span> return this[key] instanceof Date ?
|
||||||
|
<span class='line'> 90</span> 'Date(' + this[key] + ')' : value;
|
||||||
|
<span class='line'> 91</span> });
|
||||||
|
<span class='line'> 92</span> // text is '["Date(---current time---)"]'
|
||||||
|
<span class='line'> 93</span>
|
||||||
|
<span class='line'> 94</span>
|
||||||
|
<span class='line'> 95</span> JSON.parse(text, reviver)
|
||||||
|
<span class='line'> 96</span> This method parses a JSON text to produce an object or array.
|
||||||
|
<span class='line'> 97</span> It can throw a SyntaxError exception.
|
||||||
|
<span class='line'> 98</span>
|
||||||
|
<span class='line'> 99</span> The optional reviver parameter is a function that can filter and
|
||||||
|
<span class='line'>100</span> transform the results. It receives each of the keys and values,
|
||||||
|
<span class='line'>101</span> and its return value is used instead of the original value.
|
||||||
|
<span class='line'>102</span> If it returns what it received, then the structure is not modified.
|
||||||
|
<span class='line'>103</span> If it returns undefined then the member is deleted.
|
||||||
|
<span class='line'>104</span>
|
||||||
|
<span class='line'>105</span> Example:
|
||||||
|
<span class='line'>106</span>
|
||||||
|
<span class='line'>107</span> // Parse the text. Values that look like ISO date strings will
|
||||||
|
<span class='line'>108</span> // be converted to Date objects.
|
||||||
|
<span class='line'>109</span>
|
||||||
|
<span class='line'>110</span> myData = JSON.parse(text, function (key, value) {
|
||||||
|
<span class='line'>111</span> var a;
|
||||||
|
<span class='line'>112</span> if (typeof value === 'string') {
|
||||||
|
<span class='line'>113</span> a =
|
||||||
|
<span class='line'>114</span> /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
|
||||||
|
<span class='line'>115</span> if (a) {
|
||||||
|
<span class='line'>116</span> return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
|
||||||
|
<span class='line'>117</span> +a[5], +a[6]));
|
||||||
|
<span class='line'>118</span> }
|
||||||
|
<span class='line'>119</span> }
|
||||||
|
<span class='line'>120</span> return value;
|
||||||
|
<span class='line'>121</span> });
|
||||||
|
<span class='line'>122</span>
|
||||||
|
<span class='line'>123</span> myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
|
||||||
|
<span class='line'>124</span> var d;
|
||||||
|
<span class='line'>125</span> if (typeof value === 'string' &&
|
||||||
|
<span class='line'>126</span> value.slice(0, 5) === 'Date(' &&
|
||||||
|
<span class='line'>127</span> value.slice(-1) === ')') {
|
||||||
|
<span class='line'>128</span> d = new Date(value.slice(5, -1));
|
||||||
|
<span class='line'>129</span> if (d) {
|
||||||
|
<span class='line'>130</span> return d;
|
||||||
|
<span class='line'>131</span> }
|
||||||
|
<span class='line'>132</span> }
|
||||||
|
<span class='line'>133</span> return value;
|
||||||
|
<span class='line'>134</span> });
|
||||||
|
<span class='line'>135</span>
|
||||||
|
<span class='line'>136</span>
|
||||||
|
<span class='line'>137</span> This is a reference implementation. You are free to copy, modify, or
|
||||||
|
<span class='line'>138</span> redistribute.
|
||||||
|
<span class='line'>139</span>
|
||||||
|
<span class='line'>140</span> This code should be minified before deployment.
|
||||||
|
<span class='line'>141</span> See http://javascript.crockford.com/jsmin.html
|
||||||
|
<span class='line'>142</span>
|
||||||
|
<span class='line'>143</span> USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
|
||||||
|
<span class='line'>144</span> NOT CONTROL.
|
||||||
|
<span class='line'>145</span> */</span><span class="WHIT">
|
||||||
|
<span class='line'>146</span>
|
||||||
|
<span class='line'>147</span> </span><span class="COMM">/*jslint evil: true */</span><span class="WHIT">
|
||||||
|
<span class='line'>148</span>
|
||||||
|
<span class='line'>149</span> </span><span class="COMM">/*global JSON */</span><span class="WHIT">
|
||||||
|
<span class='line'>150</span>
|
||||||
|
<span class='line'>151</span> </span><span class="COMM">/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
|
||||||
|
<span class='line'>152</span> call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
|
||||||
|
<span class='line'>153</span> getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
|
||||||
|
<span class='line'>154</span> lastIndex, length, parse, prototype, push, replace, slice, stringify,
|
||||||
|
<span class='line'>155</span> test, toJSON, toString, valueOf
|
||||||
|
<span class='line'>156</span> */</span><span class="WHIT">
|
||||||
|
<span class='line'>157</span>
|
||||||
|
<span class='line'>158</span> </span><span class="COMM">// Create a JSON object only if one does not already exist. We create the</span><span class="WHIT">
|
||||||
|
<span class='line'>159</span> </span><span class="COMM">// methods in a closure to avoid creating global variables.</span><span class="WHIT">
|
||||||
|
<span class='line'>160</span>
|
||||||
|
<span class='line'>161</span> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">this.JSON</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>162</span> </span><span class="WHIT"> </span><span class="NAME">JSON</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>163</span> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>164</span> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>165</span>
|
||||||
|
<span class='line'>166</span> </span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>167</span> </span><span class="WHIT"> </span><span class="COMM">// Format integers to have at least two digits.</span><span class="WHIT">
|
||||||
|
<span class='line'>168</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NUMB">10</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'0'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>169</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>170</span>
|
||||||
|
<span class='line'>171</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">Date.prototype.toJSON</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>172</span>
|
||||||
|
<span class='line'>173</span> </span><span class="WHIT"> </span><span class="NAME">Date.prototype.toJSON</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>174</span>
|
||||||
|
<span class='line'>175</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.getUTCFullYear</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'-'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
|
||||||
|
<span class='line'>176</span> </span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">this.getUTCMonth</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'-'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
|
||||||
|
<span class='line'>177</span> </span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">this.getUTCDate</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'T'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
|
||||||
|
<span class='line'>178</span> </span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">this.getUTCHours</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">':'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
|
||||||
|
<span class='line'>179</span> </span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">this.getUTCMinutes</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">':'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
|
||||||
|
<span class='line'>180</span> </span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">this.getUTCSeconds</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'Z'</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>181</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>182</span>
|
||||||
|
<span class='line'>183</span> </span><span class="WHIT"> </span><span class="NAME">String.prototype.toJSON</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT">
|
||||||
|
<span class='line'>184</span> </span><span class="WHIT"> </span><span class="NAME">Number.prototype.toJSON</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT">
|
||||||
|
<span class='line'>185</span> </span><span class="WHIT"> </span><span class="NAME">Boolean.prototype.toJSON</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>186</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.valueOf</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>187</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>188</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>189</span>
|
||||||
|
<span class='line'>190</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">cx</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="REGX">/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
|
<span class='line'>191</span> </span><span class="WHIT"> </span><span class="NAME">escapable</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="REGX">/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
|
<span class='line'>192</span> </span><span class="WHIT"> </span><span class="NAME">gap</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
|
<span class='line'>193</span> </span><span class="WHIT"> </span><span class="NAME">indent</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
|
<span class='line'>194</span> </span><span class="WHIT"> </span><span class="NAME">meta</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">// table of character substitutions</span><span class="WHIT">
|
||||||
|
<span class='line'>195</span> </span><span class="WHIT"> </span><span class="STRN">'\b'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'\\b'</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
|
<span class='line'>196</span> </span><span class="WHIT"> </span><span class="STRN">'\t'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'\\t'</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
|
<span class='line'>197</span> </span><span class="WHIT"> </span><span class="STRN">'\n'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'\\n'</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
|
<span class='line'>198</span> </span><span class="WHIT"> </span><span class="STRN">'\f'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'\\f'</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
|
<span class='line'>199</span> </span><span class="WHIT"> </span><span class="STRN">'\r'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'\\r'</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
|
<span class='line'>200</span> </span><span class="WHIT"> </span><span class="STRN">'"'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'\\"'</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
|
<span class='line'>201</span> </span><span class="WHIT"> </span><span class="STRN">'\\'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'\\\\'</span><span class="WHIT">
|
||||||
|
<span class='line'>202</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
|
<span class='line'>203</span> </span><span class="WHIT"> </span><span class="NAME">rep</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>204</span>
|
||||||
|
<span class='line'>205</span>
|
||||||
|
<span class='line'>206</span> </span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">quote</span><span class="PUNC">(</span><span class="NAME">string</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>207</span>
|
||||||
|
<span class='line'>208</span> </span><span class="COMM">// If the string contains no control characters, no quote characters, and no</span><span class="WHIT">
|
||||||
|
<span class='line'>209</span> </span><span class="COMM">// backslash characters, then we can safely slap some quotes around it.</span><span class="WHIT">
|
||||||
|
<span class='line'>210</span> </span><span class="COMM">// Otherwise we must also replace the offending characters with safe escape</span><span class="WHIT">
|
||||||
|
<span class='line'>211</span> </span><span class="COMM">// sequences.</span><span class="WHIT">
|
||||||
|
<span class='line'>212</span>
|
||||||
|
<span class='line'>213</span> </span><span class="WHIT"> </span><span class="NAME">escapable.lastIndex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>214</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">escapable.test</span><span class="PUNC">(</span><span class="NAME">string</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT">
|
||||||
|
<span class='line'>215</span> </span><span class="WHIT"> </span><span class="STRN">'"'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">string.replace</span><span class="PUNC">(</span><span class="NAME">escapable</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>216</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">c</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">meta</span><span class="PUNC">[</span><span class="NAME">a</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>217</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">c</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">c</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT">
|
||||||
|
<span class='line'>218</span> </span><span class="WHIT"> </span><span class="STRN">'\\u'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="STRN">'0000'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">a.charCodeAt</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">toString</span><span class="PUNC">(</span><span class="NUMB">16</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">slice</span><span class="PUNC">(</span><span class="PUNC">-</span><span class="NUMB">4</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>219</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'"'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT">
|
||||||
|
<span class='line'>220</span> </span><span class="WHIT"> </span><span class="STRN">'"'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">string</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'"'</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>221</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>222</span>
|
||||||
|
<span class='line'>223</span>
|
||||||
|
<span class='line'>224</span> </span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">str</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">holder</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>225</span>
|
||||||
|
<span class='line'>226</span> </span><span class="COMM">// Produce a string from holder[key].</span><span class="WHIT">
|
||||||
|
<span class='line'>227</span>
|
||||||
|
<span class='line'>228</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">// The loop counter.</span><span class="WHIT">
|
||||||
|
<span class='line'>229</span> </span><span class="WHIT"> </span><span class="NAME">k</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">// The member key.</span><span class="WHIT">
|
||||||
|
<span class='line'>230</span> </span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">// The member value.</span><span class="WHIT">
|
||||||
|
<span class='line'>231</span> </span><span class="WHIT"> </span><span class="NAME">length</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
|
<span class='line'>232</span> </span><span class="WHIT"> </span><span class="NAME">mind</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">gap</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
|
<span class='line'>233</span> </span><span class="WHIT"> </span><span class="NAME">partial</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
|
<span class='line'>234</span> </span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">holder</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>235</span>
|
||||||
|
<span class='line'>236</span> </span><span class="COMM">// If the value has a toJSON method, call it to obtain a replacement value.</span><span class="WHIT">
|
||||||
|
<span class='line'>237</span>
|
||||||
|
<span class='line'>238</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
|
||||||
|
<span class='line'>239</span> </span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value.toJSON</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>240</span> </span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">value.toJSON</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>241</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>242</span>
|
||||||
|
<span class='line'>243</span> </span><span class="COMM">// If we were called with a replacer function, then call the replacer to</span><span class="WHIT">
|
||||||
|
<span class='line'>244</span> </span><span class="COMM">// obtain a replacement value.</span><span class="WHIT">
|
||||||
|
<span class='line'>245</span>
|
||||||
|
<span class='line'>246</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">rep</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>247</span> </span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">rep.call</span><span class="PUNC">(</span><span class="NAME">holder</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>248</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>249</span>
|
||||||
|
<span class='line'>250</span> </span><span class="COMM">// What happens next depends on the value's type.</span><span class="WHIT">
|
||||||
|
<span class='line'>251</span>
|
||||||
|
<span class='line'>252</span> </span><span class="WHIT"> </span><span class="KEYW">switch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>253</span> </span><span class="WHIT"> </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">:</span><span class="WHIT">
|
||||||
|
<span class='line'>254</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">quote</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>255</span>
|
||||||
|
<span class='line'>256</span> </span><span class="WHIT"> </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">'number'</span><span class="PUNC">:</span><span class="WHIT">
|
||||||
|
<span class='line'>257</span>
|
||||||
|
<span class='line'>258</span> </span><span class="COMM">// JSON numbers must be finite. Encode non-finite numbers as null.</span><span class="WHIT">
|
||||||
|
<span class='line'>259</span>
|
||||||
|
<span class='line'>260</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">isFinite</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">String</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'null'</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>261</span>
|
||||||
|
<span class='line'>262</span> </span><span class="WHIT"> </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">'boolean'</span><span class="PUNC">:</span><span class="WHIT">
|
||||||
|
<span class='line'>263</span> </span><span class="WHIT"> </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">'null'</span><span class="PUNC">:</span><span class="WHIT">
|
||||||
|
<span class='line'>264</span>
|
||||||
|
<span class='line'>265</span> </span><span class="COMM">// If the value is a boolean or null, convert it to a string. Note:</span><span class="WHIT">
|
||||||
|
<span class='line'>266</span> </span><span class="COMM">// typeof null does not produce 'null'. The case is included here in</span><span class="WHIT">
|
||||||
|
<span class='line'>267</span> </span><span class="COMM">// the remote chance that this gets fixed someday.</span><span class="WHIT">
|
||||||
|
<span class='line'>268</span>
|
||||||
|
<span class='line'>269</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">String</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>270</span>
|
||||||
|
<span class='line'>271</span> </span><span class="COMM">// If the type is 'object', we might be dealing with an object or an array or</span><span class="WHIT">
|
||||||
|
<span class='line'>272</span> </span><span class="COMM">// null.</span><span class="WHIT">
|
||||||
|
<span class='line'>273</span>
|
||||||
|
<span class='line'>274</span> </span><span class="WHIT"> </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="PUNC">:</span><span class="WHIT">
|
||||||
|
<span class='line'>275</span>
|
||||||
|
<span class='line'>276</span> </span><span class="COMM">// Due to a specification blunder in ECMAScript, typeof null is 'object',</span><span class="WHIT">
|
||||||
|
<span class='line'>277</span> </span><span class="COMM">// so watch out for that case.</span><span class="WHIT">
|
||||||
|
<span class='line'>278</span>
|
||||||
|
<span class='line'>279</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>280</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="STRN">'null'</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>281</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>282</span>
|
||||||
|
<span class='line'>283</span> </span><span class="COMM">// Make an array to hold the partial results of stringifying this object value.</span><span class="WHIT">
|
||||||
|
<span class='line'>284</span>
|
||||||
|
<span class='line'>285</span> </span><span class="WHIT"> </span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">indent</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>286</span> </span><span class="WHIT"> </span><span class="NAME">partial</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>287</span>
|
||||||
|
<span class='line'>288</span> </span><span class="COMM">// Is the value an array?</span><span class="WHIT">
|
||||||
|
<span class='line'>289</span>
|
||||||
|
<span class='line'>290</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">Object.prototype.toString.apply</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'[object Array]'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>291</span>
|
||||||
|
<span class='line'>292</span> </span><span class="COMM">// The value is an array. Stringify every element. Use null as a placeholder</span><span class="WHIT">
|
||||||
|
<span class='line'>293</span> </span><span class="COMM">// for non-JSON values.</span><span class="WHIT">
|
||||||
|
<span class='line'>294</span>
|
||||||
|
<span class='line'>295</span> </span><span class="WHIT"> </span><span class="NAME">length</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">value.length</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>296</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>297</span> </span><span class="WHIT"> </span><span class="NAME">partial</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">str</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">'null'</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>298</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>299</span>
|
||||||
|
<span class='line'>300</span> </span><span class="COMM">// Join all of the elements together, separated with commas, and wrap them in</span><span class="WHIT">
|
||||||
|
<span class='line'>301</span> </span><span class="COMM">// brackets.</span><span class="WHIT">
|
||||||
|
<span class='line'>302</span>
|
||||||
|
<span class='line'>303</span> </span><span class="WHIT"> </span><span class="NAME">v</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">partial.length</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'[]'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT">
|
||||||
|
<span class='line'>304</span> </span><span class="WHIT"> </span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'[\n'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
|
||||||
|
<span class='line'>305</span> </span><span class="WHIT"> </span><span class="NAME">partial.join</span><span class="PUNC">(</span><span class="STRN">',\n'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">gap</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'\n'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
|
||||||
|
<span class='line'>306</span> </span><span class="WHIT"> </span><span class="NAME">mind</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">']'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT">
|
||||||
|
<span class='line'>307</span> </span><span class="WHIT"> </span><span class="STRN">'['</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">partial.join</span><span class="PUNC">(</span><span class="STRN">','</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">']'</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>308</span> </span><span class="WHIT"> </span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">mind</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>309</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>310</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>311</span>
|
||||||
|
<span class='line'>312</span> </span><span class="COMM">// If the replacer is an array, use it to select the members to be stringified.</span><span class="WHIT">
|
||||||
|
<span class='line'>313</span>
|
||||||
|
<span class='line'>314</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">rep</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">rep</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>315</span> </span><span class="WHIT"> </span><span class="NAME">length</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">rep.length</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>316</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>317</span> </span><span class="WHIT"> </span><span class="NAME">k</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">rep</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>318</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">k</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>319</span> </span><span class="WHIT"> </span><span class="NAME">v</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">str</span><span class="PUNC">(</span><span class="NAME">k</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>320</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">v</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>321</span> </span><span class="WHIT"> </span><span class="NAME">partial.push</span><span class="PUNC">(</span><span class="NAME">quote</span><span class="PUNC">(</span><span class="NAME">k</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">': '</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">':'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>322</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>323</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>324</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>325</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>326</span>
|
||||||
|
<span class='line'>327</span> </span><span class="COMM">// Otherwise, iterate through all of the keys in the object.</span><span class="WHIT">
|
||||||
|
<span class='line'>328</span>
|
||||||
|
<span class='line'>329</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">k</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>330</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">Object.hasOwnProperty.call</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">k</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>331</span> </span><span class="WHIT"> </span><span class="NAME">v</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">str</span><span class="PUNC">(</span><span class="NAME">k</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>332</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">v</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>333</span> </span><span class="WHIT"> </span><span class="NAME">partial.push</span><span class="PUNC">(</span><span class="NAME">quote</span><span class="PUNC">(</span><span class="NAME">k</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">': '</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">':'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>334</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>335</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>336</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>337</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>338</span>
|
||||||
|
<span class='line'>339</span> </span><span class="COMM">// Join all of the member texts together, separated with commas,</span><span class="WHIT">
|
||||||
|
<span class='line'>340</span> </span><span class="COMM">// and wrap them in braces.</span><span class="WHIT">
|
||||||
|
<span class='line'>341</span>
|
||||||
|
<span class='line'>342</span> </span><span class="WHIT"> </span><span class="NAME">v</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">partial.length</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'{}'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT">
|
||||||
|
<span class='line'>343</span> </span><span class="WHIT"> </span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'{\n'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">partial.join</span><span class="PUNC">(</span><span class="STRN">',\n'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">gap</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'\n'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
|
||||||
|
<span class='line'>344</span> </span><span class="WHIT"> </span><span class="NAME">mind</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'}'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'{'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">partial.join</span><span class="PUNC">(</span><span class="STRN">','</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'}'</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>345</span> </span><span class="WHIT"> </span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">mind</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>346</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>347</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>348</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>349</span>
|
||||||
|
<span class='line'>350</span> </span><span class="COMM">// If the JSON object does not yet have a stringify method, give it one.</span><span class="WHIT">
|
||||||
|
<span class='line'>351</span>
|
||||||
|
<span class='line'>352</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">JSON.stringify</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>353</span> </span><span class="WHIT"> </span><span class="NAME">JSON.stringify</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">replacer</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">space</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>354</span>
|
||||||
|
<span class='line'>355</span> </span><span class="COMM">// The stringify method takes a value and an optional replacer, and an optional</span><span class="WHIT">
|
||||||
|
<span class='line'>356</span> </span><span class="COMM">// space parameter, and returns a JSON text. The replacer can be a function</span><span class="WHIT">
|
||||||
|
<span class='line'>357</span> </span><span class="COMM">// that can replace values, or an array of strings that will select the keys.</span><span class="WHIT">
|
||||||
|
<span class='line'>358</span> </span><span class="COMM">// A default replacer method can be provided. Use of the space parameter can</span><span class="WHIT">
|
||||||
|
<span class='line'>359</span> </span><span class="COMM">// produce text that is more easily readable.</span><span class="WHIT">
|
||||||
|
<span class='line'>360</span>
|
||||||
|
<span class='line'>361</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>362</span> </span><span class="WHIT"> </span><span class="NAME">gap</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>363</span> </span><span class="WHIT"> </span><span class="NAME">indent</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>364</span>
|
||||||
|
<span class='line'>365</span> </span><span class="COMM">// If the space parameter is a number, make an indent string containing that</span><span class="WHIT">
|
||||||
|
<span class='line'>366</span> </span><span class="COMM">// many spaces.</span><span class="WHIT">
|
||||||
|
<span class='line'>367</span>
|
||||||
|
<span class='line'>368</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">space</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'number'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>369</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">space</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>370</span> </span><span class="WHIT"> </span><span class="NAME">indent</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">' '</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>371</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>372</span>
|
||||||
|
<span class='line'>373</span> </span><span class="COMM">// If the space parameter is a string, it will be used as the indent string.</span><span class="WHIT">
|
||||||
|
<span class='line'>374</span>
|
||||||
|
<span class='line'>375</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">space</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>376</span> </span><span class="WHIT"> </span><span class="NAME">indent</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">space</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>377</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>378</span>
|
||||||
|
<span class='line'>379</span> </span><span class="COMM">// If there is a replacer, it must be a function or an array.</span><span class="WHIT">
|
||||||
|
<span class='line'>380</span> </span><span class="COMM">// Otherwise, throw an error.</span><span class="WHIT">
|
||||||
|
<span class='line'>381</span>
|
||||||
|
<span class='line'>382</span> </span><span class="WHIT"> </span><span class="NAME">rep</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">replacer</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>383</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">replacer</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">replacer</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
|
||||||
|
<span class='line'>384</span> </span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">replacer</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT">
|
||||||
|
<span class='line'>385</span> </span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">replacer.length</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">'number'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>386</span> </span><span class="WHIT"> </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="STRN">'JSON.stringify'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>387</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>388</span>
|
||||||
|
<span class='line'>389</span> </span><span class="COMM">// Make a fake root object containing our value under the key of ''.</span><span class="WHIT">
|
||||||
|
<span class='line'>390</span> </span><span class="COMM">// Return the result of stringifying the value.</span><span class="WHIT">
|
||||||
|
<span class='line'>391</span>
|
||||||
|
<span class='line'>392</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">str</span><span class="PUNC">(</span><span class="STRN">''</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="STRN">''</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>393</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>394</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>395</span>
|
||||||
|
<span class='line'>396</span>
|
||||||
|
<span class='line'>397</span> </span><span class="COMM">// If the JSON object does not yet have a parse method, give it one.</span><span class="WHIT">
|
||||||
|
<span class='line'>398</span>
|
||||||
|
<span class='line'>399</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">JSON.parse</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>400</span> </span><span class="WHIT"> </span><span class="NAME">JSON.parse</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">text</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">reviver</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>401</span>
|
||||||
|
<span class='line'>402</span> </span><span class="COMM">// The parse method takes a text and an optional reviver function, and returns</span><span class="WHIT">
|
||||||
|
<span class='line'>403</span> </span><span class="COMM">// a JavaScript value if the text is a valid JSON text.</span><span class="WHIT">
|
||||||
|
<span class='line'>404</span>
|
||||||
|
<span class='line'>405</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>406</span>
|
||||||
|
<span class='line'>407</span> </span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">walk</span><span class="PUNC">(</span><span class="NAME">holder</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>408</span>
|
||||||
|
<span class='line'>409</span> </span><span class="COMM">// The walk method is used to recursively walk the resulting structure so</span><span class="WHIT">
|
||||||
|
<span class='line'>410</span> </span><span class="COMM">// that modifications can be made.</span><span class="WHIT">
|
||||||
|
<span class='line'>411</span>
|
||||||
|
<span class='line'>412</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">k</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">holder</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>413</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>414</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">k</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>415</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">Object.hasOwnProperty.call</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">k</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>416</span> </span><span class="WHIT"> </span><span class="NAME">v</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">walk</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">k</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>417</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">v</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>418</span> </span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">[</span><span class="NAME">k</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>419</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>420</span> </span><span class="WHIT"> </span><span class="KEYW">delete</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">[</span><span class="NAME">k</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>421</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>422</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>423</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>424</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>425</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">reviver.call</span><span class="PUNC">(</span><span class="NAME">holder</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>426</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>427</span>
|
||||||
|
<span class='line'>428</span>
|
||||||
|
<span class='line'>429</span> </span><span class="COMM">// Parsing happens in four stages. In the first stage, we replace certain</span><span class="WHIT">
|
||||||
|
<span class='line'>430</span> </span><span class="COMM">// Unicode characters with escape sequences. JavaScript handles many characters</span><span class="WHIT">
|
||||||
|
<span class='line'>431</span> </span><span class="COMM">// incorrectly, either silently deleting them, or treating them as line endings.</span><span class="WHIT">
|
||||||
|
<span class='line'>432</span>
|
||||||
|
<span class='line'>433</span> </span><span class="WHIT"> </span><span class="NAME">cx.lastIndex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>434</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">cx.test</span><span class="PUNC">(</span><span class="NAME">text</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>435</span> </span><span class="WHIT"> </span><span class="NAME">text</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">text.replace</span><span class="PUNC">(</span><span class="NAME">cx</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>436</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="STRN">'\\u'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
|
||||||
|
<span class='line'>437</span> </span><span class="WHIT"> </span><span class="PUNC">(</span><span class="STRN">'0000'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">a.charCodeAt</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">toString</span><span class="PUNC">(</span><span class="NUMB">16</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">slice</span><span class="PUNC">(</span><span class="PUNC">-</span><span class="NUMB">4</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>438</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>439</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>440</span>
|
||||||
|
<span class='line'>441</span> </span><span class="COMM">// In the second stage, we run the text against regular expressions that look</span><span class="WHIT">
|
||||||
|
<span class='line'>442</span> </span><span class="COMM">// for non-JSON patterns. We are especially concerned with '()' and 'new'</span><span class="WHIT">
|
||||||
|
<span class='line'>443</span> </span><span class="COMM">// because they can cause invocation, and '=' because it can cause mutation.</span><span class="WHIT">
|
||||||
|
<span class='line'>444</span> </span><span class="COMM">// But just to be safe, we want to reject all unexpected forms.</span><span class="WHIT">
|
||||||
|
<span class='line'>445</span>
|
||||||
|
<span class='line'>446</span> </span><span class="COMM">// We split the second stage into 4 regexp operations in order to work around</span><span class="WHIT">
|
||||||
|
<span class='line'>447</span> </span><span class="COMM">// crippling inefficiencies in IE's and Safari's regexp engines. First we</span><span class="WHIT">
|
||||||
|
<span class='line'>448</span> </span><span class="COMM">// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we</span><span class="WHIT">
|
||||||
|
<span class='line'>449</span> </span><span class="COMM">// replace all simple value tokens with ']' characters. Third, we delete all</span><span class="WHIT">
|
||||||
|
<span class='line'>450</span> </span><span class="COMM">// open brackets that follow a colon or comma or that begin the text. Finally,</span><span class="WHIT">
|
||||||
|
<span class='line'>451</span> </span><span class="COMM">// we look to see that the remaining characters are only whitespace or ']' or</span><span class="WHIT">
|
||||||
|
<span class='line'>452</span> </span><span class="COMM">// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.</span><span class="WHIT">
|
||||||
|
<span class='line'>453</span>
|
||||||
|
<span class='line'>454</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="REGX">/^[\],:{}\s]*$/</span><span class="PUNC">.</span><span class="WHIT">
|
||||||
|
<span class='line'>455</span> </span><span class="NAME">test</span><span class="PUNC">(</span><span class="NAME">text.replace</span><span class="PUNC">(</span><span class="REGX">/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'@'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="WHIT">
|
||||||
|
<span class='line'>456</span> </span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">']'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="WHIT">
|
||||||
|
<span class='line'>457</span> </span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/(?:^|:|,)(?:\s*\[)+/g</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>458</span>
|
||||||
|
<span class='line'>459</span> </span><span class="COMM">// In the third stage we use the eval function to compile the text into a</span><span class="WHIT">
|
||||||
|
<span class='line'>460</span> </span><span class="COMM">// JavaScript structure. The '{' operator is subject to a syntactic ambiguity</span><span class="WHIT">
|
||||||
|
<span class='line'>461</span> </span><span class="COMM">// in JavaScript: it can begin a block or an object literal. We wrap the text</span><span class="WHIT">
|
||||||
|
<span class='line'>462</span> </span><span class="COMM">// in parens to eliminate the ambiguity.</span><span class="WHIT">
|
||||||
|
<span class='line'>463</span>
|
||||||
|
<span class='line'>464</span> </span><span class="WHIT"> </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">eval</span><span class="PUNC">(</span><span class="STRN">'('</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">text</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">')'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>465</span>
|
||||||
|
<span class='line'>466</span> </span><span class="COMM">// In the optional fourth stage, we recursively walk the new structure, passing</span><span class="WHIT">
|
||||||
|
<span class='line'>467</span> </span><span class="COMM">// each name/value pair to a reviver function for possible transformation.</span><span class="WHIT">
|
||||||
|
<span class='line'>468</span>
|
||||||
|
<span class='line'>469</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">reviver</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT">
|
||||||
|
<span class='line'>470</span> </span><span class="WHIT"> </span><span class="NAME">walk</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="STRN">''</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>471</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>472</span>
|
||||||
|
<span class='line'>473</span> </span><span class="COMM">// If the text is not JSON parseable, then a SyntaxError is thrown.</span><span class="WHIT">
|
||||||
|
<span class='line'>474</span>
|
||||||
|
<span class='line'>475</span> </span><span class="WHIT"> </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">SyntaxError</span><span class="PUNC">(</span><span class="STRN">'JSON.parse'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>476</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>477</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>478</span> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>479</span> </span></pre></body></html>
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Jasmine Test Runner</title>
|
||||||
|
</head>
|
||||||
|
<script type="text/javascript" src="../../lib/jasmine-0.9.0.js"></script>
|
||||||
|
<script type="text/javascript" src="../../lib/TrivialReporter.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="../../lib/jasmine.css">
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
jasmine.include('spec/example_suite.js', true);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var jasmineEnv = jasmine.getEnv();
|
||||||
|
jasmineEnv.reporter = new jasmine.TrivialReporter();
|
||||||
|
jasmineEnv.execute();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
describe('ExampleSuite', function () {
|
||||||
|
it('should have a passing test', function() {
|
||||||
|
expect(true).toEqual(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Nested Describe', function () {
|
||||||
|
it('should also have a passing test', function () {
|
||||||
|
expect(true).toEqual(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
require File.expand_path(File.join(File.dirname(__FILE__), "spec/jasmine_helper.rb"))
|
||||||
|
|
||||||
|
namespace :test do
|
||||||
|
desc "Run continuous integration tests"
|
||||||
|
require "spec"
|
||||||
|
require 'spec/rake/spectask'
|
||||||
|
|
||||||
|
Spec::Rake::SpecTask.new(:ci) do |t|
|
||||||
|
t.spec_opts = ["--color", "--format", "specdoc"]
|
||||||
|
t.spec_files = ["spec/jasmine_spec.rb"]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Run specs via server"
|
||||||
|
task :jasmine_server do
|
||||||
|
require File.expand_path(File.join(JasmineHelper.jasmine_root, "contrib/ruby/jasmine_spec_builder"))
|
||||||
|
|
||||||
|
puts "your tests are here:"
|
||||||
|
puts " http://localhost:8888/run.html"
|
||||||
|
|
||||||
|
Jasmine::SimpleServer.start(8888,
|
||||||
|
lambda { JasmineHelper.spec_file_urls },
|
||||||
|
JasmineHelper.dir_mappings)
|
||||||
|
end
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
describe('ExampleSuite', function () {
|
||||||
|
it('should have a passing test', function() {
|
||||||
|
expect(true).toEqual(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Nested Describe', function () {
|
||||||
|
it('should also have a passing test', function () {
|
||||||
|
expect(true).toEqual(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
class JasmineHelper
|
||||||
|
def self.jasmine_lib_dir
|
||||||
|
File.expand_path(File.join(jasmine_root, 'lib'))
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.jasmine_root
|
||||||
|
File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..'))
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.jasmine
|
||||||
|
['/lib/' + File.basename(Dir.glob("#{JasmineHelper.jasmine_lib_dir}/jasmine*.js").first)] +
|
||||||
|
['/lib/json2.js',
|
||||||
|
'/lib/TrivialReporter.js']
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.jasmine_src_dir
|
||||||
|
File.expand_path(File.join(jasmine_root, 'src'))
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.jasmine_spec_dir
|
||||||
|
File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec'))
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.raw_spec_files
|
||||||
|
Dir.glob(File.join(jasmine_spec_dir, "**/*[Ss]pec.js"))
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.spec_file_urls
|
||||||
|
raw_spec_files.collect {|f| f.sub(jasmine_spec_dir, "/spec")}
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.dir_mappings
|
||||||
|
{
|
||||||
|
"/src" => jasmine_src_dir,
|
||||||
|
"/spec" => jasmine_spec_dir,
|
||||||
|
"/lib" => jasmine_lib_dir
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
require 'rubygems'
|
||||||
|
require "selenium_rc"
|
||||||
|
require File.expand_path(File.join(File.dirname(__FILE__), "jasmine_helper.rb"))
|
||||||
|
require File.expand_path(File.join(JasmineHelper.jasmine_root, "contrib/ruby/jasmine_spec_builder"))
|
||||||
|
|
||||||
|
jasmine_runner = Jasmine::Runner.new(SeleniumRC::Server.new.jar_path,
|
||||||
|
JasmineHelper.spec_file_urls,
|
||||||
|
JasmineHelper.dir_mappings)
|
||||||
|
|
||||||
|
spec_builder = Jasmine::SpecBuilder.new(JasmineHelper.raw_spec_files, jasmine_runner)
|
||||||
|
|
||||||
|
should_stop = false
|
||||||
|
|
||||||
|
Spec::Runner.configure do |config|
|
||||||
|
config.after(:suite) do
|
||||||
|
spec_builder.stop if should_stop
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
spec_builder.start
|
||||||
|
should_stop = true
|
||||||
|
spec_builder.declare_suites
|
||||||
|
After Width: | Height: | Size: 722 B |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 759 B |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 802 B |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 768 B |
|
After Width: | Height: | Size: 1.7 KiB |
@@ -0,0 +1,125 @@
|
|||||||
|
jasmine.TrivialReporter = function(doc) {
|
||||||
|
this.document = doc || document;
|
||||||
|
this.suiteDivs = {};
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarArgs) {
|
||||||
|
var el = document.createElement(type);
|
||||||
|
|
||||||
|
for (var i = 2; i < arguments.length; i++) {
|
||||||
|
var child = arguments[i];
|
||||||
|
|
||||||
|
if (typeof child === 'string') {
|
||||||
|
el.appendChild(document.createTextNode(child));
|
||||||
|
} else {
|
||||||
|
el.appendChild(child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var attr in attrs) {
|
||||||
|
if (attr == 'className') {
|
||||||
|
el.setAttribute('class', attrs[attr]);
|
||||||
|
} else {
|
||||||
|
el[attr] = attrs[attr];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return el;
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) {
|
||||||
|
var suites = runner.suites();
|
||||||
|
|
||||||
|
this.runnerDiv = this.createDom('div', { className: 'runner running' },
|
||||||
|
this.createDom('a', { className: 'runSpec', href: '?' }, "run all"),
|
||||||
|
this.runnerMessageSpan = this.createDom('span', {}, "Running..."));
|
||||||
|
this.document.body.appendChild(this.runnerDiv);
|
||||||
|
|
||||||
|
for (var i = 0; i < suites.length; i++) {
|
||||||
|
var suite = suites[i];
|
||||||
|
var suiteDiv = this.createDom('div', { className: 'suite' },
|
||||||
|
this.createDom('a', { className: 'runSpec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"),
|
||||||
|
suite.description);
|
||||||
|
this.suiteDivs[suite.getFullName()] = suiteDiv;
|
||||||
|
var parentDiv = this.document.body;
|
||||||
|
if (suite.parentSuite) {
|
||||||
|
parentDiv = this.suiteDivs[suite.parentSuite.getFullName()];
|
||||||
|
}
|
||||||
|
parentDiv.appendChild(suiteDiv);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.startedAt = new Date();
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) {
|
||||||
|
var results = runner.getResults();
|
||||||
|
var className = (results.failedCount > 0) ? "runner failed" : "runner passed";
|
||||||
|
this.runnerDiv.setAttribute("class", className);
|
||||||
|
var message = results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s");
|
||||||
|
message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s";
|
||||||
|
this.runnerMessageSpan.replaceChild(this.document.createTextNode(message), this.runnerMessageSpan.firstChild);
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) {
|
||||||
|
var results = suite.getResults();
|
||||||
|
var status = results.passed() ? 'passed' : 'failed';
|
||||||
|
if (results.totalCount == 0) { // todo: change this to check results.skipped
|
||||||
|
status = 'skipped';
|
||||||
|
}
|
||||||
|
this.suiteDivs[suite.getFullName()].className += " " + status;
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) {
|
||||||
|
var results = spec.getResults();
|
||||||
|
var status = results.passed() ? 'passed' : 'failed';
|
||||||
|
if (results.skipped) {
|
||||||
|
status = 'skipped';
|
||||||
|
}
|
||||||
|
var specDiv = this.createDom('div', { className: 'spec ' + status },
|
||||||
|
this.createDom('a', { className: 'runSpec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"),
|
||||||
|
spec.getFullName());
|
||||||
|
|
||||||
|
|
||||||
|
var resultItems = results.getItems();
|
||||||
|
for (var i = 0; i < resultItems.length; i++) {
|
||||||
|
var result = resultItems[i];
|
||||||
|
if (result.passed && !result.passed()) {
|
||||||
|
var resultMessageDiv = this.createDom('div', {className: 'resultMessage fail'});
|
||||||
|
resultMessageDiv.innerHTML = result.message; // todo: lame; mend
|
||||||
|
specDiv.appendChild(resultMessageDiv);
|
||||||
|
specDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.suiteDivs[spec.suite.getFullName()].appendChild(specDiv);
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.TrivialReporter.prototype.log = function() {
|
||||||
|
console.log.apply(console, arguments);
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.TrivialReporter.prototype.getLocation = function() {
|
||||||
|
return this.document.location;
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.TrivialReporter.prototype.specFilter = function(spec) {
|
||||||
|
var paramMap = {};
|
||||||
|
var params = this.getLocation().search.substring(1).split('&');
|
||||||
|
for (var i = 0; i < params.length; i++) {
|
||||||
|
var p = params[i].split('=');
|
||||||
|
paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!paramMap["spec"]) return true;
|
||||||
|
return spec.getFullName().indexOf(paramMap["spec"]) == 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
//protect against console.log incidents
|
||||||
|
if (!("console" in window) || !("firebug" in console)) {
|
||||||
|
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
|
||||||
|
window.console = {};
|
||||||
|
for (var i = 0, len = names.length; i < len; ++i) {
|
||||||
|
window.console[names[i]] = function() {
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
body {
|
||||||
|
font: 14px "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
padding-top: 20px;
|
||||||
|
font-weight: bold;
|
||||||
|
font: 24px; /* "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif; */
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin-top: 5px;
|
||||||
|
padding-left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fail {
|
||||||
|
background: url( ../images/fail-16.png ) no-repeat;
|
||||||
|
padding-left: 20px;
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
.failInSummary {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
.runner {
|
||||||
|
border: 1px outset gray;
|
||||||
|
margin: 5px;
|
||||||
|
padding-left: 1em;
|
||||||
|
padding-right: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.runner.running {
|
||||||
|
background-color: yellow;
|
||||||
|
}
|
||||||
|
|
||||||
|
.suite {
|
||||||
|
border: 1px outset gray;
|
||||||
|
margin: 5px;
|
||||||
|
padding-left: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.suite.passed {
|
||||||
|
background-color: #cfc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.suite.failed {
|
||||||
|
background-color: #fdd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spec {
|
||||||
|
margin: 5px;
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.passed {
|
||||||
|
background-color: lightgreen;
|
||||||
|
}
|
||||||
|
|
||||||
|
.failed {
|
||||||
|
background-color: pink;
|
||||||
|
}
|
||||||
|
|
||||||
|
.skipped {
|
||||||
|
color: #777;
|
||||||
|
background-color: #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.resultMessage {
|
||||||
|
white-space: pre;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stackTrace {
|
||||||
|
white-space: pre;
|
||||||
|
font-size: .8em;
|
||||||
|
margin-left: 10px;
|
||||||
|
height: 5em;
|
||||||
|
overflow: auto;
|
||||||
|
border: 1px inset red;
|
||||||
|
padding: 1em;
|
||||||
|
background: #eef;
|
||||||
|
}
|
||||||
|
|
||||||
|
.runSpec {
|
||||||
|
margin-left: 5px;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
#jasmine_content {
|
||||||
|
position:fixed;
|
||||||
|
left: 100%;
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
http://www.JSON.org/json2.js
|
http://www.JSON.org/json2.js
|
||||||
2009-08-17
|
2008-11-19
|
||||||
|
|
||||||
Public Domain.
|
Public Domain.
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
value represented by the name/value pair that should be serialized,
|
value represented by the name/value pair that should be serialized,
|
||||||
or undefined if nothing should be serialized. The toJSON method
|
or undefined if nothing should be serialized. The toJSON method
|
||||||
will be passed the key associated with the value, and this will be
|
will be passed the key associated with the value, and this will be
|
||||||
bound to the value
|
bound to the object holding the key.
|
||||||
|
|
||||||
For example, this would serialize Dates as ISO strings.
|
For example, this would serialize Dates as ISO strings.
|
||||||
|
|
||||||
@@ -146,6 +146,8 @@
|
|||||||
|
|
||||||
/*jslint evil: true */
|
/*jslint evil: true */
|
||||||
|
|
||||||
|
/*global JSON */
|
||||||
|
|
||||||
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
|
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
|
||||||
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
|
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
|
||||||
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
|
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
|
||||||
@@ -153,15 +155,12 @@
|
|||||||
test, toJSON, toString, valueOf
|
test, toJSON, toString, valueOf
|
||||||
*/
|
*/
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
// Create a JSON object only if one does not already exist. We create the
|
// Create a JSON object only if one does not already exist. We create the
|
||||||
// methods in a closure to avoid creating global variables.
|
// methods in a closure to avoid creating global variables.
|
||||||
|
|
||||||
if (!this.JSON) {
|
if (!this.JSON) {
|
||||||
this.JSON = {};
|
JSON = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
|
|
||||||
function f(n) {
|
function f(n) {
|
||||||
@@ -173,13 +172,12 @@ if (!this.JSON) {
|
|||||||
|
|
||||||
Date.prototype.toJSON = function (key) {
|
Date.prototype.toJSON = function (key) {
|
||||||
|
|
||||||
return isFinite(this.valueOf()) ?
|
return this.getUTCFullYear() + '-' +
|
||||||
this.getUTCFullYear() + '-' +
|
|
||||||
f(this.getUTCMonth() + 1) + '-' +
|
f(this.getUTCMonth() + 1) + '-' +
|
||||||
f(this.getUTCDate()) + 'T' +
|
f(this.getUTCDate()) + 'T' +
|
||||||
f(this.getUTCHours()) + ':' +
|
f(this.getUTCHours()) + ':' +
|
||||||
f(this.getUTCMinutes()) + ':' +
|
f(this.getUTCMinutes()) + ':' +
|
||||||
f(this.getUTCSeconds()) + 'Z' : null;
|
f(this.getUTCSeconds()) + 'Z';
|
||||||
};
|
};
|
||||||
|
|
||||||
String.prototype.toJSON =
|
String.prototype.toJSON =
|
||||||
@@ -224,6 +222,7 @@ if (!this.JSON) {
|
|||||||
|
|
||||||
|
|
||||||
function str(key, holder) {
|
function str(key, holder) {
|
||||||
|
|
||||||
// Produce a string from holder[key].
|
// Produce a string from holder[key].
|
||||||
|
|
||||||
var i, // The loop counter.
|
var i, // The loop counter.
|
||||||
@@ -352,6 +351,7 @@ if (!this.JSON) {
|
|||||||
|
|
||||||
if (typeof JSON.stringify !== 'function') {
|
if (typeof JSON.stringify !== 'function') {
|
||||||
JSON.stringify = function (value, replacer, space) {
|
JSON.stringify = function (value, replacer, space) {
|
||||||
|
|
||||||
// The stringify method takes a value and an optional replacer, and an optional
|
// The stringify method takes a value and an optional replacer, and an optional
|
||||||
// space parameter, and returns a JSON text. The replacer can be a function
|
// space parameter, and returns a JSON text. The replacer can be a function
|
||||||
// that can replace values, or an array of strings that will select the keys.
|
// that can replace values, or an array of strings that will select the keys.
|
||||||
@@ -475,4 +475,4 @@ replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
|||||||
throw new SyntaxError('JSON.parse');
|
throw new SyntaxError('JSON.parse');
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}());
|
})();
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
class JasmineHelper
|
||||||
|
def self.jasmine_lib_dir
|
||||||
|
File.expand_path(File.join(jasmine_root, 'lib'))
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.jasmine
|
||||||
|
['/lib/' + File.basename(Dir.glob("#{JasmineHelper.jasmine_lib_dir}/jasmine*.js").first)] +
|
||||||
|
['/lib/json2.js',
|
||||||
|
'/lib/TrivialReporter.js']
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.jasmine_root
|
||||||
|
File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def self.jasmine_src_dir
|
||||||
|
File.expand_path(File.join(jasmine_root, 'src'))
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.jasmine_spec_dir
|
||||||
|
File.expand_path(File.join(jasmine_root, 'spec'))
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.raw_spec_files
|
||||||
|
Dir.glob(File.join(jasmine_spec_dir, "**/*[Ss]pec.js"))
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.spec_file_urls
|
||||||
|
raw_spec_files.collect {|f| f.sub(jasmine_spec_dir, "/spec")}
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.dir_mappings
|
||||||
|
{
|
||||||
|
"/src" => jasmine_src_dir,
|
||||||
|
"/spec" => jasmine_spec_dir,
|
||||||
|
"/lib" => jasmine_lib_dir
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
require 'rubygems'
|
||||||
|
require "selenium_rc"
|
||||||
|
require File.expand_path(File.join(File.dirname(__FILE__), "jasmine_helper.rb"))
|
||||||
|
require File.expand_path(File.join(JasmineHelper.jasmine_root, "contrib/ruby/jasmine_spec_builder"))
|
||||||
|
|
||||||
|
jasmine_runner = Jasmine::Runner.new(SeleniumRC::Server.new.jar_path,
|
||||||
|
JasmineHelper.spec_file_urls,
|
||||||
|
JasmineHelper.dir_mappings)
|
||||||
|
|
||||||
|
spec_builder = Jasmine::SpecBuilder.new(JasmineHelper.raw_spec_files, jasmine_runner)
|
||||||
|
|
||||||
|
should_stop = false
|
||||||
|
|
||||||
|
Spec::Runner.configure do |config|
|
||||||
|
config.after(:suite) do
|
||||||
|
spec_builder.stop if should_stop
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
spec_builder.start
|
||||||
|
should_stop = true
|
||||||
|
spec_builder.declare_suites
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
describe("jasmine.Env", function() {
|
||||||
|
describe("reporting", function() {
|
||||||
|
var env;
|
||||||
|
var fakeReporter;
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
env = new jasmine.Env();
|
||||||
|
fakeReporter = jasmine.createSpyObj("fakeReporter", ["log"]);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('version', function () {
|
||||||
|
var oldVersion;
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
oldVersion = jasmine.version_;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(function () {
|
||||||
|
jasmine.version_ = oldVersion;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should raise an error if version is not set', function () {
|
||||||
|
jasmine.version_ = null;
|
||||||
|
var exception;
|
||||||
|
try {
|
||||||
|
env.version();
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
exception = e;
|
||||||
|
}
|
||||||
|
expect(exception.message).toEqual('Version not set');
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
it("version should return the current version as an int", function() {
|
||||||
|
jasmine.version_ = {
|
||||||
|
"major": 1,
|
||||||
|
"minor": 9,
|
||||||
|
"build": 7,
|
||||||
|
"revision": 8
|
||||||
|
};
|
||||||
|
expect(env.version()).toEqual({
|
||||||
|
"major": 1,
|
||||||
|
"minor": 9,
|
||||||
|
"build": 7,
|
||||||
|
"revision": 8
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should allow reporters to be registered", function() {
|
||||||
|
env.addReporter(fakeReporter);
|
||||||
|
env.reporter.log("message");
|
||||||
|
expect(fakeReporter.log).wasCalledWith("message");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -3,10 +3,9 @@ describe('Exceptions:', function() {
|
|||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
env = new jasmine.Env();
|
env = new jasmine.Env();
|
||||||
env.updateInterval = 0;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('jasmine.formatException formats Firefox exception messages as expected', function() {
|
it('jasmine.formatException formats Firefox exception maessages as expected', function() {
|
||||||
var sampleFirefoxException = {
|
var sampleFirefoxException = {
|
||||||
fileName: 'foo.js',
|
fileName: 'foo.js',
|
||||||
line: '1978',
|
line: '1978',
|
||||||
@@ -19,7 +18,7 @@ describe('Exceptions:', function() {
|
|||||||
expect(jasmine.util.formatException(sampleFirefoxException)).toEqual(expected);
|
expect(jasmine.util.formatException(sampleFirefoxException)).toEqual(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('jasmine.formatException formats Webkit exception messages as expected', function() {
|
it('jasmine.formatException formats Webkit exception maessages as expected', function() {
|
||||||
var sampleWebkitException = {
|
var sampleWebkitException = {
|
||||||
sourceURL: 'foo.js',
|
sourceURL: 'foo.js',
|
||||||
lineNumber: '1978',
|
lineNumber: '1978',
|
||||||
@@ -73,15 +72,15 @@ describe('Exceptions:', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
var runner = env.currentRunner();
|
var runner = env.currentRunner;
|
||||||
suite.execute();
|
suite.execute();
|
||||||
fakeTimer.tick(2500);
|
fakeTimer.tick(2500);
|
||||||
|
|
||||||
var suiteResults = suite.results();
|
var suiteResults = suite.getResults();
|
||||||
var specResults = suiteResults.getItems();
|
var specResults = suiteResults.getItems();
|
||||||
|
|
||||||
expect(suiteResults.passed()).toEqual(false);
|
expect(suiteResults.passed()).toEqual(false);
|
||||||
//
|
|
||||||
expect(specResults.length).toEqual(5);
|
expect(specResults.length).toEqual(5);
|
||||||
expect(specResults[0].passed()).toMatch(false);
|
expect(specResults[0].passed()).toMatch(false);
|
||||||
var blockResults = specResults[0].getItems();
|
var blockResults = specResults[0].getItems();
|
||||||
@@ -89,9 +88,9 @@ describe('Exceptions:', function() {
|
|||||||
expect(blockResults[0].message).toMatch(/fake error 1/);
|
expect(blockResults[0].message).toMatch(/fake error 1/);
|
||||||
|
|
||||||
expect(specResults[1].passed()).toEqual(false);
|
expect(specResults[1].passed()).toEqual(false);
|
||||||
blockResults = specResults[1].getItems();
|
var blockResults = specResults[1].getItems();
|
||||||
expect(blockResults[0].passed()).toEqual(false);
|
expect(blockResults[0].passed()).toEqual(false);
|
||||||
expect(blockResults[0].message).toMatch(/fake error 2/);
|
expect(blockResults[0].message).toMatch(/fake error 2/),
|
||||||
expect(blockResults[1].passed()).toEqual(true);
|
expect(blockResults[1].passed()).toEqual(true);
|
||||||
|
|
||||||
expect(specResults[2].passed()).toEqual(true);
|
expect(specResults[2].passed()).toEqual(true);
|
||||||
@@ -101,49 +100,7 @@ describe('Exceptions:', function() {
|
|||||||
expect(blockResults[0].message).toMatch(/fake error 3/);
|
expect(blockResults[0].message).toMatch(/fake error 3/);
|
||||||
|
|
||||||
expect(specResults[4].passed()).toEqual(true);
|
expect(specResults[4].passed()).toEqual(true);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it("should handle exceptions thrown directly in top-level describe blocks and continue", function () {
|
|
||||||
var suite = env.describe("a top level describe block that throws an exception", function () {
|
|
||||||
env.it("is a test that should pass", function () {
|
|
||||||
this.expect(true).toEqual(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
throw new Error("top level error");
|
|
||||||
});
|
|
||||||
|
|
||||||
suite.execute();
|
|
||||||
var suiteResults = suite.results();
|
|
||||||
var specResults = suiteResults.getItems();
|
|
||||||
|
|
||||||
expect(suiteResults.passed()).toEqual(false);
|
|
||||||
expect(specResults.length).toEqual(2);
|
|
||||||
|
|
||||||
expect(specResults[1].description).toMatch(/encountered a declaration exception/);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should handle exceptions thrown directly in nested describe blocks and continue", function () {
|
|
||||||
var suite = env.describe("a top level describe", function () {
|
|
||||||
env.describe("a mid-level describe that throws an exception", function () {
|
|
||||||
env.it("is a test that should pass", function () {
|
|
||||||
this.expect(true).toEqual(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
throw new Error("a mid-level error");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
suite.execute();
|
|
||||||
var suiteResults = suite.results();
|
|
||||||
var specResults = suiteResults.getItems();
|
|
||||||
|
|
||||||
expect(suiteResults.passed()).toEqual(false);
|
|
||||||
expect(specResults.length).toEqual(1);
|
|
||||||
|
|
||||||
var nestedSpecResults = specResults[0].getItems();
|
|
||||||
|
|
||||||
expect(nestedSpecResults.length).toEqual(2);
|
|
||||||
expect(nestedSpecResults[1].description).toMatch(/encountered a declaration exception/);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
@@ -0,0 +1,313 @@
|
|||||||
|
describe("jasmine.Matchers", function() {
|
||||||
|
var env;
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
env = new jasmine.Env();
|
||||||
|
});
|
||||||
|
|
||||||
|
function match(value) {
|
||||||
|
return new jasmine.Matchers(env, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function detailsFor(actual, matcherName, matcherArgs) {
|
||||||
|
var matcher = match(actual);
|
||||||
|
matcher[matcherName].apply(matcher, matcherArgs);
|
||||||
|
expect(matcher.getResults().getItems().length).toEqual(1);
|
||||||
|
return matcher.getResults().getItems()[0].details;
|
||||||
|
}
|
||||||
|
|
||||||
|
it("toEqual with primitives, objects, dates, html nodes, etc.", function() {
|
||||||
|
expect(match(true).toEqual(true)).toEqual(true);
|
||||||
|
|
||||||
|
expect(match({foo:'bar'}).toEqual(null)).toEqual(false);
|
||||||
|
|
||||||
|
var functionA = function() { return 'hi'; };
|
||||||
|
var functionB = function() { return 'hi'; };
|
||||||
|
expect(match({foo:functionA}).toEqual({foo:functionB})).toEqual(false);
|
||||||
|
expect(match({foo:functionA}).toEqual({foo:functionA})).toEqual(true);
|
||||||
|
|
||||||
|
expect((match(false).toEqual(true))).toEqual(false);
|
||||||
|
|
||||||
|
var circularGraph = {};
|
||||||
|
circularGraph.referenceToSelf = circularGraph;
|
||||||
|
expect((match(circularGraph).toEqual(circularGraph))).toEqual(true);
|
||||||
|
|
||||||
|
var nodeA = document.createElement('div');
|
||||||
|
var nodeB = document.createElement('div');
|
||||||
|
expect((match(nodeA).toEqual(nodeA))).toEqual(true);
|
||||||
|
expect((match(nodeA).toEqual(nodeB))).toEqual(false);
|
||||||
|
|
||||||
|
expect((match(new Date(2008, 1, 3, 15, 17, 19, 1234)).toEqual(new Date(2009, 1, 3, 15, 17, 19, 1234)))).toEqual(false);
|
||||||
|
expect((match(new Date(2008, 1, 3, 15, 17, 19, 1234)).toEqual(new Date(2008, 1, 3, 15, 17, 19, 1234)))).toEqual(true);
|
||||||
|
|
||||||
|
|
||||||
|
expect(match(true).toNotEqual(false)).toEqual(true);
|
||||||
|
expect((match(true).toNotEqual(true))).toEqual(false);
|
||||||
|
|
||||||
|
expect((match(['a', 'b']).toEqual(['a', undefined]))).toEqual(false);
|
||||||
|
expect((match(['a', 'b']).toEqual(['a', 'b', undefined]))).toEqual(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('toBe should return true only if the expected and actual items === each other', function() {
|
||||||
|
var a = {};
|
||||||
|
var b = {};
|
||||||
|
//noinspection UnnecessaryLocalVariableJS
|
||||||
|
var c = a;
|
||||||
|
expect((match(a).toBe(b))).toEqual(false);
|
||||||
|
expect((match(a).toBe(a))).toEqual(true);
|
||||||
|
expect((match(a).toBe(c))).toEqual(true);
|
||||||
|
expect((match(a).toNotBe(b))).toEqual(true);
|
||||||
|
expect((match(a).toNotBe(a))).toEqual(false);
|
||||||
|
expect((match(a).toNotBe(c))).toEqual(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
it("toMatch and #toNotMatch should perform regular expression matching on strings", function() {
|
||||||
|
expect((match('foobarbel').toMatch(/bar/))).toEqual(true);
|
||||||
|
expect((match('foobazbel').toMatch(/bar/))).toEqual(false);
|
||||||
|
|
||||||
|
expect((match('foobarbel').toMatch("bar"))).toEqual(true);
|
||||||
|
expect((match('foobazbel').toMatch("bar"))).toEqual(false);
|
||||||
|
|
||||||
|
expect((match('foobarbel').toNotMatch(/bar/))).toEqual(false);
|
||||||
|
expect((match('foobazbel').toNotMatch(/bar/))).toEqual(true);
|
||||||
|
|
||||||
|
expect((match('foobarbel').toNotMatch("bar"))).toEqual(false);
|
||||||
|
expect((match('foobazbel').toNotMatch("bar"))).toEqual(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("toBeDefined", function() {
|
||||||
|
expect(match('foo').toBeDefined()).toEqual(true);
|
||||||
|
expect(match(undefined).toBeDefined()).toEqual(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("toBeNull", function() {
|
||||||
|
expect(match(null).toBeNull()).toEqual(true);
|
||||||
|
expect(match(undefined).toBeNull()).toEqual(false);
|
||||||
|
expect(match("foo").toBeNull()).toEqual(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("toBeFalsy", function() {
|
||||||
|
expect(match(false).toBeFalsy()).toEqual(true);
|
||||||
|
expect(match(true).toBeFalsy()).toEqual(false);
|
||||||
|
expect(match(undefined).toBeFalsy()).toEqual(true);
|
||||||
|
expect(match(0).toBeFalsy()).toEqual(true);
|
||||||
|
expect(match("").toBeFalsy()).toEqual(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("toBeTruthy", function() {
|
||||||
|
expect(match(false).toBeTruthy()).toEqual(false);
|
||||||
|
expect(match(true).toBeTruthy()).toEqual(true);
|
||||||
|
expect(match(undefined).toBeTruthy()).toEqual(false);
|
||||||
|
expect(match(0).toBeTruthy()).toEqual(false);
|
||||||
|
expect(match("").toBeTruthy()).toEqual(false);
|
||||||
|
expect(match("hi").toBeTruthy()).toEqual(true);
|
||||||
|
expect(match(5).toBeTruthy()).toEqual(true);
|
||||||
|
expect(match({foo: 1}).toBeTruthy()).toEqual(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("toEqual", function() {
|
||||||
|
expect(match(undefined).toEqual(undefined)).toEqual(true);
|
||||||
|
expect(match({foo:'bar'}).toEqual({foo:'bar'})).toEqual(true);
|
||||||
|
expect(match("foo").toEqual({bar: undefined})).toEqual(false);
|
||||||
|
expect(match({foo: undefined}).toEqual("goo")).toEqual(false);
|
||||||
|
expect(match({foo: {bar :undefined}}).toEqual("goo")).toEqual(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("toEqual with jasmine.any()", function() {
|
||||||
|
expect(match("foo").toEqual(jasmine.any(String))).toEqual(true);
|
||||||
|
expect(match(3).toEqual(jasmine.any(Number))).toEqual(true);
|
||||||
|
expect(match("foo").toEqual(jasmine.any(Function))).toEqual(false);
|
||||||
|
expect(match("foo").toEqual(jasmine.any(Object))).toEqual(false);
|
||||||
|
expect(match({someObj:'foo'}).toEqual(jasmine.any(Object))).toEqual(true);
|
||||||
|
expect(match({someObj:'foo'}).toEqual(jasmine.any(Function))).toEqual(false);
|
||||||
|
expect(match(function() {}).toEqual(jasmine.any(Object))).toEqual(false);
|
||||||
|
expect(match(["foo", "goo"]).toEqual(["foo", jasmine.any(String)])).toEqual(true);
|
||||||
|
expect(match(function() {}).toEqual(jasmine.any(Function))).toEqual(true);
|
||||||
|
expect(match(["a", function() {}]).toEqual(["a", jasmine.any(Function)])).toEqual(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("toEqual handles circular objects ok", function() {
|
||||||
|
expect(match({foo: "bar", baz: undefined}).toEqual({foo: "bar", baz: undefined})).toEqual(true);
|
||||||
|
expect(match({foo:['bar','baz','quux']}).toEqual({foo:['bar','baz','quux']})).toEqual(true);
|
||||||
|
expect(match({foo: {bar:'baz'}, quux:'corge'}).toEqual({foo:{bar:'baz'}, quux:'corge'})).toEqual(true);
|
||||||
|
|
||||||
|
var circularObject = {};
|
||||||
|
var secondCircularObject = {};
|
||||||
|
circularObject.field = circularObject;
|
||||||
|
secondCircularObject.field = secondCircularObject;
|
||||||
|
expect(match(circularObject).toEqual(secondCircularObject)).toEqual(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("toNotEqual as slightly surprising behavior, but is it intentional?", function() {
|
||||||
|
expect(match({x:"x", y:"y", z:"w"}).toNotEqual({x:"x", y:"y", z:"z"})).toEqual(true);
|
||||||
|
expect(match({x:"x", y:"y", w:"z"}).toNotEqual({x:"x", y:"y", z:"z"})).toEqual(true);
|
||||||
|
expect(match({x:"x", y:"y", z:"z"}).toNotEqual({w: "w", x:"x", y:"y", z:"z"})).toEqual(true);
|
||||||
|
expect(match({w: "w", x:"x", y:"y", z:"z"}).toNotEqual({x:"x", y:"y", z:"z"})).toEqual(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("toEqual handles arrays", function() {
|
||||||
|
expect(match([1, "A"]).toEqual([1, "A"])).toEqual(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("toContain and toNotContain", function() {
|
||||||
|
expect(match('ABC').toContain('A')).toEqual(true);
|
||||||
|
expect(match('ABC').toContain('X')).toEqual(false);
|
||||||
|
|
||||||
|
expect(match(['A', 'B', 'C']).toContain('A')).toEqual(true);
|
||||||
|
expect(match(['A', 'B', 'C']).toContain('F')).toEqual(false);
|
||||||
|
expect(match(['A', 'B', 'C']).toNotContain('F')).toEqual(true);
|
||||||
|
expect(match(['A', 'B', 'C']).toNotContain('A')).toEqual(false);
|
||||||
|
|
||||||
|
expect(match(['A', {some:'object'}, 'C']).toContain({some:'object'})).toEqual(true);
|
||||||
|
expect(match(['A', {some:'object'}, 'C']).toContain({some:'other object'})).toEqual(false);
|
||||||
|
|
||||||
|
expect(detailsFor('abc', 'toContain', ['x'])).toEqual({
|
||||||
|
matcherName: 'toContain', expected: 'x', actual: 'abc'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("toBeLessThan should pass if actual is less than expected", function() {
|
||||||
|
expect(match(37).toBeLessThan(42)).toEqual(true);
|
||||||
|
expect(match(37).toBeLessThan(-42)).toEqual(false);
|
||||||
|
expect(match(37).toBeLessThan(37)).toEqual(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("toBeGreaterThan should pass if actual is greater than expected", function() {
|
||||||
|
expect(match(37).toBeGreaterThan(42)).toEqual(false);
|
||||||
|
expect(match(37).toBeGreaterThan(-42)).toEqual(true);
|
||||||
|
expect(match(37).toBeGreaterThan(37)).toEqual(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("toThrow", function() {
|
||||||
|
var expected = new jasmine.Matchers(env, function() {
|
||||||
|
throw new Error("Fake Error");
|
||||||
|
});
|
||||||
|
expect(expected.toThrow()).toEqual(true);
|
||||||
|
expect(expected.toThrow("Fake Error")).toEqual(true);
|
||||||
|
expect(expected.toThrow(new Error("Fake Error"))).toEqual(true);
|
||||||
|
expect(expected.toThrow("Other Error")).toEqual(false);
|
||||||
|
expect(expected.toThrow(new Error("Other Error"))).toEqual(false);
|
||||||
|
|
||||||
|
expect(match(function() {}).toThrow()).toEqual(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("wasCalled, wasNotCalled, wasCalledWith", function() {
|
||||||
|
var currentSuite;
|
||||||
|
var spec;
|
||||||
|
currentSuite = env.describe('default current suite', function() {
|
||||||
|
spec = env.it();
|
||||||
|
});
|
||||||
|
|
||||||
|
var TestClass = { someFunction: function() {
|
||||||
|
} };
|
||||||
|
|
||||||
|
var expected;
|
||||||
|
expect(match(TestClass.someFunction).wasCalled()).toEqual(false);
|
||||||
|
expect(match(TestClass.someFunction).wasNotCalled()).toEqual(false);
|
||||||
|
|
||||||
|
spec.spyOn(TestClass, 'someFunction');
|
||||||
|
|
||||||
|
expect(match(TestClass.someFunction).wasCalled()).toEqual(false);
|
||||||
|
expect(match(TestClass.someFunction).wasNotCalled()).toEqual(true);
|
||||||
|
|
||||||
|
|
||||||
|
TestClass.someFunction();
|
||||||
|
expect(match(TestClass.someFunction).wasCalled()).toEqual(true);
|
||||||
|
expect(match(TestClass.someFunction).wasCalled('some arg')).toEqual(false);
|
||||||
|
expect(match(TestClass.someFunction).wasNotCalled()).toEqual(false);
|
||||||
|
|
||||||
|
TestClass.someFunction('a', 'b', 'c');
|
||||||
|
expect(match(TestClass.someFunction).wasCalledWith('a', 'b', 'c')).toEqual(true);
|
||||||
|
|
||||||
|
expected = match(TestClass.someFunction);
|
||||||
|
expect(expected.wasCalledWith('c', 'b', 'a')).toEqual(false);
|
||||||
|
expect(expected.getResults().getItems()[0].passed()).toEqual(false);
|
||||||
|
|
||||||
|
TestClass.someFunction.reset();
|
||||||
|
TestClass.someFunction('a', 'b', 'c');
|
||||||
|
TestClass.someFunction('d', 'e', 'f');
|
||||||
|
expect(expected.wasCalledWith('a', 'b', 'c')).toEqual(true);
|
||||||
|
expect(expected.wasCalledWith('d', 'e', 'f')).toEqual(true);
|
||||||
|
expect(expected.wasCalledWith('x', 'y', 'z')).toEqual(false);
|
||||||
|
|
||||||
|
expect(detailsFor(TestClass.someFunction, 'wasCalledWith', ['x', 'y', 'z'])).toEqual({
|
||||||
|
matcherName: 'wasCalledWith', expected: ['x', 'y', 'z'], actual: TestClass.someFunction.argsForCall
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should report mismatches in some nice way", function() {
|
||||||
|
var results = new jasmine.NestedResults();
|
||||||
|
var expected = new jasmine.Matchers(env, true, results);
|
||||||
|
expected.toEqual(true);
|
||||||
|
expected.toEqual(false);
|
||||||
|
|
||||||
|
expect(results.getItems().length).toEqual(2);
|
||||||
|
|
||||||
|
expect(results.getItems()[0].passed()).toEqual(true);
|
||||||
|
|
||||||
|
expect(results.getItems()[1].passed()).toEqual(false);
|
||||||
|
|
||||||
|
results = new jasmine.NestedResults();
|
||||||
|
expected = new jasmine.Matchers(env, false, results);
|
||||||
|
expected.toEqual(true);
|
||||||
|
|
||||||
|
var expectedMessage = 'Expected<br /><br />true<br /><br />but got<br /><br />false<br />';
|
||||||
|
expect(results.getItems()[0].message).toEqual(expectedMessage);
|
||||||
|
|
||||||
|
results = new jasmine.NestedResults();
|
||||||
|
expected = new jasmine.Matchers(env, null, results);
|
||||||
|
expected.toEqual('not null');
|
||||||
|
|
||||||
|
expectedMessage = 'Expected<br /><br />\'not null\'<br /><br />but got<br /><br />null<br />';
|
||||||
|
expect(results.getItems()[0].message).toEqual(expectedMessage);
|
||||||
|
|
||||||
|
results = new jasmine.NestedResults();
|
||||||
|
expected = new jasmine.Matchers(env, undefined, results);
|
||||||
|
expected.toEqual('not undefined');
|
||||||
|
|
||||||
|
expectedMessage = 'Expected<br /><br />\'not undefined\'<br /><br />but got<br /><br />undefined<br />';
|
||||||
|
expect(results.getItems()[0].message).toEqual(expectedMessage);
|
||||||
|
|
||||||
|
|
||||||
|
results = new jasmine.NestedResults();
|
||||||
|
expected = new jasmine.Matchers(env, {foo:'one',baz:'two', more: 'blah'}, results);
|
||||||
|
expected.toEqual({foo:'one', bar: '<b>three</b> &', baz: '2'});
|
||||||
|
|
||||||
|
expectedMessage =
|
||||||
|
"Expected<br /><br />{ foo : 'one', bar : '<b>three</b> &', baz : '2' }<br /><br />but got<br /><br />{ foo : 'one', baz : 'two', more : 'blah' }<br />" +
|
||||||
|
"<br /><br />Different Keys:<br />" +
|
||||||
|
"expected has key 'bar', but missing from <b>actual</b>.<br />" +
|
||||||
|
"<b>expected</b> missing key 'more', but present in actual.<br />" +
|
||||||
|
"<br /><br />Different Values:<br />" +
|
||||||
|
"'bar' was<br /><br />'<b>three</b> &'<br /><br />in expected, but was<br /><br />'undefined'<br /><br />in actual.<br /><br />" +
|
||||||
|
"'baz' was<br /><br />'2'<br /><br />in expected, but was<br /><br />'two'<br /><br />in actual.<br /><br />";
|
||||||
|
var actualMessage = results.getItems()[0].message;
|
||||||
|
expect(actualMessage).toEqual(expectedMessage);
|
||||||
|
|
||||||
|
|
||||||
|
results = new jasmine.NestedResults();
|
||||||
|
expected = new jasmine.Matchers(env, true, results);
|
||||||
|
expected.toEqual(true);
|
||||||
|
|
||||||
|
expect(results.getItems()[0].message).toEqual('Passed.');
|
||||||
|
|
||||||
|
|
||||||
|
expected = new jasmine.Matchers(env, [1, 2, 3], results);
|
||||||
|
results.getItems().length = 0;
|
||||||
|
expected.toEqual([1, 2, 3]);
|
||||||
|
expect(results.getItems()[0].passed()).toEqual(true);
|
||||||
|
|
||||||
|
expected = new jasmine.Matchers(env, [1, 2, 3], results);
|
||||||
|
results.getItems().length = 0;
|
||||||
|
expected.toEqual([{}, {}, {}]);
|
||||||
|
expect(results.getItems()[0].passed()).toEqual(false);
|
||||||
|
|
||||||
|
expected = new jasmine.Matchers(env, [{}, {}, {}], results);
|
||||||
|
results.getItems().length = 0;
|
||||||
|
expected.toEqual([1, 2, 3]);
|
||||||
|
expect(results.getItems()[0].passed()).toEqual(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
describe("jasmine.MultiReporter", function() {
|
||||||
|
var multiReporter, fakeReporter1, fakeReporter2;
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
multiReporter = new jasmine.MultiReporter();
|
||||||
|
fakeReporter1 = jasmine.createSpyObj("fakeReporter1", ["reportSpecResults"]);
|
||||||
|
fakeReporter2 = jasmine.createSpyObj("fakeReporter2", ["reportSpecResults", "reportRunnerStarting"]);
|
||||||
|
multiReporter.addReporter(fakeReporter1);
|
||||||
|
multiReporter.addReporter(fakeReporter2);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should support all the method calls that jasmine.Reporter supports", function() {
|
||||||
|
multiReporter.reportRunnerStarting();
|
||||||
|
multiReporter.reportRunnerResults();
|
||||||
|
multiReporter.reportSuiteResults();
|
||||||
|
multiReporter.reportSpecResults();
|
||||||
|
multiReporter.log();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should delegate to any and all subreporters", function() {
|
||||||
|
multiReporter.reportSpecResults('blah', 'foo');
|
||||||
|
expect(fakeReporter1.reportSpecResults).wasCalledWith('blah', 'foo');
|
||||||
|
expect(fakeReporter2.reportSpecResults).wasCalledWith('blah', 'foo');
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should quietly skip delegating to any subreporters which lack the given method", function() {
|
||||||
|
multiReporter.reportRunnerStarting('blah', 'foo');
|
||||||
|
expect(fakeReporter2.reportRunnerStarting).wasCalledWith('blah', 'foo');
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -3,18 +3,14 @@ describe('jasmine.NestedResults', function() {
|
|||||||
// Leaf case
|
// Leaf case
|
||||||
var results = new jasmine.NestedResults();
|
var results = new jasmine.NestedResults();
|
||||||
|
|
||||||
results.addResult(new jasmine.ExpectationResult({
|
results.addResult(new jasmine.ExpectationResult(true,'Passed.'));
|
||||||
matcherName: "foo", passed: true, message: 'Passed.', actual: 'bar', expected: 'bar'}
|
|
||||||
));
|
|
||||||
|
|
||||||
expect(results.getItems().length).toEqual(1);
|
expect(results.getItems().length).toEqual(1);
|
||||||
expect(results.totalCount).toEqual(1);
|
expect(results.totalCount).toEqual(1);
|
||||||
expect(results.passedCount).toEqual(1);
|
expect(results.passedCount).toEqual(1);
|
||||||
expect(results.failedCount).toEqual(0);
|
expect(results.failedCount).toEqual(0);
|
||||||
|
|
||||||
results.addResult(new jasmine.ExpectationResult({
|
results.addResult(new jasmine.ExpectationResult(false, 'FAIL.'));
|
||||||
matcherName: "baz", passed: false, message: 'FAIL.', actual: "corge", expected: "quux"
|
|
||||||
}));
|
|
||||||
|
|
||||||
expect(results.getItems().length).toEqual(2);
|
expect(results.getItems().length).toEqual(2);
|
||||||
expect(results.totalCount).toEqual(2);
|
expect(results.totalCount).toEqual(2);
|
||||||
@@ -25,21 +21,12 @@ describe('jasmine.NestedResults', function() {
|
|||||||
it('should roll up counts for nested results', function() {
|
it('should roll up counts for nested results', function() {
|
||||||
// Branch case
|
// Branch case
|
||||||
var leafResultsOne = new jasmine.NestedResults();
|
var leafResultsOne = new jasmine.NestedResults();
|
||||||
leafResultsOne.addResult(new jasmine.ExpectationResult({
|
leafResultsOne.addResult(new jasmine.ExpectationResult( true, ''));
|
||||||
matcherName: "toSomething", passed: true, message: 'message', actual: '', expected:''
|
leafResultsOne.addResult(new jasmine.ExpectationResult( false, ''));
|
||||||
}));
|
|
||||||
|
|
||||||
leafResultsOne.addResult(new jasmine.ExpectationResult({
|
|
||||||
matcherName: "toSomethingElse", passed: false, message: 'message', actual: 'a', expected: 'b'
|
|
||||||
}));
|
|
||||||
|
|
||||||
var leafResultsTwo = new jasmine.NestedResults();
|
var leafResultsTwo = new jasmine.NestedResults();
|
||||||
leafResultsTwo.addResult(new jasmine.ExpectationResult({
|
leafResultsTwo.addResult(new jasmine.ExpectationResult( true, ''));
|
||||||
matcherName: "toSomething", passed: true, message: 'message', actual: '', expected: ''
|
leafResultsTwo.addResult(new jasmine.ExpectationResult( false, ''));
|
||||||
}));
|
|
||||||
leafResultsTwo.addResult(new jasmine.ExpectationResult({
|
|
||||||
matcherName: "toSomethineElse", passed: false, message: 'message', actual: 'c', expected: 'd'
|
|
||||||
}));
|
|
||||||
|
|
||||||
var branchResults = new jasmine.NestedResults();
|
var branchResults = new jasmine.NestedResults();
|
||||||
branchResults.addResult(leafResultsOne);
|
branchResults.addResult(leafResultsOne);
|
||||||
@@ -51,4 +38,4 @@ describe('jasmine.NestedResults', function() {
|
|||||||
expect(branchResults.failedCount).toEqual(2);
|
expect(branchResults.failedCount).toEqual(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
describe("jasmine.pp", function () {
|
||||||
|
it("should wrap strings in single quotes", function() {
|
||||||
|
expect(jasmine.pp("some string")).toEqual("'some string'");
|
||||||
|
expect(jasmine.pp("som' string")).toEqual("'som' string'");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should stringify primitives properly", function() {
|
||||||
|
expect(jasmine.pp(true)).toEqual("true");
|
||||||
|
expect(jasmine.pp(false)).toEqual("false");
|
||||||
|
expect(jasmine.pp(null)).toEqual("null");
|
||||||
|
expect(jasmine.pp(undefined)).toEqual("undefined");
|
||||||
|
expect(jasmine.pp(3)).toEqual("3");
|
||||||
|
expect(jasmine.pp(-3.14)).toEqual("-3.14");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should stringify arrays properly", function() {
|
||||||
|
expect(jasmine.pp([1, 2])).toEqual("[ 1, 2 ]");
|
||||||
|
expect(jasmine.pp([1, 'foo', {}, undefined, null])).toEqual("[ 1, 'foo', { }, undefined, null ]");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should indicate circular array references", function() {
|
||||||
|
var array1 = [1, 2];
|
||||||
|
var array2 = [array1];
|
||||||
|
array1.push(array2);
|
||||||
|
expect(jasmine.pp(array1)).toEqual("[ 1, 2, [ <circular reference: Array> ] ]");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should stringify objects properly", function() {
|
||||||
|
expect(jasmine.pp({foo: 'bar'})).toEqual("{ foo : 'bar' }");
|
||||||
|
expect(jasmine.pp({foo:'bar', baz:3, nullValue: null, undefinedValue: undefined})).toEqual("{ foo : 'bar', baz : 3, nullValue : null, undefinedValue : undefined }");
|
||||||
|
expect(jasmine.pp({foo: function () { }, bar: [1, 2, 3]})).toEqual("{ foo : Function, bar : [ 1, 2, 3 ] }");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should indicate circular object references", function() {
|
||||||
|
var sampleValue = {foo: 'hello'};
|
||||||
|
sampleValue.nested = sampleValue;
|
||||||
|
expect(jasmine.pp(sampleValue)).toEqual("{ foo : 'hello', nested : <circular reference: Object> }");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should indicate getters on objects as such", function() {
|
||||||
|
var sampleValue = {id: 1};
|
||||||
|
sampleValue.__defineGetter__('calculatedValue', function() { throw new Error("don't call me!"); });
|
||||||
|
expect(jasmine.pp(sampleValue)).toEqual("{ id : 1, calculatedValue : <getter> }");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should stringify HTML nodes properly", function() {
|
||||||
|
var sampleNode = document.createElement('div');
|
||||||
|
sampleNode.innerHTML = 'foo<b>bar</b>';
|
||||||
|
expect(jasmine.pp(sampleNode)).toEqual("HTMLNode");
|
||||||
|
expect(jasmine.pp({foo: sampleNode})).toEqual("{ foo : HTMLNode }");
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not do HTML escaping of strings', function() {
|
||||||
|
expect(jasmine.pp('some <b>html string</b> &', false)).toEqual('\'some <b>html string</b> &\'');
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should abbreviate window objects", function() {
|
||||||
|
expect(jasmine.pp(window)).toEqual("<window>");
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
@@ -4,7 +4,7 @@ describe('jasmine.Reporter', function() {
|
|||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
env = new jasmine.Env();
|
env = new jasmine.Env();
|
||||||
env.updateInterval = 0;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should get called from the test runner', function() {
|
it('should get called from the test runner', function() {
|
||||||
@@ -33,19 +33,23 @@ describe('jasmine.Reporter', function() {
|
|||||||
var bar = 0;
|
var bar = 0;
|
||||||
var baz = 0;
|
var baz = 0;
|
||||||
|
|
||||||
env.addReporter({
|
var specCallback = function (results) {
|
||||||
reportSpecResults: function() {
|
foo++;
|
||||||
foo++;
|
};
|
||||||
},
|
var suiteCallback = function (results) {
|
||||||
reportSuiteResults: function() {
|
bar++;
|
||||||
bar++;
|
};
|
||||||
},
|
var runnerCallback = function (results) {
|
||||||
reportRunnerResults: function() {
|
baz++;
|
||||||
baz++;
|
};
|
||||||
}
|
|
||||||
|
env.reporter = jasmine.Reporters.reporter({
|
||||||
|
specCallback: specCallback,
|
||||||
|
suiteCallback: suiteCallback,
|
||||||
|
runnerCallback: runnerCallback
|
||||||
});
|
});
|
||||||
|
|
||||||
var runner = env.currentRunner();
|
var runner = env.currentRunner;
|
||||||
runner.execute();
|
runner.execute();
|
||||||
|
|
||||||
expect(foo).toEqual(3); // 'foo was expected to be 3, was ' + foo);
|
expect(foo).toEqual(3); // 'foo was expected to be 3, was ' + foo);
|
||||||
@@ -0,0 +1,161 @@
|
|||||||
|
describe('RunnerTest', function() {
|
||||||
|
var fakeTimer;
|
||||||
|
var env;
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
env = new jasmine.Env();
|
||||||
|
|
||||||
|
fakeTimer = new jasmine.FakeTimer();
|
||||||
|
env.setTimeout = fakeTimer.setTimeout;
|
||||||
|
env.clearTimeout = fakeTimer.clearTimeout;
|
||||||
|
env.setInterval = fakeTimer.setInterval;
|
||||||
|
env.clearInterval = fakeTimer.clearInterval;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should run child suites and specs and generate results when execute is called', function() {
|
||||||
|
env.describe('one suite description', function () {
|
||||||
|
env.it('should be a test', function() {
|
||||||
|
this.runs(function () {
|
||||||
|
this.expect(true).toEqual(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
env.describe('another suite description', function () {
|
||||||
|
env.it('should be another test', function() {
|
||||||
|
this.runs(function () {
|
||||||
|
this.expect(true).toEqual(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
env.currentRunner.execute();
|
||||||
|
|
||||||
|
var runnerResults = env.currentRunner.getResults();
|
||||||
|
expect(runnerResults.totalCount).toEqual(2);
|
||||||
|
expect(runnerResults.passedCount).toEqual(1);
|
||||||
|
expect(runnerResults.failedCount).toEqual(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
it('should ignore suites that have been x\'d', function() {
|
||||||
|
env.xdescribe('one suite description', function () {
|
||||||
|
env.it('should be a test', function() {
|
||||||
|
this.runs(function () {
|
||||||
|
this.expect(true).toEqual(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
env.describe('another suite description', function () {
|
||||||
|
env.it('should be another test', function() {
|
||||||
|
this.runs(function () {
|
||||||
|
this.expect(true).toEqual(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
env.currentRunner.execute();
|
||||||
|
|
||||||
|
var runnerResults = env.currentRunner.getResults();
|
||||||
|
expect(runnerResults.totalCount).toEqual(1);
|
||||||
|
expect(runnerResults.passedCount).toEqual(0);
|
||||||
|
expect(runnerResults.failedCount).toEqual(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should roll up results from all specs', function() {
|
||||||
|
env.describe('one suite description', function () {
|
||||||
|
env.it('should be a test', function() {
|
||||||
|
this.runs(function () {
|
||||||
|
this.expect(true).toEqual(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
env.describe('another suite description', function () {
|
||||||
|
env.it('should be another test', function() {
|
||||||
|
this.runs(function () {
|
||||||
|
this.expect(true).toEqual(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
env.currentRunner.execute();
|
||||||
|
|
||||||
|
var results = env.currentRunner.getResults();
|
||||||
|
expect(results.totalCount).toEqual(2);
|
||||||
|
expect(results.passedCount).toEqual(1);
|
||||||
|
expect(results.failedCount).toEqual(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('reporting', function () {
|
||||||
|
var fakeReporter;
|
||||||
|
beforeEach(function () {
|
||||||
|
fakeReporter = jasmine.createSpyObj("fakeReporter", ["log", "reportRunnerStarting", "reportRunnerResults"]);
|
||||||
|
env.addReporter(fakeReporter);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should report runner results when the runner has completed running', function() {
|
||||||
|
env.describe('one suite description', function () {
|
||||||
|
env.it('should be a test', function() {
|
||||||
|
this.runs(function () {
|
||||||
|
this.expect(true).toEqual(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
env.describe('another suite description', function () {
|
||||||
|
env.it('should be another test', function() {
|
||||||
|
this.waits(200);
|
||||||
|
this.runs(function () {
|
||||||
|
this.expect(true).toEqual(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
env.currentRunner.execute();
|
||||||
|
expect(fakeReporter.reportRunnerResults).wasNotCalled();
|
||||||
|
fakeTimer.tick(200);
|
||||||
|
//This blows up the JSApiReporter.
|
||||||
|
//expect(fakeReporter.reportRunnerResults).wasCalledWith(env.currentRunner);
|
||||||
|
expect(fakeReporter.reportRunnerResults).wasCalled();
|
||||||
|
expect(fakeReporter.reportRunnerResults.mostRecentCall.args[0].getResults()).toEqual(env.currentRunner.getResults());
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should report when the tests start running", function() {
|
||||||
|
var fakeReporter = jasmine.createSpyObj("fakeReporter", ["log", "reportRunnerStarting"]);
|
||||||
|
env.addReporter(fakeReporter);
|
||||||
|
|
||||||
|
|
||||||
|
var runner = new jasmine.Runner(env);
|
||||||
|
runner.arbitraryVariable = 'foo';
|
||||||
|
spyOn(runner.queue, 'start');
|
||||||
|
expect(fakeReporter.reportRunnerStarting).wasNotCalled();
|
||||||
|
runner.execute();
|
||||||
|
expect(fakeReporter.reportRunnerStarting).wasCalled();
|
||||||
|
var reportedRunner = fakeReporter.reportRunnerStarting.mostRecentCall.args[0];
|
||||||
|
expect(reportedRunner.arbitraryVariable).toEqual('foo');
|
||||||
|
expect(runner.queue.start).wasCalled();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return a flat array of all suites, including nested suites", function() {
|
||||||
|
var suite1, suite2;
|
||||||
|
suite1 = env.describe("spec 1", function() {
|
||||||
|
suite2 = env.describe("nested spec", function() {});
|
||||||
|
});
|
||||||
|
|
||||||
|
document.runner = env.currentRunner;
|
||||||
|
|
||||||
|
var suites = env.currentRunner.suites();
|
||||||
|
var suiteDescriptions = [];
|
||||||
|
for (var i = 0; i < suites.length; i++) {
|
||||||
|
suiteDescriptions.push(suites[i].getFullName());
|
||||||
|
}
|
||||||
|
expect(suiteDescriptions).toEqual([suite1.getFullName(), suite2.getFullName()]);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
@@ -4,7 +4,6 @@ describe("jasmine spec running", function () {
|
|||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
env = new jasmine.Env();
|
env = new jasmine.Env();
|
||||||
env.updateInterval = 0;
|
|
||||||
|
|
||||||
fakeTimer = new jasmine.FakeTimer();
|
fakeTimer = new jasmine.FakeTimer();
|
||||||
env.setTimeout = fakeTimer.setTimeout;
|
env.setTimeout = fakeTimer.setTimeout;
|
||||||
@@ -37,6 +36,7 @@ describe("jasmine spec running", function () {
|
|||||||
expect(it4.id).toEqual(4);
|
expect(it4.id).toEqual(4);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it("should build up some objects with results we can inspect", function() {
|
it("should build up some objects with results we can inspect", function() {
|
||||||
|
|
||||||
var specWithNoBody, specWithExpectation, specWithFailingExpectations, specWithMultipleExpectations;
|
var specWithNoBody, specWithExpectation, specWithFailingExpectations, specWithMultipleExpectations;
|
||||||
@@ -54,7 +54,7 @@ describe("jasmine spec running", function () {
|
|||||||
this.expect(foo).toEqual('baz');
|
this.expect(foo).toEqual('baz');
|
||||||
});
|
});
|
||||||
|
|
||||||
specWithMultipleExpectations = env.it('spec with multiple expectations').runs(function () {
|
specWithMultipleExpectations = env.it('spec with multiple assertions').runs(function () {
|
||||||
var foo = 'bar';
|
var foo = 'bar';
|
||||||
var baz = 'quux';
|
var baz = 'quux';
|
||||||
|
|
||||||
@@ -67,13 +67,13 @@ describe("jasmine spec running", function () {
|
|||||||
|
|
||||||
expect(specWithNoBody.description).toEqual('new spec');
|
expect(specWithNoBody.description).toEqual('new spec');
|
||||||
|
|
||||||
expect(specWithExpectation.results().getItems().length).toEqual(1); // "Results aren't there after a spec was executed"
|
expect(specWithExpectation.results.getItems().length).toEqual(1); // "Results aren't there after a spec was executed"
|
||||||
expect(specWithExpectation.results().getItems()[0].passed()).toEqual(true); // "Results has a result, but it's true"
|
expect(specWithExpectation.results.getItems()[0].passed()).toEqual(true); // "Results has a result, but it's true"
|
||||||
expect(specWithExpectation.results().description).toEqual('spec with an expectation'); // "Spec's results did not get the spec's description"
|
expect(specWithExpectation.results.description).toEqual('spec with an expectation'); // "Spec's results did not get the spec's description"
|
||||||
|
|
||||||
expect(specWithFailingExpectations.results().getItems()[0].passed()).toEqual(false); // "Expectation that failed, passed"
|
expect(specWithFailingExpectations.results.getItems()[0].passed()).toEqual(false); // "Expectation that failed, passed"
|
||||||
|
|
||||||
expect(specWithMultipleExpectations.results().getItems().length).toEqual(2); // "Spec doesn't support multiple expectations"
|
expect(specWithMultipleExpectations.results.getItems().length).toEqual(2); // "Spec doesn't support multiple expectations"
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should work without a runs block", function() {
|
it("should work without a runs block", function() {
|
||||||
@@ -89,10 +89,10 @@ describe("jasmine spec running", function () {
|
|||||||
another_spec.execute();
|
another_spec.execute();
|
||||||
another_spec.done = true;
|
another_spec.done = true;
|
||||||
|
|
||||||
expect(another_spec.results().getItems().length).toEqual(2);
|
expect(another_spec.results.getItems().length).toEqual(2);
|
||||||
expect(another_spec.results().getItems()[0].passed()).toEqual(true); // "In a spec without a run block, expected first expectation result to be true but was false"
|
expect(another_spec.results.getItems()[0].passed()).toEqual(true); // "In a spec without a run block, expected first expectation result to be true but was false"
|
||||||
expect(another_spec.results().getItems()[1].passed()).toEqual(false); // "In a spec without a run block, expected second expectation result to be false but was true";
|
expect(another_spec.results.getItems()[1].passed()).toEqual(false); // "In a spec without a run block, expected second expectation result to be false but was true";
|
||||||
expect(another_spec.results().description).toEqual('spec with an expectation'); // "In a spec without a run block, results did not include the spec's description";
|
expect(another_spec.results.description).toEqual('spec with an expectation'); // "In a spec without a run block, results did not include the spec's description";
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should queue waits and runs that it encounters while executing specs', function() {
|
it('should queue waits and runs that it encounters while executing specs', function() {
|
||||||
@@ -141,8 +141,8 @@ describe("jasmine spec running", function () {
|
|||||||
|
|
||||||
a_spec.execute();
|
a_spec.execute();
|
||||||
|
|
||||||
expect(a_spec.results().getItems().length).toEqual(1); // 'No call to waits(): Spec queue did not run all functions';
|
expect(a_spec.results.getItems().length).toEqual(1); // 'No call to waits(): Spec queue did not run all functions';
|
||||||
expect(a_spec.results().getItems()[0].passed()).toEqual(true); // 'No call to waits(): Queued expectation failed';
|
expect(a_spec.results.getItems()[0].passed()).toEqual(true); // 'No call to waits(): Queued expectation failed';
|
||||||
|
|
||||||
foo = 0;
|
foo = 0;
|
||||||
env.describe('test async spec', function() {
|
env.describe('test async spec', function() {
|
||||||
@@ -161,15 +161,15 @@ describe("jasmine spec running", function () {
|
|||||||
|
|
||||||
a_spec.execute();
|
a_spec.execute();
|
||||||
|
|
||||||
expect(a_spec.results().getItems().length).toEqual(0);
|
expect(a_spec.results.getItems().length).toEqual(0);
|
||||||
|
|
||||||
fakeTimer.tick(500);
|
fakeTimer.tick(500);
|
||||||
expect(a_spec.results().getItems().length).toEqual(0);
|
expect(a_spec.results.getItems().length).toEqual(0);
|
||||||
|
|
||||||
fakeTimer.tick(500);
|
fakeTimer.tick(500);
|
||||||
expect(a_spec.results().getItems().length).toEqual(1); // 'Calling waits(): Spec queue did not run all functions';
|
expect(a_spec.results.getItems().length).toEqual(1); // 'Calling waits(): Spec queue did not run all functions';
|
||||||
|
|
||||||
expect(a_spec.results().getItems()[0].passed()).toEqual(true); // 'Calling waits(): Queued expectation failed';
|
expect(a_spec.results.getItems()[0].passed()).toEqual(true); // 'Calling waits(): Queued expectation failed';
|
||||||
|
|
||||||
var bar = 0;
|
var bar = 0;
|
||||||
var another_spec;
|
var another_spec;
|
||||||
@@ -199,8 +199,8 @@ describe("jasmine spec running", function () {
|
|||||||
|
|
||||||
fakeTimer.tick(1000);
|
fakeTimer.tick(1000);
|
||||||
|
|
||||||
expect(another_spec.results().getItems().length).toEqual(1);
|
expect(another_spec.results.getItems().length).toEqual(1);
|
||||||
expect(another_spec.results().getItems()[0].passed()).toEqual(true);
|
expect(another_spec.results.getItems()[0].passed()).toEqual(true);
|
||||||
|
|
||||||
var baz = 0;
|
var baz = 0;
|
||||||
var yet_another_spec;
|
var yet_another_spec;
|
||||||
@@ -225,8 +225,8 @@ describe("jasmine spec running", function () {
|
|||||||
fakeTimer.tick(150);
|
fakeTimer.tick(150);
|
||||||
|
|
||||||
|
|
||||||
expect(yet_another_spec.results().getItems().length).toEqual(1);
|
expect(yet_another_spec.results.getItems().length).toEqual(1);
|
||||||
expect(yet_another_spec.results().getItems()[0].passed()).toEqual(false);
|
expect(yet_another_spec.results.getItems()[0].passed()).toEqual(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("testAsyncSpecsWithMockSuite", function () {
|
it("testAsyncSpecsWithMockSuite", function () {
|
||||||
@@ -254,150 +254,90 @@ describe("jasmine spec running", function () {
|
|||||||
|
|
||||||
another_spec.execute();
|
another_spec.execute();
|
||||||
fakeTimer.tick(2000);
|
fakeTimer.tick(2000);
|
||||||
expect(another_spec.results().getItems().length).toEqual(1);
|
expect(another_spec.results.getItems().length).toEqual(1);
|
||||||
expect(another_spec.results().getItems()[0].passed()).toEqual(true);
|
expect(another_spec.results.getItems()[0].passed()).toEqual(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("waitsFor", function() {
|
it("testWaitsFor", function() {
|
||||||
var latchFunction = function() {
|
var doneWaiting = false;
|
||||||
return true;
|
var runsBlockExecuted = false;
|
||||||
};
|
|
||||||
var spec;
|
var spec;
|
||||||
|
env.describe('foo', function() {
|
||||||
|
spec = env.it('has a waits for', function() {
|
||||||
|
this.runs(function() {
|
||||||
|
});
|
||||||
|
|
||||||
function makeWaitsForSpec() {
|
this.waitsFor(500, function() {
|
||||||
var args = jasmine.util.argsToArray(arguments);
|
return doneWaiting;
|
||||||
env.describe('suite', function() {
|
});
|
||||||
spec = env.it('spec', function() {
|
|
||||||
this.waitsFor.apply(this, args);
|
this.runs(function() {
|
||||||
|
runsBlockExecuted = true;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
env.execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
it("should accept args (latchFunction, timeoutMessage, timeout)", function() {
|
|
||||||
makeWaitsForSpec(latchFunction, "message", 123);
|
|
||||||
var block = spec.queue.blocks[1];
|
|
||||||
expect(block.latchFunction).toBe(latchFunction);
|
|
||||||
expect(block.timeout).toEqual(123);
|
|
||||||
expect(block.message).toEqual('message');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should accept args (latchFunction, timeout)", function() {
|
spec.execute();
|
||||||
makeWaitsForSpec(latchFunction, 123);
|
expect(runsBlockExecuted).toEqual(false); //, 'should not have executed runs block yet');
|
||||||
var block = spec.queue.blocks[1];
|
fakeTimer.tick(100);
|
||||||
expect(block.latchFunction).toBe(latchFunction);
|
doneWaiting = true;
|
||||||
expect(block.timeout).toEqual(123);
|
fakeTimer.tick(100);
|
||||||
expect(block.message).toEqual(null);
|
expect(runsBlockExecuted).toEqual(true); //, 'should have executed runs block');
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should accept args (latchFunction, timeoutMessage)", function() {
|
it("testWaitsForFailsWithMessage", function() {
|
||||||
env.defaultTimeoutInterval = 4321;
|
var spec;
|
||||||
makeWaitsForSpec(latchFunction, "message");
|
env.describe('foo', function() {
|
||||||
var block = spec.queue.blocks[1];
|
spec = env.it('has a waits for', function() {
|
||||||
expect(block.latchFunction).toBe(latchFunction);
|
this.runs(function() {
|
||||||
expect(block.timeout).toEqual(4321);
|
});
|
||||||
expect(block.message).toEqual('message');
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should accept args (latchFunction)", function() {
|
this.waitsFor(500, function() {
|
||||||
env.defaultTimeoutInterval = 4321;
|
return false; // force a timeout
|
||||||
makeWaitsForSpec(latchFunction);
|
}, 'my awesome condition');
|
||||||
var block = spec.queue.blocks[1];
|
|
||||||
expect(block.latchFunction).toBe(latchFunction);
|
|
||||||
expect(block.timeout).toEqual(4321);
|
|
||||||
expect(block.message).toEqual(null);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should accept deprecated args order (timeout, latchFunction, timeoutMessage)", function() {
|
this.runs(function() {
|
||||||
makeWaitsForSpec(123, latchFunction, "message");
|
|
||||||
var block = spec.queue.blocks[1];
|
|
||||||
expect(block.latchFunction).toBe(latchFunction);
|
|
||||||
expect(block.timeout).toEqual(123);
|
|
||||||
expect(block.message).toEqual('message');
|
|
||||||
});
|
|
||||||
|
|
||||||
it("testWaitsFor", function() {
|
|
||||||
var doneWaiting = false;
|
|
||||||
var runsBlockExecuted = false;
|
|
||||||
|
|
||||||
var spec;
|
|
||||||
env.describe('foo', function() {
|
|
||||||
spec = env.it('has a waits for', function() {
|
|
||||||
this.runs(function() {
|
|
||||||
});
|
|
||||||
|
|
||||||
this.waitsFor(500, function() {
|
|
||||||
return doneWaiting;
|
|
||||||
});
|
|
||||||
|
|
||||||
this.runs(function() {
|
|
||||||
runsBlockExecuted = true;
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
spec.execute();
|
|
||||||
expect(runsBlockExecuted).toEqual(false); //, 'should not have executed runs block yet');
|
|
||||||
fakeTimer.tick(100);
|
|
||||||
doneWaiting = true;
|
|
||||||
fakeTimer.tick(100);
|
|
||||||
expect(runsBlockExecuted).toEqual(true); //, 'should have executed runs block');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("fails with message", function() {
|
spec.execute();
|
||||||
var spec;
|
fakeTimer.tick(1000);
|
||||||
env.describe('foo', function() {
|
var actual = spec.results.getItems()[0].message;
|
||||||
spec = env.it('has a waits for', function() {
|
var expected = 'timeout: timed out after 500 msec waiting for my awesome condition';
|
||||||
this.runs(function() {
|
expect(actual).toEqual(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.waitsFor(500, function() {
|
it("waitsFor fails and skips the rest of the spec if timeout is reached and the latch function is still false", function() {
|
||||||
return false; // force a timeout
|
var runsBlockExecuted = false;
|
||||||
}, 'my awesome condition');
|
|
||||||
|
|
||||||
this.runs(function() {
|
var spec;
|
||||||
});
|
env.describe('foo', function() {
|
||||||
|
spec = env.it('has a waits for', function() {
|
||||||
|
this.runs(function() {
|
||||||
|
});
|
||||||
|
|
||||||
|
this.waitsFor(500, function() {
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
this.runs(function() {
|
||||||
|
runsBlockExecuted = true;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
spec.execute();
|
|
||||||
fakeTimer.tick(1000);
|
|
||||||
expect(spec.results().getItems()[0].message).toEqual('timeout: timed out after 500 msec waiting for my awesome condition');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("fails and skips the rest of the spec if timeout is reached and the latch function hasn't returned true", function() {
|
spec.execute();
|
||||||
var runsBlockExecuted = false;
|
expect(runsBlockExecuted).toEqual(false);
|
||||||
var subsequentSpecRan = false;
|
fakeTimer.tick(100);
|
||||||
|
expect(runsBlockExecuted).toEqual(false);
|
||||||
var timeoutSpec, subsequentSpec;
|
fakeTimer.tick(400);
|
||||||
var suite = env.describe('foo', function() {
|
expect(runsBlockExecuted).toEqual(false);
|
||||||
timeoutSpec = env.it('has a waits for', function() {
|
var actual = spec.results.getItems()[0].message;
|
||||||
this.runs(function() {
|
var expected = 'timeout: timed out after 500 msec waiting for something to happen';
|
||||||
});
|
expect(actual).toEqual(expected,
|
||||||
|
'expected "' + expected + '" but found "' + actual + '"');
|
||||||
this.waitsFor(500, function() {
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
this.runs(function() {
|
|
||||||
runsBlockExecuted = true;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
subsequentSpec = env.it('then carries on to the next test', function() {
|
|
||||||
subsequentSpecRan = true;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
env.execute();
|
|
||||||
expect(runsBlockExecuted).toEqual(false);
|
|
||||||
fakeTimer.tick(100);
|
|
||||||
expect(runsBlockExecuted).toEqual(false);
|
|
||||||
fakeTimer.tick(400);
|
|
||||||
expect(runsBlockExecuted).toEqual(false);
|
|
||||||
expect(timeoutSpec.results().getItems()[0].message).toEqual('timeout: timed out after 500 msec waiting for something to happen');
|
|
||||||
expect(subsequentSpecRan).toEqual(true);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("testSpecAfter", function() {
|
it("testSpecAfter", function() {
|
||||||
@@ -485,8 +425,8 @@ describe("jasmine spec running", function () {
|
|||||||
|
|
||||||
var suite = suiteWithBefore;
|
var suite = suiteWithBefore;
|
||||||
|
|
||||||
expect(suite.results().getItems()[0].passed()).toEqual(true); // "testBeforeAndAfterCallbacks: the first spec's foo should have been 2");
|
expect(suite.getResults().getItems()[0].passed()).toEqual(true); // "testBeforeAndAfterCallbacks: the first spec's foo should have been 2");
|
||||||
expect(suite.results().getItems()[1].passed()).toEqual(true); // "testBeforeAndAfterCallbacks: the second spec's this.foo should have been 2");
|
expect(suite.getResults().getItems()[1].passed()).toEqual(true); // "testBeforeAndAfterCallbacks: the second spec's this.foo should have been 2");
|
||||||
|
|
||||||
|
|
||||||
var foo = 1;
|
var foo = 1;
|
||||||
@@ -513,8 +453,8 @@ describe("jasmine spec running", function () {
|
|||||||
|
|
||||||
suite = suiteWithAfter;
|
suite = suiteWithAfter;
|
||||||
expect(suite.afterEach.length).toEqual(1);
|
expect(suite.afterEach.length).toEqual(1);
|
||||||
expect(suite.results().getItems()[0].passed()).toEqual(true);
|
expect(suite.getResults().getItems()[0].passed()).toEqual(true);
|
||||||
expect(suite.results().getItems()[1].passed()).toEqual(true);
|
expect(suite.getResults().getItems()[1].passed()).toEqual(true);
|
||||||
expect(foo).toEqual(0);
|
expect(foo).toEqual(0);
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -580,15 +520,17 @@ describe("jasmine spec running", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('#waitsFor should allow consecutive calls', function () {
|
describe('#waitsFor should allow consecutive calls', function () {
|
||||||
|
|
||||||
var foo;
|
var foo;
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
|
|
||||||
foo = 0;
|
foo = 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('exits immediately (does not stack) if the latchFunction times out', function () {
|
it('exits immediately (does not stack) if the latchFunction times out', function () {
|
||||||
var reachedFirstWaitsFor = false;
|
var reachedFirstWaitsFor = false;
|
||||||
var reachedSecondWaitsFor = false;
|
var reachedSecondWaitsFor = false;
|
||||||
env.describe('suite that waits', function () {
|
var waitsSuite = env.describe('suite that waits', function () {
|
||||||
env.it('should stack timeouts', function() {
|
env.it('should stack timeouts', function() {
|
||||||
this.waitsFor(500, function () {
|
this.waitsFor(500, function () {
|
||||||
reachedFirstWaitsFor = true;
|
reachedFirstWaitsFor = true;
|
||||||
@@ -604,7 +546,7 @@ describe("jasmine spec running", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(reachedFirstWaitsFor).toEqual(false);
|
expect(reachedFirstWaitsFor).toEqual(false);
|
||||||
env.execute();
|
waitsSuite.execute();
|
||||||
|
|
||||||
expect(reachedFirstWaitsFor).toEqual(true);
|
expect(reachedFirstWaitsFor).toEqual(true);
|
||||||
expect(foo).toEqual(0);
|
expect(foo).toEqual(0);
|
||||||
@@ -867,7 +809,7 @@ describe("jasmine spec running", function () {
|
|||||||
suite.execute();
|
suite.execute();
|
||||||
|
|
||||||
expect(report).toEqual("firstsecond");
|
expect(report).toEqual("firstsecond");
|
||||||
var suiteResults = suite.results();
|
var suiteResults = suite.getResults();
|
||||||
expect(suiteResults.getItems()[0].getItems()[0].passed()).toEqual(false);
|
expect(suiteResults.getItems()[0].getItems()[0].passed()).toEqual(false);
|
||||||
expect(suiteResults.getItems()[1].getItems()[0].passed()).toEqual(true);
|
expect(suiteResults.getItems()[1].getItems()[0].passed()).toEqual(true);
|
||||||
});
|
});
|
||||||
@@ -906,7 +848,7 @@ describe("jasmine spec running", function () {
|
|||||||
|
|
||||||
expect(report).toEqual("firstsecondthird"); // "all tests should run");
|
expect(report).toEqual("firstsecondthird"); // "all tests should run");
|
||||||
//After each errors should not go in spec results because it confuses the count.
|
//After each errors should not go in spec results because it confuses the count.
|
||||||
var suiteResults = suite.results();
|
var suiteResults = suite.getResults();
|
||||||
expect(suiteResults.getItems().length).toEqual(3, 'testAfterExecutesSafely should have results for three specs');
|
expect(suiteResults.getItems().length).toEqual(3, 'testAfterExecutesSafely should have results for three specs');
|
||||||
|
|
||||||
expect(suiteResults.getItems()[0].getItems()[0].passed()).toEqual(true, "testAfterExecutesSafely 1st spec should pass");
|
expect(suiteResults.getItems()[0].getItems()[0].passed()).toEqual(true, "testAfterExecutesSafely 1st spec should pass");
|
||||||
@@ -919,17 +861,9 @@ describe("jasmine spec running", function () {
|
|||||||
expect(suiteResults.getItems()[2].getItems()[0].passed()).toEqual(true, "testAfterExecutesSafely 3rd suite spec should pass");
|
expect(suiteResults.getItems()[2].getItems()[0].passed()).toEqual(true, "testAfterExecutesSafely 3rd suite spec should pass");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should permit nested describes", function() {
|
it("testNestedDescribes", function() {
|
||||||
var actions = [];
|
var actions = [];
|
||||||
|
|
||||||
env.beforeEach(function () {
|
|
||||||
actions.push('runner beforeEach');
|
|
||||||
});
|
|
||||||
|
|
||||||
env.afterEach(function () {
|
|
||||||
actions.push('runner afterEach');
|
|
||||||
});
|
|
||||||
|
|
||||||
env.describe('Something', function() {
|
env.describe('Something', function() {
|
||||||
env.beforeEach(function() {
|
env.beforeEach(function() {
|
||||||
actions.push('outer beforeEach');
|
actions.push('outer beforeEach');
|
||||||
@@ -980,92 +914,27 @@ describe("jasmine spec running", function () {
|
|||||||
|
|
||||||
|
|
||||||
var expected = [
|
var expected = [
|
||||||
"runner beforeEach",
|
|
||||||
"outer beforeEach",
|
"outer beforeEach",
|
||||||
"outer it 1",
|
"outer it 1",
|
||||||
"outer afterEach",
|
"outer afterEach",
|
||||||
"runner afterEach",
|
|
||||||
|
|
||||||
"runner beforeEach",
|
|
||||||
"outer beforeEach",
|
"outer beforeEach",
|
||||||
"inner 1 beforeEach",
|
"inner 1 beforeEach",
|
||||||
"inner 1 it",
|
"inner 1 it",
|
||||||
"inner 1 afterEach",
|
"inner 1 afterEach",
|
||||||
"outer afterEach",
|
"outer afterEach",
|
||||||
"runner afterEach",
|
|
||||||
|
|
||||||
"runner beforeEach",
|
|
||||||
"outer beforeEach",
|
"outer beforeEach",
|
||||||
"outer it 2",
|
"outer it 2",
|
||||||
"outer afterEach",
|
"outer afterEach",
|
||||||
"runner afterEach",
|
|
||||||
|
|
||||||
"runner beforeEach",
|
|
||||||
"outer beforeEach",
|
"outer beforeEach",
|
||||||
"inner 2 beforeEach",
|
"inner 2 beforeEach",
|
||||||
"inner 2 it",
|
"inner 2 it",
|
||||||
"inner 2 afterEach",
|
"inner 2 afterEach",
|
||||||
"outer afterEach",
|
"outer afterEach"
|
||||||
"runner afterEach"
|
|
||||||
];
|
];
|
||||||
expect(actions).toEqual(expected);
|
expect(env.equals_(actions, expected)).toEqual(true);
|
||||||
});
|
|
||||||
|
|
||||||
it("should run multiple befores and afters in the order they are declared", function() {
|
|
||||||
var actions = [];
|
|
||||||
|
|
||||||
env.beforeEach(function () {
|
|
||||||
actions.push('runner beforeEach1');
|
|
||||||
});
|
|
||||||
|
|
||||||
env.afterEach(function () {
|
|
||||||
actions.push('runner afterEach1');
|
|
||||||
});
|
|
||||||
|
|
||||||
env.beforeEach(function () {
|
|
||||||
actions.push('runner beforeEach2');
|
|
||||||
});
|
|
||||||
|
|
||||||
env.afterEach(function () {
|
|
||||||
actions.push('runner afterEach2');
|
|
||||||
});
|
|
||||||
|
|
||||||
env.describe('Something', function() {
|
|
||||||
env.beforeEach(function() {
|
|
||||||
actions.push('beforeEach1');
|
|
||||||
});
|
|
||||||
|
|
||||||
env.afterEach(function() {
|
|
||||||
actions.push('afterEach1');
|
|
||||||
});
|
|
||||||
|
|
||||||
env.beforeEach(function() {
|
|
||||||
actions.push('beforeEach2');
|
|
||||||
});
|
|
||||||
|
|
||||||
env.afterEach(function() {
|
|
||||||
actions.push('afterEach2');
|
|
||||||
});
|
|
||||||
|
|
||||||
env.it('does it 1', function() {
|
|
||||||
actions.push('outer it 1');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
env.execute();
|
|
||||||
|
|
||||||
var expected = [
|
|
||||||
"runner beforeEach1",
|
|
||||||
"runner beforeEach2",
|
|
||||||
"beforeEach1",
|
|
||||||
"beforeEach2",
|
|
||||||
"outer it 1",
|
|
||||||
"afterEach2",
|
|
||||||
"afterEach1",
|
|
||||||
"runner afterEach2",
|
|
||||||
"runner afterEach1"
|
|
||||||
];
|
|
||||||
expect(actions).toEqual(expected);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("builds up nested names", function() {
|
it("builds up nested names", function() {
|
||||||
@@ -1094,8 +963,7 @@ describe("jasmine spec running", function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
env.describe('EmptySuite', function() {
|
env.describe('EmptySuite', function() {});
|
||||||
});
|
|
||||||
|
|
||||||
env.describe('NonEmptySuite2', function() {
|
env.describe('NonEmptySuite2', function() {
|
||||||
env.it('should pass', function() {
|
env.it('should pass', function() {
|
||||||
@@ -1105,7 +973,7 @@ describe("jasmine spec running", function () {
|
|||||||
|
|
||||||
env.execute();
|
env.execute();
|
||||||
|
|
||||||
var runnerResults = env.currentRunner_.results();
|
var runnerResults = env.currentRunner.getResults();
|
||||||
expect(runnerResults.totalCount).toEqual(3);
|
expect(runnerResults.totalCount).toEqual(3);
|
||||||
expect(runnerResults.passedCount).toEqual(3);
|
expect(runnerResults.passedCount).toEqual(3);
|
||||||
expect(runnerResults.failedCount).toEqual(0);
|
expect(runnerResults.failedCount).toEqual(0);
|
||||||
@@ -1143,7 +1011,7 @@ describe("jasmine spec running", function () {
|
|||||||
suite.execute();
|
suite.execute();
|
||||||
fakeTimer.tick(600);
|
fakeTimer.tick(600);
|
||||||
expect(spec.foo).toEqual(2);
|
expect(spec.foo).toEqual(2);
|
||||||
var suiteResults = suite.results();
|
var suiteResults = suite.getResults();
|
||||||
expect(suiteResults.getItems()[0].getItems().length).toEqual(2);
|
expect(suiteResults.getItems()[0].getItems().length).toEqual(2);
|
||||||
expect(suiteResults.getItems()[0].getItems()[0].passed()).toEqual(false);
|
expect(suiteResults.getItems()[0].getItems()[0].passed()).toEqual(false);
|
||||||
expect(suiteResults.getItems()[0].getItems()[1].passed()).toEqual(true);
|
expect(suiteResults.getItems()[0].getItems()[1].passed()).toEqual(true);
|
||||||
@@ -1176,7 +1044,7 @@ describe("jasmine spec running", function () {
|
|||||||
|
|
||||||
disabledSuite.execute();
|
disabledSuite.execute();
|
||||||
|
|
||||||
expect(spy).not.toHaveBeenCalled();
|
expect(spy).wasNotCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#explodes should throw an exception when it is called inside a spec', function() {
|
it('#explodes should throw an exception when it is called inside a spec', function() {
|
||||||
@@ -1198,61 +1066,35 @@ describe("jasmine spec running", function () {
|
|||||||
expect(exceptionMessage).toEqual('explodes function should not have been called');
|
expect(exceptionMessage).toEqual('explodes function should not have been called');
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should recover gracefully when there are errors in describe functions", function() {
|
it("should be easy to add more matchers local to a spec, suite, etc.", function() {
|
||||||
var specs = [];
|
var spec1, spec2, spec1Matcher, spec2Matcher;
|
||||||
var superSimpleReporter = new jasmine.Reporter();
|
|
||||||
superSimpleReporter.reportSpecResults = function(spec) {
|
|
||||||
specs.push("Spec: " + spec.getFullName());
|
|
||||||
var results = spec.results().getItems();
|
|
||||||
for (var i = 0; i < results.length; i++) {
|
|
||||||
var result = results[i];
|
|
||||||
specs.push("Result: " + result);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
try {
|
|
||||||
env.describe("outer1", function() {
|
|
||||||
env.describe("inner1", function() {
|
|
||||||
env.it("should thingy", function() {
|
|
||||||
this.expect(true).toEqual(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
throw new Error("fake error");
|
|
||||||
});
|
|
||||||
|
|
||||||
env.describe("inner2", function() {
|
|
||||||
env.it("should other thingy", function() {
|
|
||||||
this.expect(true).toEqual(true);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
throw new Error("fake error");
|
|
||||||
|
|
||||||
|
var suite = env.describe('some suite', function() {
|
||||||
|
env.beforeEach(function() {
|
||||||
|
this.addMatchers({ matcherForSuite: function(expected) {
|
||||||
|
return "matcherForSuite: actual: " + this.actual + "; expected: " + expected;
|
||||||
|
} });
|
||||||
});
|
});
|
||||||
} catch(e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
env.describe("outer2", function() {
|
spec1 = env.it('spec with an expectation').runs(function () {
|
||||||
env.it("should xxx", function() {
|
this.addMatchers({ matcherForSpec: function(expected) {
|
||||||
this.expect(true).toEqual(true);
|
return "matcherForSpec: actual: " + this.actual + "; expected: " + expected;
|
||||||
|
} });
|
||||||
|
spec1Matcher = this.expect("xxx");
|
||||||
|
});
|
||||||
|
|
||||||
|
spec2 = env.it('spec with failing expectation').runs(function () {
|
||||||
|
spec2Matcher = this.expect("yyy");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
env.addReporter(superSimpleReporter);
|
suite.execute();
|
||||||
env.execute();
|
|
||||||
|
|
||||||
expect(specs.join('')).toMatch(new RegExp(
|
expect(spec1Matcher.matcherForSuite("expected")).toEqual("matcherForSuite: actual: xxx; expected: expected");
|
||||||
'Spec: outer1 inner1 should thingy.' +
|
expect(spec1Matcher.matcherForSpec("expected")).toEqual("matcherForSpec: actual: xxx; expected: expected");
|
||||||
'Result: Passed.' +
|
|
||||||
'Spec: outer1 inner1 encountered a declaration exception.' +
|
expect(spec2Matcher.matcherForSuite("expected")).toEqual("matcherForSuite: actual: yyy; expected: expected");
|
||||||
'Result: Error: fake error.*' +
|
expect(spec2Matcher.matcherForSpec).toBe(undefined);
|
||||||
'Spec: outer1 inner2 should other thingy.' +
|
|
||||||
'Result: Passed.' +
|
|
||||||
'Spec: outer1 encountered a declaration exception.' +
|
|
||||||
'Result: Error: fake error.*' +
|
|
||||||
'Spec: outer2 should xxx.' +
|
|
||||||
'Result: Passed.'
|
|
||||||
));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -33,8 +33,8 @@ describe('Spies', function () {
|
|||||||
|
|
||||||
TestClass.someFunction('foo');
|
TestClass.someFunction('foo');
|
||||||
TestClass.someFunction('bar');
|
TestClass.someFunction('bar');
|
||||||
expect(TestClass.someFunction.calls[0].args).toEqual(['foo']);
|
expect(TestClass.someFunction.argsForCall[0]).toEqual(['foo']);
|
||||||
expect(TestClass.someFunction.calls[1].args).toEqual(['bar']);
|
expect(TestClass.someFunction.argsForCall[1]).toEqual(['bar']);
|
||||||
expect(TestClass.someFunction.mostRecentCall.args).toEqual(['bar']);
|
expect(TestClass.someFunction.mostRecentCall.args).toEqual(['bar']);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -169,33 +169,19 @@ describe('Spies', function () {
|
|||||||
var TestClass = { someFunction: function() {} };
|
var TestClass = { someFunction: function() {} };
|
||||||
this.spyOn(TestClass, 'someFunction');
|
this.spyOn(TestClass, 'someFunction');
|
||||||
|
|
||||||
expect(TestClass.someFunction).not.toHaveBeenCalled();
|
expect(TestClass.someFunction).wasNotCalled();
|
||||||
TestClass.someFunction();
|
TestClass.someFunction();
|
||||||
expect(TestClass.someFunction).toHaveBeenCalled();
|
expect(TestClass.someFunction).wasCalled();
|
||||||
TestClass.someFunction.reset();
|
TestClass.someFunction.reset();
|
||||||
expect(TestClass.someFunction).not.toHaveBeenCalled();
|
expect(TestClass.someFunction).wasNotCalled();
|
||||||
expect(TestClass.someFunction.callCount).toEqual(0);
|
expect(TestClass.someFunction.callCount).toEqual(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("createSpyObj", function() {
|
it("should create an object with a bunch of spy methods when you call jasmine.createSpyObj()", function() {
|
||||||
it("should create an object with a bunch of spy methods when you call jasmine.createSpyObj()", function() {
|
var spyObj = jasmine.createSpyObj('BaseName', ['method1', 'method2']);
|
||||||
var spyObj = jasmine.createSpyObj('BaseName', ['method1', 'method2']);
|
expect(spyObj).toEqual({ method1: jasmine.any(Function), method2: jasmine.any(Function)});
|
||||||
expect(spyObj).toEqual({ method1: jasmine.any(Function), method2: jasmine.any(Function)});
|
expect(spyObj.method1.identity).toEqual('BaseName.method1');
|
||||||
expect(spyObj.method1.identity).toEqual('BaseName.method1');
|
expect(spyObj.method2.identity).toEqual('BaseName.method2');
|
||||||
expect(spyObj.method2.identity).toEqual('BaseName.method2');
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should throw if you do not pass an array argument", function() {
|
|
||||||
expect(function() {
|
|
||||||
jasmine.createSpyObj('BaseName');
|
|
||||||
}).toThrow('createSpyObj requires a non-empty array of method names to create spies for');
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should throw if you pass an empty array argument", function() {
|
|
||||||
expect(function() {
|
|
||||||
jasmine.createSpyObj('BaseName');
|
|
||||||
}).toThrow('createSpyObj requires a non-empty array of method names to create spies for');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
describe('Suite', function() {
|
||||||
|
var fakeTimer;
|
||||||
|
var env;
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
env = new jasmine.Env();
|
||||||
|
|
||||||
|
fakeTimer = new jasmine.FakeTimer();
|
||||||
|
env.setTimeout = fakeTimer.setTimeout;
|
||||||
|
env.clearTimeout = fakeTimer.clearTimeout;
|
||||||
|
env.setInterval = fakeTimer.setInterval;
|
||||||
|
env.clearInterval = fakeTimer.clearInterval;
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Specs', function () {
|
||||||
|
it('#specs should return all immediate children that are specs.', function () {
|
||||||
|
var suite =env.describe('Suite 1', function () {
|
||||||
|
env.it('Spec 1', function() {
|
||||||
|
this.runs(function () {
|
||||||
|
this.expect(true).toEqual(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
env.it('Spec 2', function() {
|
||||||
|
this.runs(function () {
|
||||||
|
this.expect(true).toEqual(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
env.describe('Suite 2', function () {
|
||||||
|
env.it('Spec 3', function() {
|
||||||
|
this.runs(function () {
|
||||||
|
this.expect(true).toEqual(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
env.it('Spec 4', function() {
|
||||||
|
this.runs(function () {
|
||||||
|
this.expect(true).toEqual(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
var suiteSpecs = suite.specs();
|
||||||
|
expect(suiteSpecs.length).toEqual(3);
|
||||||
|
expect(suiteSpecs[0].description).toEqual('Spec 1');
|
||||||
|
expect(suiteSpecs[1].description).toEqual('Spec 2');
|
||||||
|
expect(suiteSpecs[2].description).toEqual('Spec 4');
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('SpecCount', function () {
|
||||||
|
|
||||||
|
it('should keep a count of the number of specs that are run', function() {
|
||||||
|
var suite = env.describe('one suite description', function () {
|
||||||
|
env.it('should be a test', function() {
|
||||||
|
this.runs(function () {
|
||||||
|
this.expect(true).toEqual(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
env.it('should be another test', function() {
|
||||||
|
this.runs(function () {
|
||||||
|
this.expect(true).toEqual(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
env.it('should be a third test', function() {
|
||||||
|
this.runs(function () {
|
||||||
|
this.expect(true).toEqual(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(suite.specCount()).toEqual(3);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('specCount should be correct even with runs/waits blocks', function() {
|
||||||
|
var suite = env.describe('one suite description', function () {
|
||||||
|
env.it('should be a test', function() {
|
||||||
|
this.runs(function () {
|
||||||
|
this.expect(true).toEqual(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
env.it('should be another test', function() {
|
||||||
|
this.runs(function () {
|
||||||
|
this.expect(true).toEqual(true);
|
||||||
|
});
|
||||||
|
this.waits(10);
|
||||||
|
this.runs(function () {
|
||||||
|
this.expect(true).toEqual(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
env.it('should be a third test', function() {
|
||||||
|
this.runs(function () {
|
||||||
|
this.expect(true).toEqual(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(suite.specCount()).toEqual(3);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
describe("TrivialReporter", function() {
|
||||||
|
var trivialReporter;
|
||||||
|
var body;
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
body = document.createElement("body");
|
||||||
|
});
|
||||||
|
|
||||||
|
function fakeSpec(name) {
|
||||||
|
return {
|
||||||
|
getFullName: function() { return name; }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
it("should run only specs beginning with spec parameter", function() {
|
||||||
|
trivialReporter = new jasmine.TrivialReporter({ location: {search: "?spec=run%20this"} });
|
||||||
|
expect(trivialReporter.specFilter(fakeSpec("run this"))).toBeTruthy();
|
||||||
|
expect(trivialReporter.specFilter(fakeSpec("not the right spec"))).toBeFalsy();
|
||||||
|
expect(trivialReporter.specFilter(fakeSpec("not run this"))).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should display empty divs for every suite when the runner is starting", function() {
|
||||||
|
trivialReporter = new jasmine.TrivialReporter({ body: body });
|
||||||
|
trivialReporter.reportRunnerStarting({
|
||||||
|
suites: function() {
|
||||||
|
return [ new jasmine.Suite({}, "suite 1", null, null) ];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var divs = body.getElementsByTagName("div");
|
||||||
|
expect(divs.length).toEqual(2);
|
||||||
|
expect(divs[1].innerHTML).toContain("suite 1");
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -16,7 +16,11 @@ jasmine.Block.prototype.execute = function(onComplete) {
|
|||||||
try {
|
try {
|
||||||
this.func.apply(this.spec);
|
this.func.apply(this.spec);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.spec.fail(e);
|
this.fail(e);
|
||||||
}
|
}
|
||||||
onComplete();
|
onComplete();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
jasmine.Block.prototype.fail = function(e) {
|
||||||
|
this.spec.results.addResult(new jasmine.ExpectationResult(false, jasmine.util.formatException(e), null));
|
||||||
|
};
|
||||||
@@ -6,12 +6,14 @@
|
|||||||
jasmine.Env = function() {
|
jasmine.Env = function() {
|
||||||
this.currentSpec = null;
|
this.currentSpec = null;
|
||||||
this.currentSuite = null;
|
this.currentSuite = null;
|
||||||
this.currentRunner_ = new jasmine.Runner(this);
|
this.currentRunner = new jasmine.Runner(this);
|
||||||
|
this.currentlyRunningTests = false;
|
||||||
|
|
||||||
this.reporter = new jasmine.MultiReporter();
|
this.reporter = new jasmine.MultiReporter();
|
||||||
|
|
||||||
this.updateInterval = jasmine.DEFAULT_UPDATE_INTERVAL;
|
this.updateInterval = 0;
|
||||||
this.defaultTimeoutInterval = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
|
||||||
|
this.updateInterval = 0;
|
||||||
this.lastUpdate = 0;
|
this.lastUpdate = 0;
|
||||||
this.specFilter = function() {
|
this.specFilter = function() {
|
||||||
return true;
|
return true;
|
||||||
@@ -20,14 +22,6 @@ jasmine.Env = function() {
|
|||||||
this.nextSpecId_ = 0;
|
this.nextSpecId_ = 0;
|
||||||
this.nextSuiteId_ = 0;
|
this.nextSuiteId_ = 0;
|
||||||
this.equalityTesters_ = [];
|
this.equalityTesters_ = [];
|
||||||
|
|
||||||
// wrap matchers
|
|
||||||
this.matchersClass = function() {
|
|
||||||
jasmine.Matchers.apply(this, arguments);
|
|
||||||
};
|
|
||||||
jasmine.util.inherit(this.matchersClass, jasmine.Matchers);
|
|
||||||
|
|
||||||
jasmine.Matchers.wrapInto_(jasmine.Matchers.prototype, this.matchersClass);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -36,9 +30,6 @@ jasmine.Env.prototype.clearTimeout = jasmine.clearTimeout;
|
|||||||
jasmine.Env.prototype.setInterval = jasmine.setInterval;
|
jasmine.Env.prototype.setInterval = jasmine.setInterval;
|
||||||
jasmine.Env.prototype.clearInterval = jasmine.clearInterval;
|
jasmine.Env.prototype.clearInterval = jasmine.clearInterval;
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns an object containing jasmine version build info, if set.
|
|
||||||
*/
|
|
||||||
jasmine.Env.prototype.version = function () {
|
jasmine.Env.prototype.version = function () {
|
||||||
if (jasmine.version_) {
|
if (jasmine.version_) {
|
||||||
return jasmine.version_;
|
return jasmine.version_;
|
||||||
@@ -47,37 +38,6 @@ jasmine.Env.prototype.version = function () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns string containing jasmine version build info, if set.
|
|
||||||
*/
|
|
||||||
jasmine.Env.prototype.versionString = function() {
|
|
||||||
if (!jasmine.version_) {
|
|
||||||
return "version unknown";
|
|
||||||
}
|
|
||||||
|
|
||||||
var version = this.version();
|
|
||||||
var versionString = version.major + "." + version.minor + "." + version.build;
|
|
||||||
if (version.release_candidate) {
|
|
||||||
versionString += ".rc" + version.release_candidate;
|
|
||||||
}
|
|
||||||
versionString += " revision " + version.revision;
|
|
||||||
return versionString;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns a sequential integer starting at 0
|
|
||||||
*/
|
|
||||||
jasmine.Env.prototype.nextSpecId = function () {
|
|
||||||
return this.nextSpecId_++;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns a sequential integer starting at 0
|
|
||||||
*/
|
|
||||||
jasmine.Env.prototype.nextSuiteId = function () {
|
|
||||||
return this.nextSuiteId_++;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a reporter to receive status updates from Jasmine.
|
* Register a reporter to receive status updates from Jasmine.
|
||||||
* @param {jasmine.Reporter} reporter An object which will receive status updates.
|
* @param {jasmine.Reporter} reporter An object which will receive status updates.
|
||||||
@@ -87,7 +47,7 @@ jasmine.Env.prototype.addReporter = function(reporter) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Env.prototype.execute = function() {
|
jasmine.Env.prototype.execute = function() {
|
||||||
this.currentRunner_.execute();
|
this.currentRunner.execute();
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Env.prototype.describe = function(description, specDefinitions) {
|
jasmine.Env.prototype.describe = function(description, specDefinitions) {
|
||||||
@@ -97,23 +57,12 @@ jasmine.Env.prototype.describe = function(description, specDefinitions) {
|
|||||||
if (parentSuite) {
|
if (parentSuite) {
|
||||||
parentSuite.add(suite);
|
parentSuite.add(suite);
|
||||||
} else {
|
} else {
|
||||||
this.currentRunner_.add(suite);
|
this.currentRunner.add(suite);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.currentSuite = suite;
|
this.currentSuite = suite;
|
||||||
|
|
||||||
var declarationError = null;
|
specDefinitions.call(suite);
|
||||||
try {
|
|
||||||
specDefinitions.call(suite);
|
|
||||||
} catch(e) {
|
|
||||||
declarationError = e;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (declarationError) {
|
|
||||||
this.it("encountered a declaration exception", function() {
|
|
||||||
throw declarationError;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.currentSuite = parentSuite;
|
this.currentSuite = parentSuite;
|
||||||
|
|
||||||
@@ -121,24 +70,11 @@ jasmine.Env.prototype.describe = function(description, specDefinitions) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Env.prototype.beforeEach = function(beforeEachFunction) {
|
jasmine.Env.prototype.beforeEach = function(beforeEachFunction) {
|
||||||
if (this.currentSuite) {
|
this.currentSuite.beforeEach(beforeEachFunction);
|
||||||
this.currentSuite.beforeEach(beforeEachFunction);
|
|
||||||
} else {
|
|
||||||
this.currentRunner_.beforeEach(beforeEachFunction);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
jasmine.Env.prototype.currentRunner = function () {
|
|
||||||
return this.currentRunner_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Env.prototype.afterEach = function(afterEachFunction) {
|
jasmine.Env.prototype.afterEach = function(afterEachFunction) {
|
||||||
if (this.currentSuite) {
|
this.currentSuite.afterEach(afterEachFunction);
|
||||||
this.currentSuite.afterEach(afterEachFunction);
|
|
||||||
} else {
|
|
||||||
this.currentRunner_.afterEach(afterEachFunction);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Env.prototype.xdescribe = function(desc, specDefinitions) {
|
jasmine.Env.prototype.xdescribe = function(desc, specDefinitions) {
|
||||||
@@ -162,7 +98,7 @@ jasmine.Env.prototype.it = function(description, func) {
|
|||||||
|
|
||||||
jasmine.Env.prototype.xit = function(desc, func) {
|
jasmine.Env.prototype.xit = function(desc, func) {
|
||||||
return {
|
return {
|
||||||
id: this.nextSpecId(),
|
id: this.nextSpecId_++,
|
||||||
runs: function() {
|
runs: function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -177,23 +113,23 @@ jasmine.Env.prototype.compareObjects_ = function(a, b, mismatchKeys, mismatchVal
|
|||||||
b.__Jasmine_been_here_before__ = a;
|
b.__Jasmine_been_here_before__ = a;
|
||||||
|
|
||||||
var hasKey = function(obj, keyName) {
|
var hasKey = function(obj, keyName) {
|
||||||
return obj !== null && obj[keyName] !== jasmine.undefined;
|
return obj != null && obj[keyName] !== undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
for (var property in b) {
|
for (var property in b) {
|
||||||
if (!hasKey(a, property) && hasKey(b, property)) {
|
if (!hasKey(a, property) && hasKey(b, property)) {
|
||||||
mismatchKeys.push("expected has key '" + property + "', but missing from actual.");
|
mismatchKeys.push("expected has key '" + property + "', but missing from <b>actual</b>.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (property in a) {
|
for (property in a) {
|
||||||
if (!hasKey(b, property) && hasKey(a, property)) {
|
if (!hasKey(b, property) && hasKey(a, property)) {
|
||||||
mismatchKeys.push("expected missing key '" + property + "', but present in actual.");
|
mismatchKeys.push("<b>expected</b> missing key '" + property + "', but present in actual.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (property in b) {
|
for (property in b) {
|
||||||
if (property == '__Jasmine_been_here_before__') continue;
|
if (property == '__Jasmine_been_here_before__') continue;
|
||||||
if (!this.equals_(a[property], b[property], mismatchKeys, mismatchValues)) {
|
if (!this.equals_(a[property], b[property], mismatchKeys, mismatchValues)) {
|
||||||
mismatchValues.push("'" + property + "' was '" + (b[property] ? jasmine.util.htmlEscape(b[property].toString()) : b[property]) + "' in expected, but was '" + (a[property] ? jasmine.util.htmlEscape(a[property].toString()) : a[property]) + "' in actual.");
|
mismatchValues.push("'" + property + "' was<br /><br />'" + (b[property] ? jasmine.util.htmlEscape(b[property].toString()) : b[property]) + "'<br /><br />in expected, but was<br /><br />'" + (a[property] ? jasmine.util.htmlEscape(a[property].toString()) : a[property]) + "'<br /><br />in actual.<br />");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,23 +139,17 @@ jasmine.Env.prototype.compareObjects_ = function(a, b, mismatchKeys, mismatchVal
|
|||||||
|
|
||||||
delete a.__Jasmine_been_here_before__;
|
delete a.__Jasmine_been_here_before__;
|
||||||
delete b.__Jasmine_been_here_before__;
|
delete b.__Jasmine_been_here_before__;
|
||||||
return (mismatchKeys.length === 0 && mismatchValues.length === 0);
|
return (mismatchKeys.length == 0 && mismatchValues.length == 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) {
|
jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) {
|
||||||
mismatchKeys = mismatchKeys || [];
|
mismatchKeys = mismatchKeys || [];
|
||||||
mismatchValues = mismatchValues || [];
|
mismatchValues = mismatchValues || [];
|
||||||
|
|
||||||
for (var i = 0; i < this.equalityTesters_.length; i++) {
|
|
||||||
var equalityTester = this.equalityTesters_[i];
|
|
||||||
var result = equalityTester(a, b, this, mismatchKeys, mismatchValues);
|
|
||||||
if (result !== jasmine.undefined) return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (a === b) return true;
|
if (a === b) return true;
|
||||||
|
|
||||||
if (a === jasmine.undefined || a === null || b === jasmine.undefined || b === null) {
|
if (a === undefined || a === null || b === undefined || b === null) {
|
||||||
return (a == jasmine.undefined && b == jasmine.undefined);
|
return (a == undefined && b == undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jasmine.isDomNode(a) && jasmine.isDomNode(b)) {
|
if (jasmine.isDomNode(a) && jasmine.isDomNode(b)) {
|
||||||
@@ -230,34 +160,24 @@ jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) {
|
|||||||
return a.getTime() == b.getTime();
|
return a.getTime() == b.getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a.jasmineMatches) {
|
if (a instanceof jasmine.Matchers.Any) {
|
||||||
return a.jasmineMatches(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (b.jasmineMatches) {
|
|
||||||
return b.jasmineMatches(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (a instanceof jasmine.Matchers.ObjectContaining) {
|
|
||||||
return a.matches(b);
|
return a.matches(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b instanceof jasmine.Matchers.ObjectContaining) {
|
if (b instanceof jasmine.Matchers.Any) {
|
||||||
return b.matches(a);
|
return b.matches(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jasmine.isString_(a) && jasmine.isString_(b)) {
|
|
||||||
return (a == b);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (jasmine.isNumber_(a) && jasmine.isNumber_(b)) {
|
|
||||||
return (a == b);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof a === "object" && typeof b === "object") {
|
if (typeof a === "object" && typeof b === "object") {
|
||||||
return this.compareObjects_(a, b, mismatchKeys, mismatchValues);
|
return this.compareObjects_(a, b, mismatchKeys, mismatchValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < this.equalityTesters_.length; i++) {
|
||||||
|
var equalityTester = this.equalityTesters_[i];
|
||||||
|
var result = equalityTester(a, b, this, mismatchKeys, mismatchValues);
|
||||||
|
if (result !== undefined) return result;
|
||||||
|
}
|
||||||
|
|
||||||
//Straight check
|
//Straight check
|
||||||
return (a === b);
|
return (a === b);
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
/** JavaScript API reporter.
|
||||||
|
*
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
jasmine.JsApiReporter = function() {
|
||||||
|
this.started = false;
|
||||||
|
this.finished = false;
|
||||||
|
this.suites = [];
|
||||||
|
this.results = {};
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.JsApiReporter.prototype.reportRunnerStarting = function(runner) {
|
||||||
|
this.started = true;
|
||||||
|
var suites = runner.suites();
|
||||||
|
for (var i = 0; i < suites.length; i++) {
|
||||||
|
var suite = suites[i];
|
||||||
|
this.suites.push(this.summarize_(suite));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) {
|
||||||
|
var isSuite = suiteOrSpec instanceof jasmine.Suite
|
||||||
|
var summary = {
|
||||||
|
id: suiteOrSpec.id,
|
||||||
|
name: suiteOrSpec.description,
|
||||||
|
type: isSuite ? 'suite' : 'spec',
|
||||||
|
children: []
|
||||||
|
};
|
||||||
|
if (isSuite) {
|
||||||
|
var specs = suiteOrSpec.specs();
|
||||||
|
for (var i = 0; i < specs.length; i++) {
|
||||||
|
summary.children.push(this.summarize_(specs[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return summary;
|
||||||
|
};
|
||||||
|
|
||||||
|
//noinspection JSUnusedLocalSymbols
|
||||||
|
jasmine.JsApiReporter.prototype.reportRunnerResults = function(runner) {
|
||||||
|
this.finished = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
//noinspection JSUnusedLocalSymbols
|
||||||
|
jasmine.JsApiReporter.prototype.reportSuiteResults = function(suite) {
|
||||||
|
};
|
||||||
|
|
||||||
|
//noinspection JSUnusedLocalSymbols
|
||||||
|
jasmine.JsApiReporter.prototype.reportSpecResults = function(spec) {
|
||||||
|
this.results[spec.id] = {
|
||||||
|
messages: spec.results.getItems(),
|
||||||
|
result: spec.results.failedCount > 0 ? "failed" : "passed"
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
//noinspection JSUnusedLocalSymbols
|
||||||
|
jasmine.JsApiReporter.prototype.log = function(str) {
|
||||||
|
};
|
||||||
|
|
||||||
@@ -0,0 +1,282 @@
|
|||||||
|
jasmine.Matchers = function(env, actual, results) {
|
||||||
|
this.env = env;
|
||||||
|
this.actual = actual;
|
||||||
|
this.passing_message = 'Passed.';
|
||||||
|
this.results = results || new jasmine.NestedResults();
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.Matchers.pp = function(str) {
|
||||||
|
return jasmine.util.htmlEscape(jasmine.pp(str));
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.Matchers.prototype.getResults = function() {
|
||||||
|
return this.results;
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.Matchers.prototype.report = function(result, failing_message, details) {
|
||||||
|
this.results.addResult(new jasmine.ExpectationResult(result, result ? this.passing_message : failing_message, details));
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Matcher that compares the actual to the expected using ===.
|
||||||
|
*
|
||||||
|
* @param expected
|
||||||
|
*/
|
||||||
|
jasmine.Matchers.prototype.toBe = function(expected) {
|
||||||
|
return this.report(this.actual === expected, 'Expected<br /><br />' + jasmine.Matchers.pp(expected)
|
||||||
|
+ '<br /><br />to be the same object as<br /><br />' + jasmine.Matchers.pp(this.actual)
|
||||||
|
+ '<br />');
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Matcher that compares the actual to the expected using !==
|
||||||
|
* @param expected
|
||||||
|
*/
|
||||||
|
jasmine.Matchers.prototype.toNotBe = function(expected) {
|
||||||
|
return this.report(this.actual !== expected, 'Expected<br /><br />' + jasmine.Matchers.pp(expected)
|
||||||
|
+ '<br /><br />to be a different object from actual, but they were the same.');
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Matcher that compares the actual to the expected using common sense equality. Handles Objects, Arrays, etc.
|
||||||
|
*
|
||||||
|
* @param expected
|
||||||
|
*/
|
||||||
|
jasmine.Matchers.prototype.toEqual = function(expected) {
|
||||||
|
var mismatchKeys = [];
|
||||||
|
var mismatchValues = [];
|
||||||
|
|
||||||
|
var formatMismatches = function(name, array) {
|
||||||
|
if (array.length == 0) return '';
|
||||||
|
var errorOutput = '<br /><br />Different ' + name + ':<br />';
|
||||||
|
for (var i = 0; i < array.length; i++) {
|
||||||
|
errorOutput += array[i] + '<br />';
|
||||||
|
}
|
||||||
|
return errorOutput;
|
||||||
|
};
|
||||||
|
|
||||||
|
return this.report(this.env.equals_(this.actual, expected, mismatchKeys, mismatchValues),
|
||||||
|
'Expected<br /><br />' + jasmine.Matchers.pp(expected)
|
||||||
|
+ '<br /><br />but got<br /><br />' + jasmine.Matchers.pp(this.actual)
|
||||||
|
+ '<br />'
|
||||||
|
+ formatMismatches('Keys', mismatchKeys)
|
||||||
|
+ formatMismatches('Values', mismatchValues), {
|
||||||
|
matcherName: 'toEqual', expected: expected, actual: this.actual
|
||||||
|
});
|
||||||
|
};
|
||||||
|
/** @deprecated */
|
||||||
|
jasmine.Matchers.prototype.should_equal = jasmine.Matchers.prototype.toEqual;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Matcher that compares the actual to the expected using the ! of jasmine.Matchers.toEqual
|
||||||
|
* @param expected
|
||||||
|
*/
|
||||||
|
jasmine.Matchers.prototype.toNotEqual = function(expected) {
|
||||||
|
return this.report(!this.env.equals_(this.actual, expected),
|
||||||
|
'Expected ' + jasmine.Matchers.pp(expected) + ' to not equal ' + jasmine.Matchers.pp(this.actual) + ', but it does.');
|
||||||
|
};
|
||||||
|
/** @deprecated */
|
||||||
|
jasmine.Matchers.prototype.should_not_equal = jasmine.Matchers.prototype.toNotEqual;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Matcher that compares the actual to the expected using a regular expression. Constructs a RegExp, so takes
|
||||||
|
* a pattern or a String.
|
||||||
|
*
|
||||||
|
* @param reg_exp
|
||||||
|
*/
|
||||||
|
jasmine.Matchers.prototype.toMatch = function(reg_exp) {
|
||||||
|
return this.report((new RegExp(reg_exp).test(this.actual)),
|
||||||
|
'Expected ' + jasmine.Matchers.pp(this.actual) + ' to match ' + reg_exp + '.');
|
||||||
|
};
|
||||||
|
/** @deprecated */
|
||||||
|
jasmine.Matchers.prototype.should_match = jasmine.Matchers.prototype.toMatch;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Matcher that compares the actual to the expected using the boolean inverse of jasmine.Matchers.toMatch
|
||||||
|
* @param reg_exp
|
||||||
|
*/
|
||||||
|
jasmine.Matchers.prototype.toNotMatch = function(reg_exp) {
|
||||||
|
return this.report((!new RegExp(reg_exp).test(this.actual)),
|
||||||
|
'Expected ' + jasmine.Matchers.pp(this.actual) + ' to not match ' + reg_exp + '.');
|
||||||
|
};
|
||||||
|
/** @deprecated */
|
||||||
|
jasmine.Matchers.prototype.should_not_match = jasmine.Matchers.prototype.toNotMatch;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Matcher that compares the acutal to undefined.
|
||||||
|
*/
|
||||||
|
jasmine.Matchers.prototype.toBeDefined = function() {
|
||||||
|
return this.report((this.actual !== undefined),
|
||||||
|
'Expected a value to be defined but it was undefined.');
|
||||||
|
};
|
||||||
|
/** @deprecated */
|
||||||
|
jasmine.Matchers.prototype.should_be_defined = jasmine.Matchers.prototype.toBeDefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Matcher that compares the actual to null.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
jasmine.Matchers.prototype.toBeNull = function() {
|
||||||
|
return this.report((this.actual === null),
|
||||||
|
'Expected a value to be null but it was ' + jasmine.Matchers.pp(this.actual) + '.');
|
||||||
|
};
|
||||||
|
/** @deprecated */
|
||||||
|
jasmine.Matchers.prototype.should_be_null = jasmine.Matchers.prototype.toBeNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Matcher that boolean not-nots the actual.
|
||||||
|
*/
|
||||||
|
jasmine.Matchers.prototype.toBeTruthy = function() {
|
||||||
|
return this.report(!!this.actual,
|
||||||
|
'Expected a value to be truthy but it was ' + jasmine.Matchers.pp(this.actual) + '.');
|
||||||
|
};
|
||||||
|
/** @deprecated */
|
||||||
|
jasmine.Matchers.prototype.should_be_truthy = jasmine.Matchers.prototype.toBeTruthy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Matcher that boolean nots the actual.
|
||||||
|
*/
|
||||||
|
jasmine.Matchers.prototype.toBeFalsy = function() {
|
||||||
|
return this.report(!this.actual,
|
||||||
|
'Expected a value to be falsy but it was ' + jasmine.Matchers.pp(this.actual) + '.');
|
||||||
|
};
|
||||||
|
/** @deprecated */
|
||||||
|
jasmine.Matchers.prototype.should_be_falsy = jasmine.Matchers.prototype.toBeFalsy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Matcher that checks to see if the acutal, a Jasmine spy, was called.
|
||||||
|
*/
|
||||||
|
jasmine.Matchers.prototype.wasCalled = function() {
|
||||||
|
if (!this.actual || !this.actual.isSpy) {
|
||||||
|
return this.report(false, 'Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.');
|
||||||
|
}
|
||||||
|
if (arguments.length > 0) {
|
||||||
|
return this.report(false, 'wasCalled matcher does not take arguments');
|
||||||
|
}
|
||||||
|
return this.report((this.actual.wasCalled),
|
||||||
|
'Expected spy "' + this.actual.identity + '" to have been called, but it was not.');
|
||||||
|
};
|
||||||
|
/** @deprecated */
|
||||||
|
jasmine.Matchers.prototype.was_called = jasmine.Matchers.prototype.wasCalled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Matcher that checks to see if the acutal, a Jasmine spy, was not called.
|
||||||
|
*/
|
||||||
|
jasmine.Matchers.prototype.wasNotCalled = function() {
|
||||||
|
if (!this.actual || !this.actual.isSpy) {
|
||||||
|
return this.report(false, 'Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.');
|
||||||
|
}
|
||||||
|
return this.report((!this.actual.wasCalled),
|
||||||
|
'Expected spy "' + this.actual.identity + '" to not have been called, but it was.');
|
||||||
|
};
|
||||||
|
/** @deprecated */
|
||||||
|
jasmine.Matchers.prototype.was_not_called = jasmine.Matchers.prototype.wasNotCalled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Matcher that checks to see if the acutal, a Jasmine spy, was called with a set of parameters.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
jasmine.Matchers.prototype.wasCalledWith = function() {
|
||||||
|
if (!this.actual || !this.actual.isSpy) {
|
||||||
|
return this.report(false, 'Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.', {
|
||||||
|
matcherName: 'wasCalledWith'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var args = jasmine.util.argsToArray(arguments);
|
||||||
|
|
||||||
|
return this.report(this.env.contains_(this.actual.argsForCall, args),
|
||||||
|
'Expected ' + jasmine.Matchers.pp(this.actual.argsForCall) + ' to contain ' + jasmine.Matchers.pp(args) + ', but it does not.', {
|
||||||
|
matcherName: 'wasCalledWith', expected: args, actual: this.actual.argsForCall
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Matcher that checks that the expected item is an element in the actual Array.
|
||||||
|
*
|
||||||
|
* @param {Object} item
|
||||||
|
*/
|
||||||
|
jasmine.Matchers.prototype.toContain = function(item) {
|
||||||
|
return this.report(this.env.contains_(this.actual, item),
|
||||||
|
'Expected ' + jasmine.Matchers.pp(this.actual) + ' to contain ' + jasmine.Matchers.pp(item) + ', but it does not.', {
|
||||||
|
matcherName: 'toContain', expected: item, actual: this.actual
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Matcher that checks that the expected item is NOT an element in the actual Array.
|
||||||
|
*
|
||||||
|
* @param {Object} item
|
||||||
|
*/
|
||||||
|
jasmine.Matchers.prototype.toNotContain = function(item) {
|
||||||
|
return this.report(!this.env.contains_(this.actual, item),
|
||||||
|
'Expected ' + jasmine.Matchers.pp(this.actual) + ' not to contain ' + jasmine.Matchers.pp(item) + ', but it does.');
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.Matchers.prototype.toBeLessThan = function(expected) {
|
||||||
|
return this.report(this.actual < expected,
|
||||||
|
'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be less than ' + jasmine.Matchers.pp(expected) + ', but it was not.');
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.Matchers.prototype.toBeGreaterThan = function(expected) {
|
||||||
|
return this.report(this.actual > expected,
|
||||||
|
'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be greater than ' + jasmine.Matchers.pp(expected) + ', but it was not.');
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Matcher that checks that the expected exception was thrown by the actual.
|
||||||
|
*
|
||||||
|
* @param {String} expectedException
|
||||||
|
*/
|
||||||
|
jasmine.Matchers.prototype.toThrow = function(expectedException) {
|
||||||
|
var exception = null;
|
||||||
|
try {
|
||||||
|
this.actual();
|
||||||
|
} catch (e) {
|
||||||
|
exception = e;
|
||||||
|
}
|
||||||
|
if (expectedException !== undefined) {
|
||||||
|
if (exception == null) {
|
||||||
|
return this.report(false, "Expected function to throw " + jasmine.Matchers.pp(expectedException) + ", but it did not.");
|
||||||
|
}
|
||||||
|
return this.report(
|
||||||
|
this.env.equals_(
|
||||||
|
exception.message || exception,
|
||||||
|
expectedException.message || expectedException),
|
||||||
|
"Expected function to throw " + jasmine.Matchers.pp(expectedException) + ", but it threw " + jasmine.Matchers.pp(exception) + ".");
|
||||||
|
} else {
|
||||||
|
return this.report(exception != null, "Expected function to throw an exception, but it did not.");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.Matchers.Any = function(expectedClass) {
|
||||||
|
this.expectedClass = expectedClass;
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.Matchers.Any.prototype.matches = function(other) {
|
||||||
|
if (this.expectedClass == String) {
|
||||||
|
return typeof other == 'string' || other instanceof String;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.expectedClass == Number) {
|
||||||
|
return typeof other == 'number' || other instanceof Number;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.expectedClass == Function) {
|
||||||
|
return typeof other == 'function' || other instanceof Function;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.expectedClass == Object) {
|
||||||
|
return typeof other == 'object';
|
||||||
|
}
|
||||||
|
|
||||||
|
return other instanceof this.expectedClass;
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.Matchers.Any.prototype.toString = function() {
|
||||||
|
return '<jasmine.any(' + this.expectedClass + ')>';
|
||||||
|
};
|
||||||
|
|
||||||
@@ -11,14 +11,7 @@ jasmine.MultiReporter.prototype.addReporter = function(reporter) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var functionNames = [
|
var functionNames = ["reportRunnerStarting", "reportRunnerResults", "reportSuiteResults", "reportSpecResults", "log"];
|
||||||
"reportRunnerStarting",
|
|
||||||
"reportRunnerResults",
|
|
||||||
"reportSuiteResults",
|
|
||||||
"reportSpecStarting",
|
|
||||||
"reportSpecResults",
|
|
||||||
"log"
|
|
||||||
];
|
|
||||||
for (var i = 0; i < functionNames.length; i++) {
|
for (var i = 0; i < functionNames.length; i++) {
|
||||||
var functionName = functionNames[i];
|
var functionName = functionNames[i];
|
||||||
jasmine.MultiReporter.prototype[functionName] = (function(functionName) {
|
jasmine.MultiReporter.prototype[functionName] = (function(functionName) {
|
||||||
@@ -38,11 +38,11 @@ jasmine.NestedResults.prototype.rollupCounts = function(result) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a log message.
|
* Tracks a result's message.
|
||||||
* @param values Array of message parts which will be concatenated later.
|
* @param message
|
||||||
*/
|
*/
|
||||||
jasmine.NestedResults.prototype.log = function(values) {
|
jasmine.NestedResults.prototype.log = function(message) {
|
||||||
this.items_.push(new jasmine.MessageResult(values));
|
this.items_.push(new jasmine.MessageResult(message));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,7 +57,7 @@ jasmine.NestedResults.prototype.getItems = function() {
|
|||||||
* @param {jasmine.ExpectationResult|jasmine.NestedResults} result
|
* @param {jasmine.ExpectationResult|jasmine.NestedResults} result
|
||||||
*/
|
*/
|
||||||
jasmine.NestedResults.prototype.addResult = function(result) {
|
jasmine.NestedResults.prototype.addResult = function(result) {
|
||||||
if (result.type != 'log') {
|
if (result.type != 'MessageResult') {
|
||||||
if (result.items_) {
|
if (result.items_) {
|
||||||
this.rollupCounts(result);
|
this.rollupCounts(result);
|
||||||
} else {
|
} else {
|
||||||
@@ -9,28 +9,26 @@ jasmine.PrettyPrinter = function() {
|
|||||||
* Formats a value in a nice, human-readable string.
|
* Formats a value in a nice, human-readable string.
|
||||||
*
|
*
|
||||||
* @param value
|
* @param value
|
||||||
|
* @returns {String}
|
||||||
*/
|
*/
|
||||||
jasmine.PrettyPrinter.prototype.format = function(value) {
|
jasmine.PrettyPrinter.prototype.format = function(value) {
|
||||||
if (this.ppNestLevel_ > 40) {
|
if (this.ppNestLevel_ > 40) {
|
||||||
|
// return '(jasmine.pp nested too deeply!)';
|
||||||
throw new Error('jasmine.PrettyPrinter: format() nested too deeply!');
|
throw new Error('jasmine.PrettyPrinter: format() nested too deeply!');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ppNestLevel_++;
|
this.ppNestLevel_++;
|
||||||
try {
|
try {
|
||||||
if (value === jasmine.undefined) {
|
if (value === undefined) {
|
||||||
this.emitScalar('undefined');
|
this.emitScalar('undefined');
|
||||||
} else if (value === null) {
|
} else if (value === null) {
|
||||||
this.emitScalar('null');
|
this.emitScalar('null');
|
||||||
} else if (value === jasmine.getGlobal()) {
|
} else if (value.navigator && value.frames && value.setTimeout) {
|
||||||
this.emitScalar('<global>');
|
this.emitScalar('<window>');
|
||||||
} else if (value.jasmineToString) {
|
} else if (value instanceof jasmine.Matchers.Any) {
|
||||||
this.emitScalar(value.jasmineToString());
|
this.emitScalar(value.toString());
|
||||||
} else if (typeof value === 'string') {
|
} else if (typeof value === 'string') {
|
||||||
this.emitString(value);
|
this.emitString(value);
|
||||||
} else if (jasmine.isSpy(value)) {
|
|
||||||
this.emitScalar("spy on " + value.identity);
|
|
||||||
} else if (value instanceof RegExp) {
|
|
||||||
this.emitScalar(value.toString());
|
|
||||||
} else if (typeof value === 'function') {
|
} else if (typeof value === 'function') {
|
||||||
this.emitScalar('Function');
|
this.emitScalar('Function');
|
||||||
} else if (typeof value.nodeType === 'number') {
|
} else if (typeof value.nodeType === 'number') {
|
||||||
@@ -58,8 +56,7 @@ jasmine.PrettyPrinter.prototype.format = function(value) {
|
|||||||
jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) {
|
jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) {
|
||||||
for (var property in obj) {
|
for (var property in obj) {
|
||||||
if (property == '__Jasmine_been_here_before__') continue;
|
if (property == '__Jasmine_been_here_before__') continue;
|
||||||
fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) !== jasmine.undefined &&
|
fn(property, obj.__lookupGetter__(property) != null);
|
||||||
obj.__lookupGetter__(property) !== null) : false);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
jasmine.Queue = function(env) {
|
||||||
|
this.env = env;
|
||||||
|
this.blocks = [];
|
||||||
|
this.running = false;
|
||||||
|
this.index = 0;
|
||||||
|
this.offset = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.Queue.prototype.addBefore = function (block) {
|
||||||
|
this.blocks.unshift(block);
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.Queue.prototype.add = function(block) {
|
||||||
|
this.blocks.push(block);
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.Queue.prototype.insertNext = function (block) {
|
||||||
|
this.blocks.splice((this.index + this.offset + 1), 0, block);
|
||||||
|
this.offset++;
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.Queue.prototype.start = function(onComplete) {
|
||||||
|
var self = this;
|
||||||
|
self.running = true;
|
||||||
|
self.onComplete = onComplete;
|
||||||
|
if (self.blocks[0]) {
|
||||||
|
self.blocks[0].execute(function () {
|
||||||
|
self._next();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
self.finish();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.Queue.prototype.isRunning = function () {
|
||||||
|
return this.running;
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.Queue.prototype._next = function () {
|
||||||
|
var self = this;
|
||||||
|
var doNext = function () {
|
||||||
|
self.offset = 0;
|
||||||
|
self.index++;
|
||||||
|
if (self.index < self.blocks.length) {
|
||||||
|
self.blocks[self.index].execute(function () {
|
||||||
|
self._next();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
self.finish();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var now = new Date().getTime();
|
||||||
|
if (this.env.updateInterval && now - this.env.lastUpdate > this.env.updateInterval) {
|
||||||
|
this.env.lastUpdate = now;
|
||||||
|
this.env.setTimeout(doNext, 0);
|
||||||
|
} else {
|
||||||
|
doNext();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.Queue.prototype.finish = function () {
|
||||||
|
this.running = false;
|
||||||
|
if (this.onComplete) {
|
||||||
|
this.onComplete();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.Queue.prototype.getResults = function () {
|
||||||
|
var results = new jasmine.NestedResults();
|
||||||
|
for (var i = 0; i < this.blocks.length; i++) {
|
||||||
|
if (this.blocks[i].getResults) {
|
||||||
|
results.addResult(this.blocks[i].getResults());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -17,10 +17,6 @@ jasmine.Reporter.prototype.reportRunnerResults = function(runner) {
|
|||||||
jasmine.Reporter.prototype.reportSuiteResults = function(suite) {
|
jasmine.Reporter.prototype.reportSuiteResults = function(suite) {
|
||||||
};
|
};
|
||||||
|
|
||||||
//noinspection JSUnusedLocalSymbols
|
|
||||||
jasmine.Reporter.prototype.reportSpecStarting = function(spec) {
|
|
||||||
};
|
|
||||||
|
|
||||||
//noinspection JSUnusedLocalSymbols
|
//noinspection JSUnusedLocalSymbols
|
||||||
jasmine.Reporter.prototype.reportSpecResults = function(spec) {
|
jasmine.Reporter.prototype.reportSpecResults = function(spec) {
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/* JasmineReporters.reporter
|
||||||
|
* Base object that will get called whenever a Spec, Suite, or Runner is done. It is up to
|
||||||
|
* descendants of this object to do something with the results (see json_reporter.js)
|
||||||
|
*/
|
||||||
|
jasmine.Reporters = {};
|
||||||
|
|
||||||
|
jasmine.Reporters.reporter = function(callbacks) {
|
||||||
|
var that = {
|
||||||
|
callbacks: callbacks || {},
|
||||||
|
|
||||||
|
doCallback: function(callback, results) {
|
||||||
|
if (callback) {
|
||||||
|
callback(results);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
reportRunnerResults: function(runner) {
|
||||||
|
that.doCallback(that.callbacks.runnerCallback, runner);
|
||||||
|
},
|
||||||
|
reportSuiteResults: function(suite) {
|
||||||
|
that.doCallback(that.callbacks.suiteCallback, suite);
|
||||||
|
},
|
||||||
|
reportSpecResults: function(spec) {
|
||||||
|
that.doCallback(that.callbacks.specCallback, spec);
|
||||||
|
},
|
||||||
|
log: function (str) {
|
||||||
|
if (console && console.log) console.log(str);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return that;
|
||||||
|
};
|
||||||
|
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
/**
|
||||||
|
* Runner
|
||||||
|
*
|
||||||
|
* @constructor
|
||||||
|
* @param {jasmine.Env} env
|
||||||
|
*/
|
||||||
|
jasmine.Runner = function(env) {
|
||||||
|
var self = this;
|
||||||
|
self.env = env;
|
||||||
|
self.queue = new jasmine.Queue(env);
|
||||||
|
self.suites_ = [];
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.Runner.prototype.execute = function() {
|
||||||
|
var self = this;
|
||||||
|
if (self.env.reporter.reportRunnerStarting) {
|
||||||
|
self.env.reporter.reportRunnerStarting(this);
|
||||||
|
}
|
||||||
|
self.queue.start(function () {
|
||||||
|
self.finishCallback();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.Runner.prototype.finishCallback = function() {
|
||||||
|
this.env.reporter.reportRunnerResults(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.Runner.prototype.addSuite = function(suite) {
|
||||||
|
this.suites_.push(suite);
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.Runner.prototype.add = function(block) {
|
||||||
|
if (block instanceof jasmine.Suite) {
|
||||||
|
this.addSuite(block);
|
||||||
|
}
|
||||||
|
this.queue.add(block);
|
||||||
|
};
|
||||||
|
|
||||||
|
/** @deprecated */
|
||||||
|
jasmine.Runner.prototype.getAllSuites = function() {
|
||||||
|
return this.suites_;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
jasmine.Runner.prototype.suites = function() {
|
||||||
|
return this.suites_;
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.Runner.prototype.getResults = function() {
|
||||||
|
return this.queue.getResults();
|
||||||
|
};
|
||||||
@@ -7,14 +7,8 @@
|
|||||||
* @param {String} description
|
* @param {String} description
|
||||||
*/
|
*/
|
||||||
jasmine.Spec = function(env, suite, description) {
|
jasmine.Spec = function(env, suite, description) {
|
||||||
if (!env) {
|
|
||||||
throw new Error('jasmine.Env() required');
|
|
||||||
}
|
|
||||||
if (!suite) {
|
|
||||||
throw new Error('jasmine.Suite() required');
|
|
||||||
}
|
|
||||||
var spec = this;
|
var spec = this;
|
||||||
spec.id = env.nextSpecId ? env.nextSpecId() : null;
|
spec.id = env.nextSpecId_++;
|
||||||
spec.env = env;
|
spec.env = env;
|
||||||
spec.suite = suite;
|
spec.suite = suite;
|
||||||
spec.description = description;
|
spec.description = description;
|
||||||
@@ -23,8 +17,8 @@ jasmine.Spec = function(env, suite, description) {
|
|||||||
spec.afterCallbacks = [];
|
spec.afterCallbacks = [];
|
||||||
spec.spies_ = [];
|
spec.spies_ = [];
|
||||||
|
|
||||||
spec.results_ = new jasmine.NestedResults();
|
spec.results = new jasmine.NestedResults();
|
||||||
spec.results_.description = description;
|
spec.results.description = description;
|
||||||
spec.matchersClass = null;
|
spec.matchersClass = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -32,18 +26,8 @@ jasmine.Spec.prototype.getFullName = function() {
|
|||||||
return this.suite.getFullName() + ' ' + this.description + '.';
|
return this.suite.getFullName() + ' ' + this.description + '.';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
jasmine.Spec.prototype.getResults = function() {
|
||||||
jasmine.Spec.prototype.results = function() {
|
return this.results;
|
||||||
return this.results_;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* All parameters are pretty-printed and concatenated together, then written to the spec's output.
|
|
||||||
*
|
|
||||||
* Be careful not to leave calls to <code>jasmine.log</code> in production code.
|
|
||||||
*/
|
|
||||||
jasmine.Spec.prototype.log = function() {
|
|
||||||
return this.results_.log(arguments);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Spec.prototype.runs = function (func) {
|
jasmine.Spec.prototype.runs = function (func) {
|
||||||
@@ -61,73 +45,38 @@ jasmine.Spec.prototype.addToQueue = function (block) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {jasmine.ExpectationResult} result
|
* @private
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
jasmine.Spec.prototype.addMatcherResult = function(result) {
|
jasmine.Spec.prototype.expects_that = function(actual) {
|
||||||
this.results_.addResult(result);
|
return this.expect(actual);
|
||||||
};
|
|
||||||
|
|
||||||
jasmine.Spec.prototype.expect = function(actual) {
|
|
||||||
var positive = new (this.getMatchersClass_())(this.env, actual, this);
|
|
||||||
positive.not = new (this.getMatchersClass_())(this.env, actual, this, true);
|
|
||||||
return positive;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Waits a fixed time period before moving to the next block.
|
* @private
|
||||||
*
|
|
||||||
* @deprecated Use waitsFor() instead
|
|
||||||
* @param {Number} timeout milliseconds to wait
|
|
||||||
*/
|
*/
|
||||||
|
jasmine.Spec.prototype.expect = function(actual) {
|
||||||
|
return new (this.getMatchersClass_())(this.env, actual, this.results);
|
||||||
|
};
|
||||||
|
|
||||||
jasmine.Spec.prototype.waits = function(timeout) {
|
jasmine.Spec.prototype.waits = function(timeout) {
|
||||||
var waitsFunc = new jasmine.WaitsBlock(this.env, timeout, this);
|
var waitsFunc = new jasmine.WaitsBlock(this.env, timeout, this);
|
||||||
this.addToQueue(waitsFunc);
|
this.addToQueue(waitsFunc);
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
jasmine.Spec.prototype.waitsFor = function(timeout, latchFunction, timeoutMessage) {
|
||||||
* Waits for the latchFunction to return true before proceeding to the next block.
|
var waitsForFunc = new jasmine.WaitsForBlock(this.env, timeout, latchFunction, timeoutMessage, this);
|
||||||
*
|
|
||||||
* @param {Function} latchFunction
|
|
||||||
* @param {String} optional_timeoutMessage
|
|
||||||
* @param {Number} optional_timeout
|
|
||||||
*/
|
|
||||||
jasmine.Spec.prototype.waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout) {
|
|
||||||
var latchFunction_ = null;
|
|
||||||
var optional_timeoutMessage_ = null;
|
|
||||||
var optional_timeout_ = null;
|
|
||||||
|
|
||||||
for (var i = 0; i < arguments.length; i++) {
|
|
||||||
var arg = arguments[i];
|
|
||||||
switch (typeof arg) {
|
|
||||||
case 'function':
|
|
||||||
latchFunction_ = arg;
|
|
||||||
break;
|
|
||||||
case 'string':
|
|
||||||
optional_timeoutMessage_ = arg;
|
|
||||||
break;
|
|
||||||
case 'number':
|
|
||||||
optional_timeout_ = arg;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var waitsForFunc = new jasmine.WaitsForBlock(this.env, optional_timeout_, latchFunction_, optional_timeoutMessage_, this);
|
|
||||||
this.addToQueue(waitsForFunc);
|
this.addToQueue(waitsForFunc);
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Spec.prototype.fail = function (e) {
|
jasmine.Spec.prototype.failWithException = function (e) {
|
||||||
var expectationResult = new jasmine.ExpectationResult({
|
this.results.addResult(new jasmine.ExpectationResult(false, jasmine.util.formatException(e), null));
|
||||||
passed: false,
|
|
||||||
message: e ? jasmine.util.formatException(e) : 'Exception',
|
|
||||||
trace: { stack: e.stack }
|
|
||||||
});
|
|
||||||
this.results_.addResult(expectationResult);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Spec.prototype.getMatchersClass_ = function() {
|
jasmine.Spec.prototype.getMatchersClass_ = function() {
|
||||||
return this.matchersClass || this.env.matchersClass;
|
return this.matchersClass || jasmine.Matchers;
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Spec.prototype.addMatchers = function(matchersPrototype) {
|
jasmine.Spec.prototype.addMatchers = function(matchersPrototype) {
|
||||||
@@ -136,7 +85,9 @@ jasmine.Spec.prototype.addMatchers = function(matchersPrototype) {
|
|||||||
parent.apply(this, arguments);
|
parent.apply(this, arguments);
|
||||||
};
|
};
|
||||||
jasmine.util.inherit(newMatchersClass, parent);
|
jasmine.util.inherit(newMatchersClass, parent);
|
||||||
jasmine.Matchers.wrapInto_(matchersPrototype, newMatchersClass);
|
for (var method in matchersPrototype) {
|
||||||
|
newMatchersClass.prototype[method] = matchersPrototype[method];
|
||||||
|
}
|
||||||
this.matchersClass = newMatchersClass;
|
this.matchersClass = newMatchersClass;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -152,56 +103,51 @@ jasmine.Spec.prototype.finish = function(onComplete) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Spec.prototype.after = function(doAfter) {
|
jasmine.Spec.prototype.after = function(doAfter, test) {
|
||||||
if (this.queue.isRunning()) {
|
|
||||||
|
if (this.queue.isRunning()) {
|
||||||
this.queue.add(new jasmine.Block(this.env, doAfter, this));
|
this.queue.add(new jasmine.Block(this.env, doAfter, this));
|
||||||
} else {
|
} else {
|
||||||
this.afterCallbacks.unshift(doAfter);
|
this.afterCallbacks.unshift(doAfter);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Spec.prototype.execute = function(onComplete) {
|
jasmine.Spec.prototype.execute = function(onComplete) {
|
||||||
var spec = this;
|
var spec = this;
|
||||||
if (!spec.env.specFilter(spec)) {
|
if (!spec.env.specFilter(spec)) {
|
||||||
spec.results_.skipped = true;
|
spec.results.skipped = true;
|
||||||
spec.finish(onComplete);
|
spec.finish(onComplete);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this.env.reporter.log('>> Jasmine Running ' + this.suite.description + ' ' + this.description + '...');
|
||||||
this.env.reporter.reportSpecStarting(this);
|
|
||||||
|
|
||||||
spec.env.currentSpec = spec;
|
spec.env.currentSpec = spec;
|
||||||
|
spec.env.currentlyRunningTests = true;
|
||||||
|
|
||||||
spec.addBeforesAndAftersToQueue();
|
spec.addBeforesAndAftersToQueue();
|
||||||
|
|
||||||
spec.queue.start(function () {
|
spec.queue.start(function () {
|
||||||
spec.finish(onComplete);
|
spec.finish(onComplete);
|
||||||
});
|
});
|
||||||
|
spec.env.currentlyRunningTests = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() {
|
jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() {
|
||||||
var runner = this.env.currentRunner();
|
|
||||||
var i;
|
|
||||||
|
|
||||||
for (var suite = this.suite; suite; suite = suite.parentSuite) {
|
for (var suite = this.suite; suite; suite = suite.parentSuite) {
|
||||||
for (i = 0; i < suite.before_.length; i++) {
|
if (suite.beforeQueue) {
|
||||||
this.queue.addBefore(new jasmine.Block(this.env, suite.before_[i], this));
|
for (var i = 0; i < suite.beforeQueue.length; i++)
|
||||||
|
this.queue.addBefore(new jasmine.Block(this.env, suite.beforeQueue[i], this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < runner.before_.length; i++) {
|
|
||||||
this.queue.addBefore(new jasmine.Block(this.env, runner.before_[i], this));
|
|
||||||
}
|
|
||||||
for (i = 0; i < this.afterCallbacks.length; i++) {
|
for (i = 0; i < this.afterCallbacks.length; i++) {
|
||||||
this.queue.add(new jasmine.Block(this.env, this.afterCallbacks[i], this));
|
this.queue.add(new jasmine.Block(this.env, this.afterCallbacks[i], this));
|
||||||
}
|
}
|
||||||
for (suite = this.suite; suite; suite = suite.parentSuite) {
|
for (suite = this.suite; suite; suite = suite.parentSuite) {
|
||||||
for (i = 0; i < suite.after_.length; i++) {
|
if (suite.afterQueue) {
|
||||||
this.queue.add(new jasmine.Block(this.env, suite.after_[i], this));
|
for (var j = 0; j < suite.afterQueue.length; j++)
|
||||||
|
this.queue.add(new jasmine.Block(this.env, suite.afterQueue[j], this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < runner.after_.length; i++) {
|
|
||||||
this.queue.add(new jasmine.Block(this.env, runner.after_[i], this));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Spec.prototype.explodes = function() {
|
jasmine.Spec.prototype.explodes = function() {
|
||||||
@@ -209,11 +155,11 @@ jasmine.Spec.prototype.explodes = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Spec.prototype.spyOn = function(obj, methodName, ignoreMethodDoesntExist) {
|
jasmine.Spec.prototype.spyOn = function(obj, methodName, ignoreMethodDoesntExist) {
|
||||||
if (obj == jasmine.undefined) {
|
if (obj == undefined) {
|
||||||
throw "spyOn could not find an object to spy upon for " + methodName + "()";
|
throw "spyOn could not find an object to spy upon for " + methodName + "()";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ignoreMethodDoesntExist && obj[methodName] === jasmine.undefined) {
|
if (!ignoreMethodDoesntExist && obj[methodName] === undefined) {
|
||||||
throw methodName + '() method does not exist';
|
throw methodName + '() method does not exist';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9,15 +9,13 @@
|
|||||||
*/
|
*/
|
||||||
jasmine.Suite = function(env, description, specDefinitions, parentSuite) {
|
jasmine.Suite = function(env, description, specDefinitions, parentSuite) {
|
||||||
var self = this;
|
var self = this;
|
||||||
self.id = env.nextSuiteId ? env.nextSuiteId() : null;
|
self.id = env.nextSuiteId_++;
|
||||||
self.description = description;
|
self.description = description;
|
||||||
self.queue = new jasmine.Queue(env);
|
self.queue = new jasmine.Queue(env);
|
||||||
self.parentSuite = parentSuite;
|
self.parentSuite = parentSuite;
|
||||||
self.env = env;
|
self.env = env;
|
||||||
self.before_ = [];
|
self.beforeQueue = [];
|
||||||
self.after_ = [];
|
self.afterQueue = [];
|
||||||
self.children_ = [];
|
|
||||||
self.suites_ = [];
|
|
||||||
self.specs_ = [];
|
self.specs_ = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -39,44 +37,39 @@ jasmine.Suite.prototype.finish = function(onComplete) {
|
|||||||
|
|
||||||
jasmine.Suite.prototype.beforeEach = function(beforeEachFunction) {
|
jasmine.Suite.prototype.beforeEach = function(beforeEachFunction) {
|
||||||
beforeEachFunction.typeName = 'beforeEach';
|
beforeEachFunction.typeName = 'beforeEach';
|
||||||
this.before_.unshift(beforeEachFunction);
|
this.beforeQueue.push(beforeEachFunction);
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Suite.prototype.afterEach = function(afterEachFunction) {
|
jasmine.Suite.prototype.afterEach = function(afterEachFunction) {
|
||||||
afterEachFunction.typeName = 'afterEach';
|
afterEachFunction.typeName = 'afterEach';
|
||||||
this.after_.unshift(afterEachFunction);
|
this.afterQueue.push(afterEachFunction);
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Suite.prototype.results = function() {
|
jasmine.Suite.prototype.getResults = function() {
|
||||||
return this.queue.results();
|
return this.queue.getResults();
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Suite.prototype.add = function(suiteOrSpec) {
|
jasmine.Suite.prototype.add = function(block) {
|
||||||
this.children_.push(suiteOrSpec);
|
if (block instanceof jasmine.Suite) {
|
||||||
if (suiteOrSpec instanceof jasmine.Suite) {
|
this.env.currentRunner.addSuite(block);
|
||||||
this.suites_.push(suiteOrSpec);
|
|
||||||
this.env.currentRunner().addSuite(suiteOrSpec);
|
|
||||||
} else {
|
} else {
|
||||||
this.specs_.push(suiteOrSpec);
|
this.specs_.push(block);
|
||||||
}
|
}
|
||||||
this.queue.add(suiteOrSpec);
|
this.queue.add(block);
|
||||||
|
};
|
||||||
|
|
||||||
|
/** @deprecated */
|
||||||
|
jasmine.Suite.prototype.specCount = function() {
|
||||||
|
return this.specs_.length;
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Suite.prototype.specs = function() {
|
jasmine.Suite.prototype.specs = function() {
|
||||||
return this.specs_;
|
return this.specs_;
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Suite.prototype.suites = function() {
|
|
||||||
return this.suites_;
|
|
||||||
};
|
|
||||||
|
|
||||||
jasmine.Suite.prototype.children = function() {
|
|
||||||
return this.children_;
|
|
||||||
};
|
|
||||||
|
|
||||||
jasmine.Suite.prototype.execute = function(onComplete) {
|
jasmine.Suite.prototype.execute = function(onComplete) {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.queue.start(function () {
|
this.queue.start(function () {
|
||||||
self.finish(onComplete);
|
self.finish(onComplete);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -6,9 +6,7 @@ jasmine.WaitsBlock = function(env, timeout, spec) {
|
|||||||
jasmine.util.inherit(jasmine.WaitsBlock, jasmine.Block);
|
jasmine.util.inherit(jasmine.WaitsBlock, jasmine.Block);
|
||||||
|
|
||||||
jasmine.WaitsBlock.prototype.execute = function (onComplete) {
|
jasmine.WaitsBlock.prototype.execute = function (onComplete) {
|
||||||
if (jasmine.VERBOSE) {
|
this.env.reporter.log('>> Jasmine waiting for ' + this.timeout + ' ms...');
|
||||||
this.env.reporter.log('>> Jasmine waiting for ' + this.timeout + ' ms...');
|
|
||||||
}
|
|
||||||
this.env.setTimeout(function () {
|
this.env.setTimeout(function () {
|
||||||
onComplete();
|
onComplete();
|
||||||
}, this.timeout);
|
}, this.timeout);
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
jasmine.WaitsForBlock = function(env, timeout, latchFunction, message, spec) {
|
||||||
|
this.timeout = timeout;
|
||||||
|
this.latchFunction = latchFunction;
|
||||||
|
this.message = message;
|
||||||
|
this.totalTimeSpentWaitingForLatch = 0;
|
||||||
|
jasmine.Block.call(this, env, null, spec);
|
||||||
|
};
|
||||||
|
|
||||||
|
jasmine.util.inherit(jasmine.WaitsForBlock, jasmine.Block);
|
||||||
|
|
||||||
|
jasmine.WaitsForBlock.TIMEOUT_INCREMENT = 100;
|
||||||
|
|
||||||
|
jasmine.WaitsForBlock.prototype.execute = function (onComplete) {
|
||||||
|
var self = this;
|
||||||
|
self.env.reporter.log('>> Jasmine waiting for ' + (self.message || 'something to happen'));
|
||||||
|
var latchFunctionResult;
|
||||||
|
try {
|
||||||
|
latchFunctionResult = self.latchFunction.apply(self.spec);
|
||||||
|
} catch (e) {
|
||||||
|
self.fail(e);
|
||||||
|
onComplete();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (latchFunctionResult) {
|
||||||
|
onComplete();
|
||||||
|
} else if (self.totalTimeSpentWaitingForLatch >= self.timeout) {
|
||||||
|
var message = 'timed out after ' + self.timeout + ' msec waiting for ' + (self.message || 'something to happen');
|
||||||
|
self.fail({
|
||||||
|
name: 'timeout',
|
||||||
|
message: message
|
||||||
|
});
|
||||||
|
self.spec._next();
|
||||||
|
} else {
|
||||||
|
self.totalTimeSpentWaitingForLatch += jasmine.WaitsForBlock.TIMEOUT_INCREMENT;
|
||||||
|
self.env.setTimeout(function () { self.execute(onComplete); }, jasmine.WaitsForBlock.TIMEOUT_INCREMENT);
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -1,12 +1,10 @@
|
|||||||
var isCommonJS = typeof window == "undefined";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework.
|
* Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework.
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var jasmine = {};
|
var jasmine = {};
|
||||||
if (isCommonJS) exports.jasmine = jasmine;
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@@ -15,40 +13,7 @@ jasmine.unimplementedMethod_ = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use <code>jasmine.undefined</code> instead of <code>undefined</code>, since <code>undefined</code> is just
|
* Allows for bound functions to be comapred. Internal use only.
|
||||||
* a plain old variable and may be redefined by somebody else.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
jasmine.undefined = jasmine.___undefined___;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show diagnostic messages in the console if set to true
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
jasmine.VERBOSE = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default interval in milliseconds for event loop yields (e.g. to allow network activity or to refresh the screen with the HTML-based runner). Small values here may result in slow test running. Zero means no updates until all tests have completed.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
jasmine.DEFAULT_UPDATE_INTERVAL = 250;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default timeout interval in milliseconds for waitsFor() blocks.
|
|
||||||
*/
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000;
|
|
||||||
|
|
||||||
jasmine.getGlobal = function() {
|
|
||||||
function getGlobal() {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
return getGlobal();
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allows for bound functions to be compared. Internal use only.
|
|
||||||
*
|
*
|
||||||
* @ignore
|
* @ignore
|
||||||
* @private
|
* @private
|
||||||
@@ -57,54 +22,28 @@ jasmine.getGlobal = function() {
|
|||||||
*/
|
*/
|
||||||
jasmine.bindOriginal_ = function(base, name) {
|
jasmine.bindOriginal_ = function(base, name) {
|
||||||
var original = base[name];
|
var original = base[name];
|
||||||
if (original.apply) {
|
return function() {
|
||||||
return function() {
|
return original.apply(base, arguments);
|
||||||
return original.apply(base, arguments);
|
};
|
||||||
};
|
|
||||||
} else {
|
|
||||||
// IE support
|
|
||||||
return jasmine.getGlobal()[name];
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.setTimeout = jasmine.bindOriginal_(jasmine.getGlobal(), 'setTimeout');
|
jasmine.setTimeout = jasmine.bindOriginal_(window, 'setTimeout');
|
||||||
jasmine.clearTimeout = jasmine.bindOriginal_(jasmine.getGlobal(), 'clearTimeout');
|
jasmine.clearTimeout = jasmine.bindOriginal_(window, 'clearTimeout');
|
||||||
jasmine.setInterval = jasmine.bindOriginal_(jasmine.getGlobal(), 'setInterval');
|
jasmine.setInterval = jasmine.bindOriginal_(window, 'setInterval');
|
||||||
jasmine.clearInterval = jasmine.bindOriginal_(jasmine.getGlobal(), 'clearInterval');
|
jasmine.clearInterval = jasmine.bindOriginal_(window, 'clearInterval');
|
||||||
|
|
||||||
jasmine.MessageResult = function(values) {
|
jasmine.MessageResult = function(text) {
|
||||||
this.type = 'log';
|
this.type = 'MessageResult';
|
||||||
this.values = values;
|
this.text = text;
|
||||||
this.trace = new Error(); // todo: test better
|
this.trace = new Error(); // todo: test better
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.MessageResult.prototype.toString = function() {
|
jasmine.ExpectationResult = function(passed, message, details) {
|
||||||
var text = "";
|
this.type = 'ExpectationResult';
|
||||||
for (var i = 0; i < this.values.length; i++) {
|
this.passed_ = passed;
|
||||||
if (i > 0) text += " ";
|
this.message = message;
|
||||||
if (jasmine.isString_(this.values[i])) {
|
this.details = details;
|
||||||
text += this.values[i];
|
this.trace = new Error(message); // todo: test better
|
||||||
} else {
|
|
||||||
text += jasmine.pp(this.values[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return text;
|
|
||||||
};
|
|
||||||
|
|
||||||
jasmine.ExpectationResult = function(params) {
|
|
||||||
this.type = 'expect';
|
|
||||||
this.matcherName = params.matcherName;
|
|
||||||
this.passed_ = params.passed;
|
|
||||||
this.expected = params.expected;
|
|
||||||
this.actual = params.actual;
|
|
||||||
this.message = this.passed_ ? 'Passed.' : params.message;
|
|
||||||
|
|
||||||
var trace = (params.trace || new Error(this.message));
|
|
||||||
this.trace = this.passed_ ? '' : trace;
|
|
||||||
};
|
|
||||||
|
|
||||||
jasmine.ExpectationResult.prototype.toString = function () {
|
|
||||||
return this.message;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.ExpectationResult.prototype.passed = function () {
|
jasmine.ExpectationResult.prototype.passed = function () {
|
||||||
@@ -115,8 +54,7 @@ jasmine.ExpectationResult.prototype.passed = function () {
|
|||||||
* Getter for the Jasmine environment. Ensures one gets created
|
* Getter for the Jasmine environment. Ensures one gets created
|
||||||
*/
|
*/
|
||||||
jasmine.getEnv = function() {
|
jasmine.getEnv = function() {
|
||||||
var env = jasmine.currentEnv_ = jasmine.currentEnv_ || new jasmine.Env();
|
return jasmine.currentEnv_ = jasmine.currentEnv_ || new jasmine.Env();
|
||||||
return env;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -126,38 +64,11 @@ jasmine.getEnv = function() {
|
|||||||
* @returns {Boolean}
|
* @returns {Boolean}
|
||||||
*/
|
*/
|
||||||
jasmine.isArray_ = function(value) {
|
jasmine.isArray_ = function(value) {
|
||||||
return jasmine.isA_("Array", value);
|
return value &&
|
||||||
};
|
typeof value === 'object' &&
|
||||||
|
typeof value.length === 'number' &&
|
||||||
/**
|
typeof value.splice === 'function' &&
|
||||||
* @ignore
|
!(value.propertyIsEnumerable('length'));
|
||||||
* @private
|
|
||||||
* @param value
|
|
||||||
* @returns {Boolean}
|
|
||||||
*/
|
|
||||||
jasmine.isString_ = function(value) {
|
|
||||||
return jasmine.isA_("String", value);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ignore
|
|
||||||
* @private
|
|
||||||
* @param value
|
|
||||||
* @returns {Boolean}
|
|
||||||
*/
|
|
||||||
jasmine.isNumber_ = function(value) {
|
|
||||||
return jasmine.isA_("Number", value);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ignore
|
|
||||||
* @private
|
|
||||||
* @param {String} typeName
|
|
||||||
* @param value
|
|
||||||
* @returns {Boolean}
|
|
||||||
*/
|
|
||||||
jasmine.isA_ = function(typeName, value) {
|
|
||||||
return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -179,7 +90,7 @@ jasmine.pp = function(value) {
|
|||||||
* @returns {Boolean}
|
* @returns {Boolean}
|
||||||
*/
|
*/
|
||||||
jasmine.isDomNode = function(obj) {
|
jasmine.isDomNode = function(obj) {
|
||||||
return obj.nodeType > 0;
|
return obj['nodeType'] > 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -187,7 +98,7 @@ jasmine.isDomNode = function(obj) {
|
|||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* // don't care about which function is passed in, as long as it's a function
|
* // don't care about which function is passed in, as long as it's a function
|
||||||
* expect(mySpy).toHaveBeenCalledWith(jasmine.any(Function));
|
* expect(mySpy).wasCalledWith(jasmine.any(Function));
|
||||||
*
|
*
|
||||||
* @param {Class} clazz
|
* @param {Class} clazz
|
||||||
* @returns matchable object of the type clazz
|
* @returns matchable object of the type clazz
|
||||||
@@ -196,33 +107,17 @@ jasmine.any = function(clazz) {
|
|||||||
return new jasmine.Matchers.Any(clazz);
|
return new jasmine.Matchers.Any(clazz);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a matchable subset of a JSON object. For use in expectations when you don't care about all of the
|
|
||||||
* attributes on the object.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* // don't care about any other attributes than foo.
|
|
||||||
* expect(mySpy).toHaveBeenCalledWith(jasmine.objectContaining({foo: "bar"});
|
|
||||||
*
|
|
||||||
* @param sample {Object} sample
|
|
||||||
* @returns matchable object for the sample
|
|
||||||
*/
|
|
||||||
jasmine.objectContaining = function (sample) {
|
|
||||||
return new jasmine.Matchers.ObjectContaining(sample);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Jasmine Spies are test doubles that can act as stubs, spies, fakes or when used in an expecation, mocks.
|
* Jasmine Spies are test doubles that can act as stubs, spies, fakes or when used in an expecation, mocks.
|
||||||
*
|
*
|
||||||
* Spies should be created in test setup, before expectations. They can then be checked, using the standard Jasmine
|
* Spies should be created in test setup, before expectations. They can then be checked, using the standard Jasmine
|
||||||
* expectation syntax. Spies can be checked if they were called or not and what the calling params were.
|
* expectation syntax. Spies can be checked if they were called or not and what the calling params were.
|
||||||
*
|
*
|
||||||
* A Spy has the following fields: wasCalled, callCount, mostRecentCall, and argsForCall (see docs).
|
* A Spy has the following mehtod: wasCalled, callCount, mostRecentCall, and argsForCall (see docs)
|
||||||
*
|
|
||||||
* Spies are torn down at the end of every spec.
|
* Spies are torn down at the end of every spec.
|
||||||
*
|
*
|
||||||
* Note: Do <b>not</b> call new jasmine.Spy() directly - a spy must be created using spyOn, jasmine.createSpy or jasmine.createSpyObj.
|
* Note: Do <b>not</b> call new jasmine.Spy() directly - a spy must be created using spyOn, jasmine.createSpy or jasmine.createSpyObj.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* // a stub
|
* // a stub
|
||||||
* var myStub = jasmine.createSpy('myStub'); // can be used anywhere
|
* var myStub = jasmine.createSpy('myStub'); // can be used anywhere
|
||||||
@@ -248,8 +143,8 @@ jasmine.objectContaining = function (sample) {
|
|||||||
*
|
*
|
||||||
* // mock example
|
* // mock example
|
||||||
* foo.not(7 == 7);
|
* foo.not(7 == 7);
|
||||||
* expect(foo.not).toHaveBeenCalled();
|
* expect(foo.not).wasCalled();
|
||||||
* expect(foo.not).toHaveBeenCalledWith(true);
|
* expect(foo.not).wasCalledWith(true);
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @see spyOn, jasmine.createSpy, jasmine.createSpyObj
|
* @see spyOn, jasmine.createSpy, jasmine.createSpyObj
|
||||||
@@ -265,10 +160,9 @@ jasmine.Spy = function(name) {
|
|||||||
*/
|
*/
|
||||||
this.isSpy = true;
|
this.isSpy = true;
|
||||||
/**
|
/**
|
||||||
* The actual function this spy stubs.
|
* The acutal function this spy stubs.
|
||||||
*/
|
*/
|
||||||
this.plan = function() {
|
this.plan = function() {};
|
||||||
};
|
|
||||||
/**
|
/**
|
||||||
* Tracking of the most recent call to the spy.
|
* Tracking of the most recent call to the spy.
|
||||||
* @example
|
* @example
|
||||||
@@ -289,7 +183,6 @@ jasmine.Spy = function(name) {
|
|||||||
* mySpy.argsForCall[1] = [7, 8];
|
* mySpy.argsForCall[1] = [7, 8];
|
||||||
*/
|
*/
|
||||||
this.argsForCall = [];
|
this.argsForCall = [];
|
||||||
this.calls = [];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -299,7 +192,7 @@ jasmine.Spy = function(name) {
|
|||||||
* var foo = {
|
* var foo = {
|
||||||
* bar: function() { // do some stuff }
|
* bar: function() { // do some stuff }
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* // defining a spy on an existing property: foo.bar
|
* // defining a spy on an existing property: foo.bar
|
||||||
* spyOn(foo, 'bar').andCallThrough();
|
* spyOn(foo, 'bar').andCallThrough();
|
||||||
*/
|
*/
|
||||||
@@ -384,7 +277,6 @@ jasmine.Spy.prototype.reset = function() {
|
|||||||
this.wasCalled = false;
|
this.wasCalled = false;
|
||||||
this.callCount = 0;
|
this.callCount = 0;
|
||||||
this.argsForCall = [];
|
this.argsForCall = [];
|
||||||
this.calls = [];
|
|
||||||
this.mostRecentCall = {};
|
this.mostRecentCall = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -394,34 +286,27 @@ jasmine.createSpy = function(name) {
|
|||||||
spyObj.wasCalled = true;
|
spyObj.wasCalled = true;
|
||||||
spyObj.callCount++;
|
spyObj.callCount++;
|
||||||
var args = jasmine.util.argsToArray(arguments);
|
var args = jasmine.util.argsToArray(arguments);
|
||||||
|
//spyObj.mostRecentCall = {
|
||||||
|
// object: this,
|
||||||
|
// args: args
|
||||||
|
//};
|
||||||
spyObj.mostRecentCall.object = this;
|
spyObj.mostRecentCall.object = this;
|
||||||
spyObj.mostRecentCall.args = args;
|
spyObj.mostRecentCall.args = args;
|
||||||
spyObj.argsForCall.push(args);
|
spyObj.argsForCall.push(args);
|
||||||
spyObj.calls.push({object: this, args: args});
|
|
||||||
return spyObj.plan.apply(this, arguments);
|
return spyObj.plan.apply(this, arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
var spy = new jasmine.Spy(name);
|
var spy = new jasmine.Spy(name);
|
||||||
|
|
||||||
for (var prop in spy) {
|
for(var prop in spy) {
|
||||||
spyObj[prop] = spy[prop];
|
spyObj[prop] = spy[prop];
|
||||||
}
|
}
|
||||||
|
|
||||||
spyObj.reset();
|
spyObj.reset();
|
||||||
|
|
||||||
return spyObj;
|
return spyObj;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines whether an object is a spy.
|
|
||||||
*
|
|
||||||
* @param {jasmine.Spy|Object} putativeSpy
|
|
||||||
* @returns {Boolean}
|
|
||||||
*/
|
|
||||||
jasmine.isSpy = function(putativeSpy) {
|
|
||||||
return putativeSpy && putativeSpy.isSpy;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a more complicated spy: an Object that has every property a function that is a spy. Used for stubbing something
|
* Creates a more complicated spy: an Object that has every property a function that is a spy. Used for stubbing something
|
||||||
* large in one call.
|
* large in one call.
|
||||||
@@ -430,9 +315,6 @@ jasmine.isSpy = function(putativeSpy) {
|
|||||||
* @param {Array} methodNames array of names of methods to make spies
|
* @param {Array} methodNames array of names of methods to make spies
|
||||||
*/
|
*/
|
||||||
jasmine.createSpyObj = function(baseName, methodNames) {
|
jasmine.createSpyObj = function(baseName, methodNames) {
|
||||||
if (!jasmine.isArray_(methodNames) || methodNames.length === 0) {
|
|
||||||
throw new Error('createSpyObj requires a non-empty array of method names to create spies for');
|
|
||||||
}
|
|
||||||
var obj = {};
|
var obj = {};
|
||||||
for (var i = 0; i < methodNames.length; i++) {
|
for (var i = 0; i < methodNames.length; i++) {
|
||||||
obj[methodNames[i]] = jasmine.createSpy(baseName + '.' + methodNames[i]);
|
obj[methodNames[i]] = jasmine.createSpy(baseName + '.' + methodNames[i]);
|
||||||
@@ -440,14 +322,8 @@ jasmine.createSpyObj = function(baseName, methodNames) {
|
|||||||
return obj;
|
return obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
jasmine.log = function(message) {
|
||||||
* All parameters are pretty-printed and concatenated together, then written to the current spec's output.
|
jasmine.getEnv().currentSpec.getResults().log(message);
|
||||||
*
|
|
||||||
* Be careful not to leave calls to <code>jasmine.log</code> in production code.
|
|
||||||
*/
|
|
||||||
jasmine.log = function() {
|
|
||||||
var spec = jasmine.getEnv().currentSpec;
|
|
||||||
spec.log.apply(spec, arguments);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -468,7 +344,6 @@ jasmine.log = function() {
|
|||||||
var spyOn = function(obj, methodName) {
|
var spyOn = function(obj, methodName) {
|
||||||
return jasmine.getEnv().currentSpec.spyOn(obj, methodName);
|
return jasmine.getEnv().currentSpec.spyOn(obj, methodName);
|
||||||
};
|
};
|
||||||
if (isCommonJS) exports.spyOn = spyOn;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a Jasmine spec that will be added to the current suite.
|
* Creates a Jasmine spec that will be added to the current suite.
|
||||||
@@ -486,7 +361,6 @@ if (isCommonJS) exports.spyOn = spyOn;
|
|||||||
var it = function(desc, func) {
|
var it = function(desc, func) {
|
||||||
return jasmine.getEnv().it(desc, func);
|
return jasmine.getEnv().it(desc, func);
|
||||||
};
|
};
|
||||||
if (isCommonJS) exports.it = it;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a <em>disabled</em> Jasmine spec.
|
* Creates a <em>disabled</em> Jasmine spec.
|
||||||
@@ -499,7 +373,6 @@ if (isCommonJS) exports.it = it;
|
|||||||
var xit = function(desc, func) {
|
var xit = function(desc, func) {
|
||||||
return jasmine.getEnv().xit(desc, func);
|
return jasmine.getEnv().xit(desc, func);
|
||||||
};
|
};
|
||||||
if (isCommonJS) exports.xit = xit;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts a chain for a Jasmine expectation.
|
* Starts a chain for a Jasmine expectation.
|
||||||
@@ -512,7 +385,6 @@ if (isCommonJS) exports.xit = xit;
|
|||||||
var expect = function(actual) {
|
var expect = function(actual) {
|
||||||
return jasmine.getEnv().currentSpec.expect(actual);
|
return jasmine.getEnv().currentSpec.expect(actual);
|
||||||
};
|
};
|
||||||
if (isCommonJS) exports.expect = expect;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines part of a jasmine spec. Used in cominbination with waits or waitsFor in asynchrnous specs.
|
* Defines part of a jasmine spec. Used in cominbination with waits or waitsFor in asynchrnous specs.
|
||||||
@@ -522,30 +394,25 @@ if (isCommonJS) exports.expect = expect;
|
|||||||
var runs = function(func) {
|
var runs = function(func) {
|
||||||
jasmine.getEnv().currentSpec.runs(func);
|
jasmine.getEnv().currentSpec.runs(func);
|
||||||
};
|
};
|
||||||
if (isCommonJS) exports.runs = runs;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Waits a fixed time period before moving to the next block.
|
* Waits for a timeout before moving to the next runs()-defined block.
|
||||||
*
|
* @param {Number} timeout
|
||||||
* @deprecated Use waitsFor() instead
|
|
||||||
* @param {Number} timeout milliseconds to wait
|
|
||||||
*/
|
*/
|
||||||
var waits = function(timeout) {
|
var waits = function(timeout) {
|
||||||
jasmine.getEnv().currentSpec.waits(timeout);
|
jasmine.getEnv().currentSpec.waits(timeout);
|
||||||
};
|
};
|
||||||
if (isCommonJS) exports.waits = waits;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Waits for the latchFunction to return true before proceeding to the next block.
|
* Waits for the latchFunction to return true before proceeding to the next runs()-defined block.
|
||||||
*
|
*
|
||||||
|
* @param {Number} timeout
|
||||||
* @param {Function} latchFunction
|
* @param {Function} latchFunction
|
||||||
* @param {String} optional_timeoutMessage
|
* @param {String} message
|
||||||
* @param {Number} optional_timeout
|
|
||||||
*/
|
*/
|
||||||
var waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout) {
|
var waitsFor = function(timeout, latchFunction, message) {
|
||||||
jasmine.getEnv().currentSpec.waitsFor.apply(jasmine.getEnv().currentSpec, arguments);
|
jasmine.getEnv().currentSpec.waitsFor(timeout, latchFunction, message);
|
||||||
};
|
};
|
||||||
if (isCommonJS) exports.waitsFor = waitsFor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A function that is called before each spec in a suite.
|
* A function that is called before each spec in a suite.
|
||||||
@@ -557,7 +424,6 @@ if (isCommonJS) exports.waitsFor = waitsFor;
|
|||||||
var beforeEach = function(beforeEachFunction) {
|
var beforeEach = function(beforeEachFunction) {
|
||||||
jasmine.getEnv().beforeEach(beforeEachFunction);
|
jasmine.getEnv().beforeEach(beforeEachFunction);
|
||||||
};
|
};
|
||||||
if (isCommonJS) exports.beforeEach = beforeEach;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A function that is called after each spec in a suite.
|
* A function that is called after each spec in a suite.
|
||||||
@@ -569,7 +435,6 @@ if (isCommonJS) exports.beforeEach = beforeEach;
|
|||||||
var afterEach = function(afterEachFunction) {
|
var afterEach = function(afterEachFunction) {
|
||||||
jasmine.getEnv().afterEach(afterEachFunction);
|
jasmine.getEnv().afterEach(afterEachFunction);
|
||||||
};
|
};
|
||||||
if (isCommonJS) exports.afterEach = afterEach;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines a suite of specifications.
|
* Defines a suite of specifications.
|
||||||
@@ -589,7 +454,6 @@ if (isCommonJS) exports.afterEach = afterEach;
|
|||||||
var describe = function(description, specDefinitions) {
|
var describe = function(description, specDefinitions) {
|
||||||
return jasmine.getEnv().describe(description, specDefinitions);
|
return jasmine.getEnv().describe(description, specDefinitions);
|
||||||
};
|
};
|
||||||
if (isCommonJS) exports.describe = describe;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disables a suite of specifications. Used to disable some suites in a file, or files, temporarily during development.
|
* Disables a suite of specifications. Used to disable some suites in a file, or files, temporarily during development.
|
||||||
@@ -600,33 +464,51 @@ if (isCommonJS) exports.describe = describe;
|
|||||||
var xdescribe = function(description, specDefinitions) {
|
var xdescribe = function(description, specDefinitions) {
|
||||||
return jasmine.getEnv().xdescribe(description, specDefinitions);
|
return jasmine.getEnv().xdescribe(description, specDefinitions);
|
||||||
};
|
};
|
||||||
if (isCommonJS) exports.xdescribe = xdescribe;
|
|
||||||
|
|
||||||
|
|
||||||
|
jasmine.XmlHttpRequest = XMLHttpRequest;
|
||||||
|
|
||||||
// Provide the XMLHttpRequest class for IE 5.x-6.x:
|
// Provide the XMLHttpRequest class for IE 5.x-6.x:
|
||||||
jasmine.XmlHttpRequest = (typeof XMLHttpRequest == "undefined") ? function() {
|
if (typeof XMLHttpRequest == "undefined") jasmine.XmlHttpRequest = function() {
|
||||||
function tryIt(f) {
|
try {
|
||||||
try {
|
|
||||||
return f();
|
|
||||||
} catch(e) {
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var xhr = tryIt(function() {
|
|
||||||
return new ActiveXObject("Msxml2.XMLHTTP.6.0");
|
return new ActiveXObject("Msxml2.XMLHTTP.6.0");
|
||||||
}) ||
|
} catch(e) {
|
||||||
tryIt(function() {
|
}
|
||||||
return new ActiveXObject("Msxml2.XMLHTTP.3.0");
|
try {
|
||||||
}) ||
|
return new ActiveXObject("Msxml2.XMLHTTP.3.0");
|
||||||
tryIt(function() {
|
} catch(e) {
|
||||||
return new ActiveXObject("Msxml2.XMLHTTP");
|
}
|
||||||
}) ||
|
try {
|
||||||
tryIt(function() {
|
return new ActiveXObject("Msxml2.XMLHTTP");
|
||||||
return new ActiveXObject("Microsoft.XMLHTTP");
|
} catch(e) {
|
||||||
});
|
}
|
||||||
|
try {
|
||||||
|
return new ActiveXObject("Microsoft.XMLHTTP");
|
||||||
|
} catch(e) {
|
||||||
|
}
|
||||||
|
throw new Error("This browser does not support XMLHttpRequest.");
|
||||||
|
};
|
||||||
|
|
||||||
if (!xhr) throw new Error("This browser does not support XMLHttpRequest.");
|
/**
|
||||||
|
* Adds suite files to an HTML document so that they are executed, thus adding them to the current
|
||||||
|
* Jasmine environment.
|
||||||
|
*
|
||||||
|
* @param {String} url path to the file to include
|
||||||
|
* @param {Boolean} opt_global
|
||||||
|
*/
|
||||||
|
jasmine.include = function(url, opt_global) {
|
||||||
|
if (opt_global) {
|
||||||
|
document.write('<script type="text/javascript" src="' + url + '"></' + 'script>');
|
||||||
|
} else {
|
||||||
|
var xhr;
|
||||||
|
try {
|
||||||
|
xhr = new jasmine.XmlHttpRequest();
|
||||||
|
xhr.open("GET", url, false);
|
||||||
|
xhr.send(null);
|
||||||
|
} catch(e) {
|
||||||
|
throw new Error("couldn't fetch " + url + ": " + e);
|
||||||
|
}
|
||||||
|
|
||||||
return xhr;
|
return eval(xhr.responseText);
|
||||||
} : XMLHttpRequest;
|
}
|
||||||
|
};
|
||||||
@@ -1,183 +1,158 @@
|
|||||||
// Mock setTimeout, clearTimeout
|
// Mock setTimeout, clearTimeout
|
||||||
// Contributed by Pivotal Computer Systems, www.pivotalsf.com
|
// Contributed by Pivotal Computer Systems, www.pivotalsf.com
|
||||||
|
|
||||||
jasmine.FakeTimer = function() {
|
jasmine.FakeTimer = function() {
|
||||||
this.reset();
|
this.reset();
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
self.setTimeout = function(funcToCall, millis) {
|
self.setTimeout = function(funcToCall, millis) {
|
||||||
self.timeoutsMade++;
|
self.timeoutsMade++;
|
||||||
self.scheduleFunction(self.timeoutsMade, funcToCall, millis, false);
|
self.scheduleFunction(self.timeoutsMade, funcToCall, millis, false);
|
||||||
return self.timeoutsMade;
|
return self.timeoutsMade;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.setInterval = function(funcToCall, millis) {
|
self.setInterval = function(funcToCall, millis) {
|
||||||
self.timeoutsMade++;
|
self.timeoutsMade++;
|
||||||
self.scheduleFunction(self.timeoutsMade, funcToCall, millis, true);
|
self.scheduleFunction(self.timeoutsMade, funcToCall, millis, true);
|
||||||
return self.timeoutsMade;
|
return self.timeoutsMade;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.clearTimeout = function(timeoutKey) {
|
self.clearTimeout = function(timeoutKey) {
|
||||||
self.scheduledFunctions[timeoutKey] = jasmine.undefined;
|
self.scheduledFunctions[timeoutKey] = undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.clearInterval = function(timeoutKey) {
|
self.clearInterval = function(timeoutKey) {
|
||||||
self.scheduledFunctions[timeoutKey] = jasmine.undefined;
|
self.scheduledFunctions[timeoutKey] = undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.FakeTimer.prototype.reset = function() {
|
jasmine.FakeTimer.prototype.reset = function() {
|
||||||
this.timeoutsMade = 0;
|
this.timeoutsMade = 0;
|
||||||
this.scheduledFunctions = {};
|
this.scheduledFunctions = {};
|
||||||
this.nowMillis = 0;
|
this.nowMillis = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.FakeTimer.prototype.tick = function(millis) {
|
jasmine.FakeTimer.prototype.tick = function(millis) {
|
||||||
var oldMillis = this.nowMillis;
|
var oldMillis = this.nowMillis;
|
||||||
var newMillis = oldMillis + millis;
|
var newMillis = oldMillis + millis;
|
||||||
this.runFunctionsWithinRange(oldMillis, newMillis);
|
this.runFunctionsWithinRange(oldMillis, newMillis);
|
||||||
this.nowMillis = newMillis;
|
this.nowMillis = newMillis;
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) {
|
jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) {
|
||||||
var scheduledFunc;
|
var scheduledFunc;
|
||||||
var funcsToRun = [];
|
var funcsToRun = [];
|
||||||
for (var timeoutKey in this.scheduledFunctions) {
|
for (var timeoutKey in this.scheduledFunctions) {
|
||||||
scheduledFunc = this.scheduledFunctions[timeoutKey];
|
scheduledFunc = this.scheduledFunctions[timeoutKey];
|
||||||
if (scheduledFunc != jasmine.undefined &&
|
if (scheduledFunc != undefined &&
|
||||||
scheduledFunc.runAtMillis >= oldMillis &&
|
scheduledFunc.runAtMillis >= oldMillis &&
|
||||||
scheduledFunc.runAtMillis <= nowMillis) {
|
scheduledFunc.runAtMillis <= nowMillis) {
|
||||||
funcsToRun.push(scheduledFunc);
|
funcsToRun.push(scheduledFunc);
|
||||||
this.scheduledFunctions[timeoutKey] = jasmine.undefined;
|
this.scheduledFunctions[timeoutKey] = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (funcsToRun.length > 0) {
|
if (funcsToRun.length > 0) {
|
||||||
funcsToRun.sort(function(a, b) {
|
funcsToRun.sort(function(a, b) {
|
||||||
return a.runAtMillis - b.runAtMillis;
|
return a.runAtMillis - b.runAtMillis;
|
||||||
});
|
});
|
||||||
for (var i = 0; i < funcsToRun.length; ++i) {
|
for (var i = 0; i < funcsToRun.length; ++i) {
|
||||||
try {
|
try {
|
||||||
var funcToRun = funcsToRun[i];
|
var funcToRun = funcsToRun[i];
|
||||||
this.nowMillis = funcToRun.runAtMillis;
|
this.nowMillis = funcToRun.runAtMillis;
|
||||||
funcToRun.funcToCall();
|
funcToRun.funcToCall();
|
||||||
if (funcToRun.recurring) {
|
if (funcToRun.recurring) {
|
||||||
this.scheduleFunction(funcToRun.timeoutKey,
|
this.scheduleFunction(funcToRun.timeoutKey,
|
||||||
funcToRun.funcToCall,
|
funcToRun.funcToCall,
|
||||||
funcToRun.millis,
|
funcToRun.millis,
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.runFunctionsWithinRange(oldMillis, nowMillis);
|
this.runFunctionsWithinRange(oldMillis, nowMillis);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall, millis, recurring) {
|
jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall, millis, recurring) {
|
||||||
this.scheduledFunctions[timeoutKey] = {
|
this.scheduledFunctions[timeoutKey] = {
|
||||||
runAtMillis: this.nowMillis + millis,
|
runAtMillis: this.nowMillis + millis,
|
||||||
funcToCall: funcToCall,
|
funcToCall: funcToCall,
|
||||||
recurring: recurring,
|
recurring: recurring,
|
||||||
timeoutKey: timeoutKey,
|
timeoutKey: timeoutKey,
|
||||||
millis: millis
|
millis: millis
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace
|
jasmine.Clock = {
|
||||||
*/
|
defaultFakeTimer: new jasmine.FakeTimer(),
|
||||||
jasmine.Clock = {
|
|
||||||
defaultFakeTimer: new jasmine.FakeTimer(),
|
reset: function() {
|
||||||
|
jasmine.Clock.assertInstalled();
|
||||||
reset: function() {
|
jasmine.Clock.defaultFakeTimer.reset();
|
||||||
jasmine.Clock.assertInstalled();
|
},
|
||||||
jasmine.Clock.defaultFakeTimer.reset();
|
|
||||||
},
|
tick: function(millis) {
|
||||||
|
jasmine.Clock.assertInstalled();
|
||||||
tick: function(millis) {
|
jasmine.Clock.defaultFakeTimer.tick(millis);
|
||||||
jasmine.Clock.assertInstalled();
|
},
|
||||||
jasmine.Clock.defaultFakeTimer.tick(millis);
|
|
||||||
},
|
runFunctionsWithinRange: function(oldMillis, nowMillis) {
|
||||||
|
jasmine.Clock.defaultFakeTimer.runFunctionsWithinRange(oldMillis, nowMillis);
|
||||||
runFunctionsWithinRange: function(oldMillis, nowMillis) {
|
},
|
||||||
jasmine.Clock.defaultFakeTimer.runFunctionsWithinRange(oldMillis, nowMillis);
|
|
||||||
},
|
scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) {
|
||||||
|
jasmine.Clock.defaultFakeTimer.scheduleFunction(timeoutKey, funcToCall, millis, recurring);
|
||||||
scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) {
|
},
|
||||||
jasmine.Clock.defaultFakeTimer.scheduleFunction(timeoutKey, funcToCall, millis, recurring);
|
|
||||||
},
|
useMock: function() {
|
||||||
|
var spec = jasmine.getEnv().currentSpec;
|
||||||
useMock: function() {
|
spec.after(jasmine.Clock.uninstallMock);
|
||||||
if (!jasmine.Clock.isInstalled()) {
|
|
||||||
var spec = jasmine.getEnv().currentSpec;
|
jasmine.Clock.installMock();
|
||||||
spec.after(jasmine.Clock.uninstallMock);
|
},
|
||||||
|
|
||||||
jasmine.Clock.installMock();
|
installMock: function() {
|
||||||
}
|
jasmine.Clock.installed = jasmine.Clock.defaultFakeTimer;
|
||||||
},
|
},
|
||||||
|
|
||||||
installMock: function() {
|
uninstallMock: function() {
|
||||||
jasmine.Clock.installed = jasmine.Clock.defaultFakeTimer;
|
jasmine.Clock.assertInstalled();
|
||||||
},
|
jasmine.Clock.installed = jasmine.Clock.real;
|
||||||
|
},
|
||||||
uninstallMock: function() {
|
|
||||||
jasmine.Clock.assertInstalled();
|
real: {
|
||||||
jasmine.Clock.installed = jasmine.Clock.real;
|
setTimeout: window.setTimeout,
|
||||||
},
|
clearTimeout: window.clearTimeout,
|
||||||
|
setInterval: window.setInterval,
|
||||||
real: {
|
clearInterval: window.clearInterval
|
||||||
setTimeout: jasmine.getGlobal().setTimeout,
|
},
|
||||||
clearTimeout: jasmine.getGlobal().clearTimeout,
|
|
||||||
setInterval: jasmine.getGlobal().setInterval,
|
assertInstalled: function() {
|
||||||
clearInterval: jasmine.getGlobal().clearInterval
|
if (jasmine.Clock.installed != jasmine.Clock.defaultFakeTimer) {
|
||||||
},
|
throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()");
|
||||||
|
}
|
||||||
assertInstalled: function() {
|
},
|
||||||
if (!jasmine.Clock.isInstalled()) {
|
|
||||||
throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()");
|
installed: null
|
||||||
}
|
};
|
||||||
},
|
jasmine.Clock.installed = jasmine.Clock.real;
|
||||||
|
|
||||||
isInstalled: function() {
|
window.setTimeout = function(funcToCall, millis) {
|
||||||
return jasmine.Clock.installed == jasmine.Clock.defaultFakeTimer;
|
return jasmine.Clock.installed.setTimeout.apply(this, arguments);
|
||||||
},
|
};
|
||||||
|
|
||||||
installed: null
|
window.setInterval = function(funcToCall, millis) {
|
||||||
};
|
return jasmine.Clock.installed.setInterval.apply(this, arguments);
|
||||||
jasmine.Clock.installed = jasmine.Clock.real;
|
};
|
||||||
|
|
||||||
//else for IE support
|
window.clearTimeout = function(timeoutKey) {
|
||||||
jasmine.getGlobal().setTimeout = function(funcToCall, millis) {
|
return jasmine.Clock.installed.clearTimeout.apply(this, arguments);
|
||||||
if (jasmine.Clock.installed.setTimeout.apply) {
|
};
|
||||||
return jasmine.Clock.installed.setTimeout.apply(this, arguments);
|
|
||||||
} else {
|
window.clearInterval = function(timeoutKey) {
|
||||||
return jasmine.Clock.installed.setTimeout(funcToCall, millis);
|
return jasmine.Clock.installed.clearInterval.apply(this, arguments);
|
||||||
}
|
};
|
||||||
};
|
|
||||||
|
|
||||||
jasmine.getGlobal().setInterval = function(funcToCall, millis) {
|
|
||||||
if (jasmine.Clock.installed.setInterval.apply) {
|
|
||||||
return jasmine.Clock.installed.setInterval.apply(this, arguments);
|
|
||||||
} else {
|
|
||||||
return jasmine.Clock.installed.setInterval(funcToCall, millis);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
jasmine.getGlobal().clearTimeout = function(timeoutKey) {
|
|
||||||
if (jasmine.Clock.installed.clearTimeout.apply) {
|
|
||||||
return jasmine.Clock.installed.clearTimeout.apply(this, arguments);
|
|
||||||
} else {
|
|
||||||
return jasmine.Clock.installed.clearTimeout(timeoutKey);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
jasmine.getGlobal().clearInterval = function(timeoutKey) {
|
|
||||||
if (jasmine.Clock.installed.clearTimeout.apply) {
|
|
||||||
return jasmine.Clock.installed.clearInterval.apply(this, arguments);
|
|
||||||
} else {
|
|
||||||
return jasmine.Clock.installed.clearInterval(timeoutKey);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
@@ -4,20 +4,17 @@
|
|||||||
jasmine.util = {};
|
jasmine.util = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Declare that a child class inherit it's prototype from the parent class.
|
* Declare that a child class inherite it's prototype from the parent class.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Function} childClass
|
* @param {Function} childClass
|
||||||
* @param {Function} parentClass
|
* @param {Function} parentClass
|
||||||
*/
|
*/
|
||||||
jasmine.util.inherit = function(childClass, parentClass) {
|
jasmine.util.inherit = function(childClass, parentClass) {
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
var subclass = function() {
|
var subclass = function() {
|
||||||
};
|
};
|
||||||
subclass.prototype = parentClass.prototype;
|
subclass.prototype = parentClass.prototype;
|
||||||
childClass.prototype = new subclass();
|
childClass.prototype = new subclass;
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.util.formatException = function(e) {
|
jasmine.util.formatException = function(e) {
|
||||||
@@ -60,8 +57,3 @@ jasmine.util.argsToArray = function(args) {
|
|||||||
return arrayOfArgs;
|
return arrayOfArgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.util.extend = function(destination, source) {
|
|
||||||
for (var property in source) destination[property] = source[property];
|
|
||||||
return destination;
|
|
||||||
};
|
|
||||||
|
|
||||||