idea ide updates
idea ide updates

  <?xml version="1.0" encoding="UTF-8"?>
  <project version="4">
  <component name="CompilerConfiguration">
  <option name="DEFAULT_COMPILER" value="Javac" />
  <resourceExtensions />
  <wildcardResourcePatterns>
  <entry name="!?*.java" />
  <entry name="!?*.form" />
  <entry name="!?*.class" />
  <entry name="!?*.groovy" />
  <entry name="!?*.scala" />
  <entry name="!?*.flex" />
  <entry name="!?*.kt" />
  <entry name="!?*.clj" />
  </wildcardResourcePatterns>
  <annotationProcessing>
  <profile default="true" name="Default" enabled="false">
  <processorPath useClasspath="true" />
  </profile>
  </annotationProcessing>
  </component>
  </project>
 
 
  <component name="CopyrightManager">
  <settings default="">
  <module2copyright />
  </settings>
  </component>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectResources"> <component name="ProjectResources">
<default-html-doctype>jar:file:\C:\Program Files (x86)\JetBrains\PhpStorm 5.0.2\lib\webide.jar!\resources\html5-schema\html5.rnc</default-html-doctype> <default-html-doctype>jar:file:\C:\Program Files (x86)\JetBrains\PhpStorm 5.0.2\lib\webide.jar!\resources\html5-schema\html5.rnc</default-html-doctype>
</component> </component>
<component name="ProjectRootManager" version="2" /> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_3" assert-keyword="false" jdk-15="false" />
</project> </project>
   
   
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4"> <module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager"> <component name="FacetManager">
  <facet type="Python" name="Python">
  <configuration sdkName="" />
  </facet>
  </component>
  <component name="NewModuleRootManager" inherit-compiler-output="false">
<content url="file://$MODULE_DIR$" /> <content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
</module> </module>
   
   
  <?xml version="1.0" encoding="UTF-8"?>
  <project version="4">
  <component name="Palette2">
  <group name="Swing">
  <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
  <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
  </item>
  <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
  <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
  </item>
  <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
  <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
  </item>
  <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
  <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
  </item>
  <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
  <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
  <initial-values>
  <property name="text" value="Button" />
  </initial-values>
  </item>
  <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
  <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
  <initial-values>
  <property name="text" value="RadioButton" />
  </initial-values>
  </item>
  <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
  <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
  <initial-values>
  <property name="text" value="CheckBox" />
  </initial-values>
  </item>
  <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
  <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
  <initial-values>
  <property name="text" value="Label" />
  </initial-values>
  </item>
  <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
  <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
  <preferred-size width="150" height="-1" />
  </default-constraints>
  </item>
  <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
  <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
  <preferred-size width="150" height="-1" />
  </default-constraints>
  </item>
  <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
  <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
  <preferred-size width="150" height="-1" />
  </default-constraints>
  </item>
  <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
  <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
  <preferred-size width="150" height="50" />
  </default-constraints>
  </item>
  <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
  <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
  <preferred-size width="150" height="50" />
  </default-constraints>
  </item>
  <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
  <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
  <preferred-size width="150" height="50" />
  </default-constraints>
  </item>
  <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
  <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
  </item>
  <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
  <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
  <preferred-size width="150" height="50" />
  </default-constraints>
  </item>
  <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
  <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
  <preferred-size width="150" height="50" />
  </default-constraints>
  </item>
  <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
  <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
  <preferred-size width="150" height="50" />
  </default-constraints>
  </item>
  <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
  <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
  <preferred-size width="200" height="200" />
  </default-constraints>
  </item>
  <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
  <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
  <preferred-size width="200" height="200" />
  </default-constraints>
  </item>
  <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
  <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
  </item>
  <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
  <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
  </item>
  <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
  <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
  </item>
  <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
  <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
  </item>
  <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
  <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
  <preferred-size width="-1" height="20" />
  </default-constraints>
  </item>
  <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
  <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
  </item>
  <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
  <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
  </item>
  </group>
  </component>
  </project>
 
 
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="f90ee5b5-97e4-47ec-9b14-d4f4e896f100" name="Default" comment=""> <list default="true" id="f90ee5b5-97e4-47ec-9b14-d4f4e896f100" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/output.txt" afterPath="$PROJECT_DIR$/output.txt" /> <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/compiler.xml" />
  <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/copyright/profiles_settings.xml" />
  <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/uiDesigner.xml" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/404.html" afterPath="$PROJECT_DIR$/404.html" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/spec/Chart.js" afterPath="$PROJECT_DIR$/js/flotr2/spec/Chart.js" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/spec/Color.js" afterPath="$PROJECT_DIR$/js/flotr2/spec/Color.js" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/spec/Flotr.js" afterPath="$PROJECT_DIR$/js/flotr2/spec/Flotr.js" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/spec/Graph.js" afterPath="$PROJECT_DIR$/js/flotr2/spec/Graph.js" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/lib/base64.js" afterPath="$PROJECT_DIR$/js/flotr2/lib/base64.js" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/make/basic.json" afterPath="$PROJECT_DIR$/js/flotr2/make/basic.json" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/make/build.json" afterPath="$PROJECT_DIR$/js/flotr2/make/build.json" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/calllog.php" afterPath="$PROJECT_DIR$/calllog.php" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/calls.json.php" afterPath="$PROJECT_DIR$/calls.json.php" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/common.inc.php" afterPath="$PROJECT_DIR$/common.inc.php" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/examples/old_examples/examples.js" afterPath="$PROJECT_DIR$/js/flotr2/examples/old_examples/examples.js" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/make/examples.json" afterPath="$PROJECT_DIR$/js/flotr2/make/examples.json" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/examples/old_examples/extending-flotr.html" afterPath="$PROJECT_DIR$/js/flotr2/examples/old_examples/extending-flotr.html" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/make/flotr2.json" afterPath="$PROJECT_DIR$/js/flotr2/make/flotr2.json" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/spec/js/flotr2.stable.js" afterPath="$PROJECT_DIR$/js/flotr2/spec/js/flotr2.stable.js" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/examples/lib/codemirror/lib/util/formatting.js" afterPath="$PROJECT_DIR$/js/flotr2/examples/lib/codemirror/lib/util/formatting.js" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/generateConvos.php" afterPath="$PROJECT_DIR$/generateConvos.php" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/getfile.php" afterPath="$PROJECT_DIR$/getfile.php" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/make/ie.json" afterPath="$PROJECT_DIR$/js/flotr2/make/ie.json" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/examples/old_examples/index.html" afterPath="$PROJECT_DIR$/js/flotr2/examples/old_examples/index.html" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/spec/index.html" afterPath="$PROJECT_DIR$/js/flotr2/spec/index.html" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/lib/jasmine/jasmine-html.js" afterPath="$PROJECT_DIR$/js/flotr2/lib/jasmine/jasmine-html.js" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/lib/jasmine/jasmine.css" afterPath="$PROJECT_DIR$/js/flotr2/lib/jasmine/jasmine.css" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/lib/jasmine/jasmine.js" afterPath="$PROJECT_DIR$/js/flotr2/lib/jasmine/jasmine.js" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/vendor/jquery-1.8.0.min.js" afterPath="$PROJECT_DIR$/js/vendor/jquery-1.8.0.min.js" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/examples/old_examples/json-data.html" afterPath="$PROJECT_DIR$/js/flotr2/examples/old_examples/json-data.html" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/examples/old_examples/json-real-data.html" afterPath="$PROJECT_DIR$/js/flotr2/examples/old_examples/json-real-data.html" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/examples/old_examples/json.txt" afterPath="$PROJECT_DIR$/js/flotr2/examples/old_examples/json.txt" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/make/lib.json" afterPath="$PROJECT_DIR$/js/flotr2/make/lib.json" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/examples/old_examples/logarithmic-scale.html" afterPath="$PROJECT_DIR$/js/flotr2/examples/old_examples/logarithmic-scale.html" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/misc.xml" afterPath="$PROJECT_DIR$/.idea/misc.xml" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/vendor/modernizr-2.6.1.min.js" afterPath="$PROJECT_DIR$/js/vendor/modernizr-2.6.1.min.js" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/examples/old_examples/mouse-zoom-preview.html" afterPath="$PROJECT_DIR$/js/flotr2/examples/old_examples/mouse-zoom-preview.html" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/nbproject/project.xml" afterPath="$PROJECT_DIR$/nbproject/project.xml" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/lib/prototype.js" afterPath="$PROJECT_DIR$/js/flotr2/lib/prototype.js" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/scannr.iml" afterPath="$PROJECT_DIR$/.idea/scannr.iml" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/scannr.py" afterPath="$PROJECT_DIR$/scannr.py" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/snd.py" afterPath="$PROJECT_DIR$/snd.py" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/examples/old_examples/style.css" afterPath="$PROJECT_DIR$/js/flotr2/examples/old_examples/style.css" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/spec/js/test-background.js" afterPath="$PROJECT_DIR$/js/flotr2/spec/js/test-background.js" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/spec/js/test-boundaries.js" afterPath="$PROJECT_DIR$/js/flotr2/spec/js/test-boundaries.js" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/js/flotr2/spec/js/test-mountain-nulls.js" afterPath="$PROJECT_DIR$/js/flotr2/spec/js/test-mountain-nulls.js" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/test.py" afterPath="$PROJECT_DIR$/test.py" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/test2.py" afterPath="$PROJECT_DIR$/test2.py" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/trunklog.php" afterPath="$PROJECT_DIR$/trunklog.php" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/viewcalls.php" afterPath="$PROJECT_DIR$/viewcalls.php" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/viewcalls.php" afterPath="$PROJECT_DIR$/viewcalls.php" />
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
</list> </list>
<ignored path="scannr.iws" /> <ignored path="scannr.iws" />
<ignored path=".idea/workspace.xml" /> <ignored path=".idea/workspace.xml" />
  <file path="/Dummy.txt" changelist="f90ee5b5-97e4-47ec-9b14-d4f4e896f100" time="1356154429152" ignored="false" />
  <file path="/calllog.php" changelist="f90ee5b5-97e4-47ec-9b14-d4f4e896f100" time="1356153807482" ignored="false" />
  <file path="/scannr.py" changelist="f90ee5b5-97e4-47ec-9b14-d4f4e896f100" time="1356154551131" ignored="false" />
  <file path="/start_script.py" changelist="f90ee5b5-97e4-47ec-9b14-d4f4e896f100" time="1356155203132" ignored="false" />
  <file path="/a.java" changelist="f90ee5b5-97e4-47ec-9b14-d4f4e896f100" time="1356155211924" ignored="false" />
  <file path="/a.php" changelist="f90ee5b5-97e4-47ec-9b14-d4f4e896f100" time="1356155216083" ignored="false" />
<option name="TRACKING_ENABLED" value="true" /> <option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" /> <option name="LAST_RESOLUTION" value="IGNORE" />
</component> </component>
<component name="ChangesViewManager" flattened_view="true" show_ignored="false" /> <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
<component name="CreatePatchCommitExecutor"> <component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" /> <option name="PATCH_PATH" value="" />
</component> </component>
<component name="DaemonCodeAnalyzer"> <component name="DaemonCodeAnalyzer">
<disable_hints /> <disable_hints />
</component> </component>
  <component name="DebuggerManager">
  <ui_properties default_suspend_policy="SuspendAll" default_condition_enabled="true" />
  <breakpoint_any default_suspend_policy="SuspendAll" default_condition_enabled="true">
  <breakpoint>
  <option name="NOTIFY_CAUGHT" value="true" />
  <option name="NOTIFY_UNCAUGHT" value="true" />
  <option name="ENABLED" value="false" />
  <option name="LOG_ENABLED" value="false" />
  <option name="LOG_EXPRESSION_ENABLED" value="false" />
  <option name="SUSPEND_POLICY" value="SuspendAll" />
  <option name="SUSPEND" value="true" />
  <option name="COUNT_FILTER_ENABLED" value="false" />
  <option name="COUNT_FILTER" value="0" />
  <option name="CONDITION_ENABLED" value="true" />
  <option name="CLASS_FILTERS_ENABLED" value="false" />
  <option name="INSTANCE_FILTERS_ENABLED" value="false" />
  <option name="CONDITION" value="" />
  <option name="LOG_MESSAGE" value="" />
  </breakpoint>
  <breakpoint>
  <option name="NOTIFY_CAUGHT" value="true" />
  <option name="NOTIFY_UNCAUGHT" value="true" />
  <option name="ENABLED" value="false" />
  <option name="LOG_ENABLED" value="false" />
  <option name="LOG_EXPRESSION_ENABLED" value="false" />
  <option name="SUSPEND_POLICY" value="SuspendAll" />
  <option name="SUSPEND" value="true" />
  <option name="COUNT_FILTER_ENABLED" value="false" />
  <option name="COUNT_FILTER" value="0" />
  <option name="CONDITION_ENABLED" value="true" />
  <option name="CLASS_FILTERS_ENABLED" value="false" />
  <option name="INSTANCE_FILTERS_ENABLED" value="false" />
  <option name="CONDITION" value="" />
  <option name="LOG_MESSAGE" value="" />
  </breakpoint>
  </breakpoint_any>
  <breakpoint_rules />
  <ui_properties />
  </component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" /> <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
  <component name="FavoritesManager">
  <favorites_list name="scannr" />
  </component>
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf> <leaf>
<file leaf-file-name="viewcalls.php" pinned="false" current="true" current-in-tab="true"> <file leaf-file-name="calllog.php" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/viewcalls.php"> <entry file="file://$PROJECT_DIR$/calllog.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="41" column="69" selection-start="1388" selection-end="1388" vertical-scroll-proportion="1.2659575"> <state line="9" column="0" selection-start="189" selection-end="189" vertical-scroll-proportion="0.0">
<folding>  
<element signature="e#255#287#0" expanded="true" />  
</folding>  
</state>  
</provider>  
</entry>  
</file>  
<file leaf-file-name="common.inc.php" pinned="false" current="false" current-in-tab="false">  
<entry file="file://$PROJECT_DIR$/common.inc.php">  
<provider selected="true" editor-type-id="text-editor">  
<state line="60" column="117" selection-start="2262" selection-end="2262" vertical-scroll-proportion="-39.23077">  
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="calls.json.php" pinned="false" current="false" current-in-tab="false"> <file leaf-file-name="scannr.py" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/calls.json.php"> <entry file="file://$PROJECT_DIR$/scannr.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="72" column="41" selection-start="2843" selection-end="2843" vertical-scroll-proportion="-43.153847"> <state line="80" column="64" selection-start="2271" selection-end="2271" vertical-scroll-proportion="-0.31178707">
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
</leaf> </leaf>
</component> </component>
<component name="FindManager"> <component name="FindManager">
<FindUsagesManager> <FindUsagesManager>
<setting name="OPEN_NEW_TAB" value="false" /> <setting name="OPEN_NEW_TAB" value="false" />
</FindUsagesManager> </FindUsagesManager>
</component> </component>
<component name="Git.Settings"> <component name="Git.Settings">
  <option name="SYNC_SETTING" value="DONT" />
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
  </component>
  <component name="GitLogSettings">
  <option name="myDateState">
  <MyDateState />
  </option>
</component> </component>
<component name="IdeDocumentHistory"> <component name="IdeDocumentHistory">
<option name="changedFiles"> <option name="changedFiles">
<list> <list>
<option value="$PROJECT_DIR$/scannr.py" />  
<option value="$PROJECT_DIR$/common.inc.php" /> <option value="$PROJECT_DIR$/common.inc.php" />
<option value="$PROJECT_DIR$/calls.json.php" /> <option value="$PROJECT_DIR$/calls.json.php" />
<option value="$PROJECT_DIR$/viewcalls.php" /> <option value="$PROJECT_DIR$/viewcalls.php" />
  <option value="$PROJECT_DIR$/calllog.php" />
  <option value="$PROJECT_DIR$/scannr.py" />
</list> </list>
</option> </option>
</component> </component>
<component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" /> <component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" interpreter_name="PHP" />
<component name="ProjectFrameBounds"> <component name="ProjectFrameBounds">
<option name="x" value="619" /> <option name="y" value="22" />
<option name="width" value="825" /> <option name="width" value="1680" />
<option name="height" value="600" /> <option name="height" value="937" />
</component> </component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true"> <component name="ProjectLevelVcsManager" settingsEditedManually="true">
<OptionsSetting value="true" id="Add" /> <OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" /> <OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" /> <OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" /> <OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" /> <OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" /> <OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" /> <ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" /> <ConfirmationsSetting value="0" id="Remove" />
</component> </component>
<component name="ProjectReloadState"> <component name="ProjectReloadState">
<option name="STATE" value="0" /> <option name="STATE" value="0" />
</component> </component>
<component name="ProjectView"> <component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1" splitterProportion="0.5"> <navigator currentView="ProjectPane" proportions="" version="1" splitterProportion="0.5">
<flattenPackages /> <flattenPackages />
<showMembers /> <showMembers />
<showModules /> <showModules />
<showLibraryContents ProjectPane="true" /> <showLibraryContents ProjectPane="true" />
<hideEmptyPackages /> <hideEmptyPackages />
<abbreviatePackageNames /> <abbreviatePackageNames />
<autoscrollToSource /> <autoscrollToSource />
<autoscrollFromSource /> <autoscrollFromSource />
<sortByType /> <sortByType />
</navigator> </navigator>
<panes> <panes>
  <pane id="PackagesPane" />
<pane id="ProjectPane"> <pane id="ProjectPane">
<subPane> <subPane>
<PATH> <PATH>
<PATH_ELEMENT> <PATH_ELEMENT>
<option name="myItemId" value="scannr" /> <option name="myItemId" value="scannr" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" /> <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT> </PATH_ELEMENT>
</PATH> </PATH>
  <PATH>
  <PATH_ELEMENT>
  <option name="myItemId" value="scannr" />
  <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
  </PATH_ELEMENT>
  <PATH_ELEMENT>
  <option name="myItemId" value="scannr" />
  <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
  </PATH_ELEMENT>
  </PATH>
</subPane> </subPane>
</pane> </pane>
<pane id="Scope" /> <pane id="Scope" />
</panes> </panes>
</component> </component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">
<property name="options.splitter.main.proportions" value="0.3" /> <property name="options.splitter.main.proportions" value="0.3" />
<property name="WebServerToolWindowFactoryState" value="false" /> <property name="WebServerToolWindowFactoryState" value="false" />
<property name="options.lastSelected" value="project.propVCSSupport.Mappings" /> <property name="options.lastSelected" value="tasks" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../busui/myway/myway_timeliness.php" /> <property name="last_opened_file_path" value="$PROJECT_DIR$/../busui/myway/myway_timeliness.php" />
  <property name="FullScreen" value="false" />
<property name="options.splitter.details.proportions" value="0.2" /> <property name="options.splitter.details.proportions" value="0.2" />
<property name="options.searchVisible" value="true" /> <property name="options.searchVisible" value="true" />
  </component>
  <component name="PyConsoleOptionsProvider">
  <option name="myPythonConsoleState">
  <PyConsoleSettings />
  </option>
  <option name="myDjangoConsoleState">
  <PyConsoleSettings />
  </option>
</component> </component>
<component name="RunManager"> <component name="RunManager">
<configuration default="true" type="PHPUnitRunConfigurationType" factoryName="PHPUnit"> <configuration default="true" type="PHPUnitRunConfigurationType" factoryName="PHPUnit">
<TestRunner /> <TestRunner />
<method /> <method />
</configuration> </configuration>
<configuration default="true" type="PhpLocalRunConfigurationType" factoryName="PHP Console"> <configuration default="true" type="JavascriptDebugSession" factoryName="Local" singleton="true">
<method />  
</configuration>  
<configuration default="true" type="JavascriptDebugSession" factoryName="Local">  
<JSDebuggerConfigurationSettings> <JSDebuggerConfigurationSettings>
<option name="engineId" value="embedded" /> <option name="engineId" value="embedded" />
<option name="fileUrl" /> <option name="fileUrl" />
</JSDebuggerConfigurationSettings> </JSDebuggerConfigurationSettings>
<method /> <method />
</configuration> </configuration>
<list size="0" /> <list size="0" />
</component> </component>
<component name="ShelveChangesManager" show_recycled="false" /> <component name="ShelveChangesManager" show_recycled="false" />
<component name="SvnConfiguration" maxAnnotateRevisions="500" myUseAcceleration="nothing" myAutoUpdateAfterCommit="false" cleanupOnStartRun="false"> <component name="SvnConfiguration" maxAnnotateRevisions="500" myUseAcceleration="nothing" myAutoUpdateAfterCommit="false" cleanupOnStartRun="false">
<option name="USER" value="" /> <option name="USER" value="" />
<option name="PASSWORD" value="" /> <option name="PASSWORD" value="" />
<option name="mySSHConnectionTimeout" value="30000" /> <option name="mySSHConnectionTimeout" value="30000" />
<option name="mySSHReadTimeout" value="30000" /> <option name="mySSHReadTimeout" value="30000" />
<option name="LAST_MERGED_REVISION" /> <option name="LAST_MERGED_REVISION" />
<option name="MERGE_DRY_RUN" value="false" /> <option name="MERGE_DRY_RUN" value="false" />
<option name="MERGE_DIFF_USE_ANCESTRY" value="true" /> <option name="MERGE_DIFF_USE_ANCESTRY" value="true" />
<option name="UPDATE_LOCK_ON_DEMAND" value="false" /> <option name="UPDATE_LOCK_ON_DEMAND" value="false" />
<option name="IGNORE_SPACES_IN_MERGE" value="false" /> <option name="IGNORE_SPACES_IN_MERGE" value="false" />
<option name="DETECT_NESTED_COPIES" value="true" /> <option name="DETECT_NESTED_COPIES" value="true" />
<option name="CHECK_NESTED_FOR_QUICK_MERGE" value="false" /> <option name="CHECK_NESTED_FOR_QUICK_MERGE" value="false" />
<option name="IGNORE_SPACES_IN_ANNOTATE" value="true" /> <option name="IGNORE_SPACES_IN_ANNOTATE" value="true" />
<option name="SHOW_MERGE_SOURCES_IN_ANNOTATE" value="true" /> <option name="SHOW_MERGE_SOURCES_IN_ANNOTATE" value="true" />
<option name="FORCE_UPDATE" value="false" /> <option name="FORCE_UPDATE" value="false" />
<option name="IGNORE_EXTERNALS" value="false" /> <option name="IGNORE_EXTERNALS" value="false" />
<myIsUseDefaultProxy>false</myIsUseDefaultProxy> <myIsUseDefaultProxy>false</myIsUseDefaultProxy>
</component> </component>
<component name="TaskManager"> <component name="TaskManager">
<task active="true" id="Default" summary="Default task"> <task active="true" id="Default" summary="Default task">
<changelist id="f90ee5b5-97e4-47ec-9b14-d4f4e896f100" name="Default" comment="" /> <changelist id="f90ee5b5-97e4-47ec-9b14-d4f4e896f100" name="Default" comment="" />
<created>1350026709905</created> <created>1350026709905</created>
<updated>1350026709905</updated> <updated>1350026709905</updated>
</task> </task>
<servers /> <servers />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="619" y="0" width="825" height="600" extended-state="0" /> <frame x="0" y="22" width="1680" height="937" extended-state="6" />
<editor active="false" /> <editor active="true" />
<layout> <layout>
<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="7" side_tool="false" content_ui="tabs" /> <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="7" side_tool="false" content_ui="tabs" />
  <window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
  <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" content_ui="tabs" />
  <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" content_ui="tabs" />
  <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32925338" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
  <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
  <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="7" side_tool="false" content_ui="tabs" />
<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" content_ui="tabs" /> <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" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />  
<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="true" content_ui="tabs" /> <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="true" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.44036698" sideWeight="0.6706349" order="0" side_tool="false" content_ui="combo" /> <window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<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" content_ui="tabs" /> <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" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" /> <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.19645043" sideWeight="0.6707466" order="0" side_tool="false" content_ui="combo" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32936507" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />  
<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" content_ui="tabs" /> <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" content_ui="tabs" />
<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="7" side_tool="false" content_ui="tabs" />  
<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" content_ui="tabs" /> <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" content_ui="tabs" />
<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" content_ui="tabs" /> <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" content_ui="tabs" />
<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" content_ui="tabs" /> <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Find" 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" content_ui="tabs" /> <window_info id="Find" 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" content_ui="tabs" />
<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" content_ui="tabs" />  
<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" content_ui="combo" /> <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" content_ui="combo" />
<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" content_ui="tabs" /> <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" content_ui="tabs" />
</layout> </layout>
</component> </component>
<component name="VcsContentAnnotationSettings"> <component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" /> <option name="myLimit" value="2678400000" />
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" /> <option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" />
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="true" /> <option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="true" />
<option name="CHECK_NEW_TODO" value="true" /> <option name="CHECK_NEW_TODO" value="true" />
<option name="myTodoPanelSettings"> <option name="myTodoPanelSettings">
<value> <value>
<are-packages-shown value="false" /> <are-packages-shown value="false" />
<are-modules-shown value="false" /> <are-modules-shown value="false" />
<flatten-packages value="false" /> <flatten-packages value="false" />
<is-autoscroll-to-source value="false" /> <is-autoscroll-to-source value="false" />
</value> </value>
</option> </option>
<option name="PERFORM_UPDATE_IN_BACKGROUND" value="true" /> <option name="PERFORM_UPDATE_IN_BACKGROUND" value="true" />
<option name="PERFORM_COMMIT_IN_BACKGROUND" value="true" /> <option name="PERFORM_COMMIT_IN_BACKGROUND" value="true" />
<option name="PERFORM_EDIT_IN_BACKGROUND" value="true" /> <option name="PERFORM_EDIT_IN_BACKGROUND" value="true" />
<option name="PERFORM_CHECKOUT_IN_BACKGROUND" value="true" /> <option name="PERFORM_CHECKOUT_IN_BACKGROUND" value="true" />
<option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true" /> <option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true" />
<option name="PERFORM_ROLLBACK_IN_BACKGROUND" value="false" /> <option name="PERFORM_ROLLBACK_IN_BACKGROUND" value="false" />
<option name="CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND" value="false" /> <option name="CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND" value="false" />
<option name="CHANGED_ON_SERVER_INTERVAL" value="60" /> <option name="CHANGED_ON_SERVER_INTERVAL" value="60" />
<option name="SHOW_ONLY_CHANGED_IN_SELECTION_DIFF" value="true" /> <option name="SHOW_ONLY_CHANGED_IN_SELECTION_DIFF" value="true" />
<option name="CHECK_COMMIT_MESSAGE_SPELLING" value="true" /> <option name="CHECK_COMMIT_MESSAGE_SPELLING" value="true" />
<option name="DEFAULT_PATCH_EXTENSION" value="patch" /> <option name="DEFAULT_PATCH_EXTENSION" value="patch" />
<option name="SHORT_DIFF_HORISONTALLY" value="true" /> <option name="SHORT_DIFF_HORISONTALLY" value="true" />
<option name="SHORT_DIFF_EXTRA_LINES" value="2" /> <option name="SHORT_DIFF_EXTRA_LINES" value="2" />
<option name="SOFT_WRAPS_IN_SHORT_DIFF" value="true" /> <option name="SOFT_WRAPS_IN_SHORT_DIFF" value="true" />
<option name="INCLUDE_TEXT_INTO_PATCH" value="false" /> <option name="INCLUDE_TEXT_INTO_PATCH" value="false" />
<option name="INCLUDE_TEXT_INTO_SHELF" value="false" /> <option name="INCLUDE_TEXT_INTO_SHELF" value="false" />
<option name="SHOW_FILE_HISTORY_DETAILS" value="true" /> <option name="SHOW_FILE_HISTORY_DETAILS" value="true" />
<option name="SHOW_VCS_ERROR_NOTIFICATIONS" value="true" /> <option name="SHOW_VCS_ERROR_NOTIFICATIONS" value="true" />
  <option name="SHOW_DIRTY_RECURSIVELY" value="false" />
  <option name="LIMIT_HISTORY" value="true" />
  <option name="MAXIMUM_HISTORY_ROWS" value="1000" />
<option name="FORCE_NON_EMPTY_COMMENT" value="false" /> <option name="FORCE_NON_EMPTY_COMMENT" value="false" />
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="false" /> <option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="false" />
<option name="LAST_COMMIT_MESSAGE" /> <option name="LAST_COMMIT_MESSAGE" />
<option name="MAKE_NEW_CHANGELIST_ACTIVE" value="false" /> <option name="MAKE_NEW_CHANGELIST_ACTIVE" value="false" />
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" /> <option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
<option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false" /> <option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false" />
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" /> <option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
<option name="REFORMAT_BEFORE_FILE_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_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
<option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" /> <option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
<option name="ACTIVE_VCS_NAME" /> <option name="ACTIVE_VCS_NAME" />
<option name="UPDATE_GROUP_BY_PACKAGES" value="false" /> <option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
<option name="UPDATE_GROUP_BY_CHANGELIST" value="false" /> <option name="UPDATE_GROUP_BY_CHANGELIST" value="false" />
<option name="SHOW_FILE_HISTORY_AS_TREE" value="false" /> <option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
<option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" /> <option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager /> <breakpoint-manager />
</component> </component>
  <component name="antWorkspaceConfiguration">
  <option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
  <option name="FILTER_TARGETS" value="false" />
  </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/viewcalls.php"> <entry file="file://$PROJECT_DIR$/calllog.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="2" column="13" selection-start="46" selection-end="46" vertical-scroll-proportion="0.0"> <state line="9" column="0" selection-start="189" selection-end="189" vertical-scroll-proportion="0.0">
<folding>  
<element signature="e#255#287#0" expanded="true" />  
</folding>  
</state>  
</provider>  
</entry>  
<entry file="file://$PROJECT_DIR$/common.inc.php">  
<provider selected="true" editor-type-id="text-editor">  
<state line="34" column="0" selection-start="1179" selection-end="1179" vertical-scroll-proportion="0.0">  
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/calls.json.php"> <entry file="file://$PROJECT_DIR$/scannr.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="2" column="9" selection-start="42" selection-end="42" vertical-scroll-proportion="0.0"> <state line="12" column="21" selection-start="328" selection-end="328" vertical-scroll-proportion="0.0">
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/trunklog.php"> <entry file="file://$PROJECT_DIR$/calllog.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" /> <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
</provider>  
</entry>  
<entry file="file://$PROJECT_DIR$/../disclosr/include/template.inc.php">  
<provider selected="true" editor-type-id="text-editor">  
<state line="72" column="93" selection-start="2545" selection-end="2635" vertical-scroll-proportion="0.43404254" />  
</provider>  
</entry>  
<entry file="file://$PROJECT_DIR$/../disclosr/include/common.inc.php">  
<provider selected="true" editor-type-id="text-editor">  
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />  
</provider>  
</entry>  
<entry file="file://C:/tmp/h5bp-html5-boilerplate-2279296/index.html">  
<provider selected="true" editor-type-id="text-editor">  
<state line="38" column="11" selection-start="1245" selection-end="1982" vertical-scroll-proportion="0.93352604" />  
</provider>  
</entry>  
<entry file="file://$PROJECT_DIR$/../busui/myway/myway_timeliness.php">  
<provider selected="true" editor-type-id="text-editor">  
<state line="27" column="5" selection-start="1003" selection-end="1018" vertical-scroll-proportion="26.346153" />  
</provider>  
</entry>  
<entry file="file://$PROJECT_DIR$/scannr.py">  
<provider selected="true" editor-type-id="text-editor">  
<state line="66" column="23" selection-start="2084" selection-end="2084" vertical-scroll-proportion="0.0" />  
</provider>  
</entry>  
<entry file="file://$PROJECT_DIR$/snd.py">  
<provider selected="true" editor-type-id="text-editor">  
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />  
</provider>  
</entry>  
<entry file="file://$PROJECT_DIR$/common.inc.php">  
<provider selected="true" editor-type-id="text-editor">  
<state line="60" column="117" selection-start="2262" selection-end="2262" vertical-scroll-proportion="-39.23077">  
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
  <entry file="file://$PROJECT_DIR$/viewcalls.php">
  <provider selected="true" editor-type-id="text-editor">
  <state line="2" column="13" selection-start="46" selection-end="46" vertical-scroll-proportion="0.0" />
  </provider>
  </entry>
  <entry file="file://$PROJECT_DIR$/common.inc.php">
  <provider selected="true" editor-type-id="text-editor">
  <state line="34" column="0" selection-start="1179" selection-end="1179" vertical-scroll-proportion="0.0" />
  </provider>
  </entry>
<entry file="file://$PROJECT_DIR$/calls.json.php"> <entry file="file://$PROJECT_DIR$/calls.json.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="72" column="41" selection-start="2843" selection-end="2843" vertical-scroll-proportion="-43.153847"> <state line="2" column="9" selection-start="42" selection-end="42" vertical-scroll-proportion="0.0" />
  </provider>
  </entry>
  <entry file="file://$PROJECT_DIR$/trunklog.php">
  <provider selected="true" editor-type-id="text-editor">
  <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />
  </provider>
  </entry>
  <entry file="file://$PROJECT_DIR$/../disclosr/include/template.inc.php">
  <provider selected="true" editor-type-id="text-editor">
  <state line="72" column="93" selection-start="2545" selection-end="2635" vertical-scroll-proportion="0.43404254" />
  </provider>
  </entry>
  <entry file="file://$PROJECT_DIR$/../disclosr/include/common.inc.php">
  <provider selected="true" editor-type-id="text-editor">
  <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />
  </provider>
  </entry>
  <entry file="file://$PROJECT_DIR$/../busui/myway/myway_timeliness.php">
  <provider selected="true" editor-type-id="text-editor">
  <state line="27" column="5" selection-start="1003" selection-end="1018" vertical-scroll-proportion="26.346153" />
  </provider>
  </entry>
  <entry file="file://$PROJECT_DIR$/snd.py">
  <provider selected="true" editor-type-id="text-editor">
  <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />
  </provider>
  </entry>
  <entry file="file://$PROJECT_DIR$/common.inc.php">
  <provider selected="true" editor-type-id="text-editor">
  <state line="60" column="117" selection-start="2262" selection-end="2262" vertical-scroll-proportion="-39.23077" />
  </provider>
  </entry>
  <entry file="file://$PROJECT_DIR$/calls.json.php">
  <provider selected="true" editor-type-id="text-editor">
  <state line="72" column="41" selection-start="2843" selection-end="2843" vertical-scroll-proportion="-43.153847" />
  </provider>
  </entry>
  <entry file="file://$PROJECT_DIR$/viewcalls.php">
  <provider selected="true" editor-type-id="text-editor">
  <state line="41" column="69" selection-start="1388" selection-end="1388" vertical-scroll-proportion="1.2659575" />
  </provider>
  </entry>
  <entry file="file://$PROJECT_DIR$/calllog.php">
  <provider selected="true" editor-type-id="text-editor">
  <state line="9" column="0" selection-start="189" selection-end="189" vertical-scroll-proportion="0.0">
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/viewcalls.php"> <entry file="file://$PROJECT_DIR$/scannr.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="41" column="69" selection-start="1388" selection-end="1388" vertical-scroll-proportion="1.2659575"> <state line="80" column="64" selection-start="2271" selection-end="2271" vertical-scroll-proportion="-0.31178707">
<folding> <folding />
<element signature="e#255#287#0" expanded="true" />  
</folding>  
</state> </state>
</provider> </provider>
</entry> </entry>
</component> </component>
</project> </project>
   
   
file:a/404.html -> file:b/404.html
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Page Not Found :(</title> <title>Page Not Found :(</title>
<style> <style>
::-moz-selection { ::-moz-selection {
background: #b3d4fc; background: #b3d4fc;
text-shadow: none; text-shadow: none;
} }
   
::selection { ::selection {
background: #b3d4fc; background: #b3d4fc;
text-shadow: none; text-shadow: none;
} }
   
html { html {
padding: 30px 10px; padding: 30px 10px;
font-size: 20px; font-size: 20px;
line-height: 1.4; line-height: 1.4;
color: #737373; color: #737373;
background: #f0f0f0; background: #f0f0f0;
-webkit-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%; -ms-text-size-adjust: 100%;
} }
   
html, html,
input { input {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
} }
   
body { body {
max-width: 500px; max-width: 500px;
_width: 500px; _width: 500px;
padding: 30px 20px 50px; padding: 30px 20px 50px;
border: 1px solid #b3b3b3; border: 1px solid #b3b3b3;
border-radius: 4px; border-radius: 4px;
margin: 0 auto; margin: 0 auto;
box-shadow: 0 1px 10px #a7a7a7, inset 0 1px 0 #fff; box-shadow: 0 1px 10px #a7a7a7, inset 0 1px 0 #fff;
background: #fcfcfc; background: #fcfcfc;
} }
   
h1 { h1 {
margin: 0 10px; margin: 0 10px;
font-size: 50px; font-size: 50px;
text-align: center; text-align: center;
} }
   
h1 span { h1 span {
color: #bbb; color: #bbb;
} }
   
h3 { h3 {
margin: 1.5em 0 0.5em; margin: 1.5em 0 0.5em;
} }
   
p { p {
margin: 1em 0; margin: 1em 0;
} }
   
ul { ul {
padding: 0 0 0 40px; padding: 0 0 0 40px;
margin: 1em 0; margin: 1em 0;
} }
   
.container { .container {
max-width: 380px; max-width: 380px;
_width: 380px; _width: 380px;
margin: 0 auto; margin: 0 auto;
} }
   
/* google search */ /* google search */
   
#goog-fixurl ul { #goog-fixurl ul {
list-style: none; list-style: none;
padding: 0; padding: 0;
margin: 0; margin: 0;
} }
   
#goog-fixurl form { #goog-fixurl form {
margin: 0; margin: 0;
} }
   
#goog-wm-qt, #goog-wm-qt,
#goog-wm-sb { #goog-wm-sb {
border: 1px solid #bbb; border: 1px solid #bbb;
font-size: 16px; font-size: 16px;
line-height: normal; line-height: normal;
vertical-align: top; vertical-align: top;
color: #444; color: #444;
border-radius: 2px; border-radius: 2px;
} }
   
#goog-wm-qt { #goog-wm-qt {
width: 220px; width: 220px;
height: 20px; height: 20px;
padding: 5px; padding: 5px;
margin: 5px 10px 0 0; margin: 5px 10px 0 0;
box-shadow: inset 0 1px 1px #ccc; box-shadow: inset 0 1px 1px #ccc;
} }
   
#goog-wm-sb { #goog-wm-sb {
display: inline-block; display: inline-block;
height: 32px; height: 32px;
padding: 0 10px; padding: 0 10px;
margin: 5px 0 0; margin: 5px 0 0;
white-space: nowrap; white-space: nowrap;
cursor: pointer; cursor: pointer;
background-color: #f5f5f5; background-color: #f5f5f5;
background-image: -webkit-linear-gradient(rgba(255,255,255,0), #f1f1f1); background-image: -webkit-linear-gradient(rgba(255, 255, 255, 0), #f1f1f1);
background-image: -moz-linear-gradient(rgba(255,255,255,0), #f1f1f1); background-image: -moz-linear-gradient(rgba(255, 255, 255, 0), #f1f1f1);
background-image: -ms-linear-gradient(rgba(255,255,255,0), #f1f1f1); background-image: -ms-linear-gradient(rgba(255, 255, 255, 0), #f1f1f1);
background-image: -o-linear-gradient(rgba(255,255,255,0), #f1f1f1); background-image: -o-linear-gradient(rgba(255, 255, 255, 0), #f1f1f1);
-webkit-appearance: none; -webkit-appearance: none;
-moz-appearance: none; -moz-appearance: none;
appearance: none; appearance: none;
*overflow: visible; *overflow: visible;
*display: inline; *display: inline;
*zoom: 1; *zoom: 1;
} }
   
#goog-wm-sb:hover, #goog-wm-sb:hover,
#goog-wm-sb:focus { #goog-wm-sb:focus {
border-color: #aaa; border-color: #aaa;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
background-color: #f8f8f8; background-color: #f8f8f8;
} }
   
#goog-wm-qt:hover, #goog-wm-qt:hover,
#goog-wm-qt:focus { #goog-wm-qt:focus {
border-color: #105cb6; border-color: #105cb6;
outline: 0; outline: 0;
color: #222; color: #222;
} }
   
input::-moz-focus-inner { input::-moz-focus-inner {
padding: 0; padding: 0;
border: 0; border: 0;
} }
</style> </style>
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<h1>Not found <span>:(</span></h1> <h1>Not found <span>:(</span></h1>
<p>Sorry, but the page you were trying to view does not exist.</p>  
<p>It looks like this was the result of either:</p> <p>Sorry, but the page you were trying to view does not exist.</p>
<ul>  
<li>a mistyped address</li> <p>It looks like this was the result of either:</p>
<li>an out-of-date link</li> <ul>
</ul> <li>a mistyped address</li>
<script> <li>an out-of-date link</li>
var GOOG_FIXURL_LANG = (navigator.language || '').slice(0,2),GOOG_FIXURL_SITE = location.host; </ul>
</script> <script>
<script src="http://linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js"></script> var GOOG_FIXURL_LANG = (navigator.language || '').slice(0, 2), GOOG_FIXURL_SITE = location.host;
</div> </script>
</body> <script src="http://linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js"></script>
  </div>
  </body>
</html> </html>
   
<?php <?php
include ('common.inc.php'); include ('common.inc.php');
$sth = $conn->prepare( 'select * from recordings $sth = $conn->prepare('select * from recordings
order by call_timestamp desc limit 10'); order by call_timestamp desc limit 1000');
   
$sth->execute(Array()); $sth->execute(Array());
   
$row = 0; $row = 0;
echo "<table>"; echo "<table>";
foreach ($sth->fetchAll() as $data) { foreach ($sth->fetchAll() as $data) {
   
   
echo "<tr>"; echo "<tr>";
for ($c=0; $c < count($data); $c++) { for ($c = 0; $c < count($data); $c++) {
echo '<td>'.$data[$c] . "</td>\n"; echo '<td>' . $data[$c] . "</td>\n";
} }
echo "</tr>"; echo "</tr>";
} }
$row++; $row++;
echo "</table>"; echo "</table>";
?>  
   
<?php <?php
include('common.inc.php'); include('common.inc.php');
function getTGIDValuesByHour($TGID, $timeFrom, $timeTo) { function getTGIDValuesByHour($TGID, $timeFrom, $timeTo)
  {
global $conn; global $conn;
$sth = $conn->prepare( 'select tgid, min(call_timestamp) as time, count(*), min(length), max(length), avg(length), stddev(length) from recordings $sth = $conn->prepare('select tgid, min(call_timestamp) as time, count(*), min(length), max(length), avg(length), stddev(length) from recordings
where call_timestamp between to_timestamp(?) and to_timestamp(?) where call_timestamp between to_timestamp(?) and to_timestamp(?)
group by tgid, date_trunc(\'hour\', call_timestamp) order by time'); group by tgid, date_trunc(\'hour\', call_timestamp) order by time');
   
$sth->execute(Array($timeFrom, $timeTo)); $sth->execute(Array($timeFrom, $timeTo));
return $sth->fetchAll(); return $sth->fetchAll();
   
   
} }
   
function getTGIDValuesByDay($TGID, $dayFrom, $dayTo) { function getTGIDValuesByDay($TGID, $dayFrom, $dayTo)
  {
global $conn; global $conn;
$sth = $conn->prepare('select min(time) as time, min(value), max(value), avg(value), stddev(value) from sensor_values where sensor_id = ? $sth = $conn->prepare('select min(time) as time, min(value), max(value), avg(value), stddev(value) from sensor_values where sensor_id = ?
group by sensor_id, date_trunc(\'day\', time) order by time'); group by sensor_id, date_trunc(\'day\', time) order by time');
   
$sth->execute( Array($TGID)); $sth->execute(Array($TGID));
return $sth->fetchAll(); return $sth->fetchAll();
} }
function getTGIDDataYears($TGID, $timeFrom, $timeTo) { function getTGIDDataYears($TGID, $timeFrom, $timeTo)
  {
global $conn; global $conn;
$sth = $conn->prepare("select distinct extract('year' from call_timestamp) as year from recordings where tgid = ? order by year"); $sth = $conn->prepare("select distinct extract('year' from call_timestamp) as year from recordings where tgid = ? order by year");
   
$sth->execute(Array($TGID)); $sth->execute(Array($TGID));
return $sth->fetchAll(); return $sth->fetchAll();
} }
   
function getTGIDDataMonths($TGID, $timeFrom, $timeTo) { function getTGIDDataMonths($TGID, $timeFrom, $timeTo)
  {
global $conn; global $conn;
$sth = $conn->prepare("select distinct extract('month' from call_timestamp) as month, extract('year' from call_timestamp) as year from recordings where tgid = ? order by year, month"); $sth = $conn->prepare("select distinct extract('month' from call_timestamp) as month, extract('year' from call_timestamp) as year from recordings where tgid = ? order by year, month");
   
$sth->execute(Array($TGID)); $sth->execute(Array($TGID));
return $sth->fetchAll(); return $sth->fetchAll();
} }
   
function getTGIDDataDays($TGID, $timeFrom, $timeTo) { function getTGIDDataDays($TGID, $timeFrom, $timeTo)
  {
global $conn; global $conn;
$sth = $conn->prepare("select distinct extract('day' from call_timestamp) as day, extract('month' from call_timestamp) as month, extract('year' from call_timestamp) as year from recordings where tgid = ? order by year,month,day"); $sth = $conn->prepare("select distinct extract('day' from call_timestamp) as day, extract('month' from call_timestamp) as month, extract('year' from call_timestamp) as year from recordings where tgid = ? order by year,month,day");
   
   
$sth->execute(Array($TGID)); $sth->execute(Array($TGID));
return $sth->fetchAll(); return $sth->fetchAll();
} }
$action = (isset($_REQUEST['action']) ? $_REQUEST['action'] : ''); $action = (isset($_REQUEST['action']) ? $_REQUEST['action'] : '');
$TGID = (isset($_REQUEST['tgid']) ? $_REQUEST['tgid'] : ''); $TGID = (isset($_REQUEST['tgid']) ? $_REQUEST['tgid'] : '');
$timefrom = (isset($_REQUEST['from']) ? $_REQUEST['from'] : ''); $timefrom = (isset($_REQUEST['from']) ? $_REQUEST['from'] : '');
$timeto = (isset($_REQUEST['to']) ? $_REQUEST['to'] : ''); $timeto = (isset($_REQUEST['to']) ? $_REQUEST['to'] : '');
   
if ($action == "data_description") { if ($action == "data_description") {
$timefrom = strtotime($timefrom); $timefrom = strtotime($timefrom);
$timeto = strtotime($timeto); $timeto = strtotime($timeto);
$years = getTGIDDataYears($TGID, $timefrom, $timeto); $years = getTGIDDataYears($TGID, $timefrom, $timeto);
   
$months = getTGIDDataMonths($TGID, $timefrom, $timeto); $months = getTGIDDataMonths($TGID, $timefrom, $timeto);
$days = getTGIDDataDays($TGID, $timefrom, $timeto); $days = getTGIDDataDays($TGID, $timefrom, $timeto);
   
echo json_encode(Array("years" => $years, "months" => $months, "days" => $days echo json_encode(Array("years" => $years, "months" => $months, "days" => $days
)); ));
} }
   
   
if (strpos($action,"graph") !== false) { if (strpos($action, "graph") !== false) {
$values = getTGIDValuesByHour($TGID, $timefrom, $timeto); $values = getTGIDValuesByHour($TGID, $timefrom, $timeto);
$label = $TGID; $label = $TGID;
$data = Array(); $data = Array();
$tzoffset = get_timezone_offset("UTC"); $tzoffset = get_timezone_offset("UTC");
foreach ($values as $value) { foreach ($values as $value) {
if ($action == "graphlength") { if ($action == "graphlength") {
$data[$value['tgid']][] = Array((strtotime($value['time']) + $tzoffset) * 1000, intval($value['avg'])); $data[$value['tgid']][] = Array((strtotime($value['time']) + $tzoffset) * 1000, intval($value['avg']));
} else if ($action == "graphcount") { } else if ($action == "graphcount") {
$data[$value['tgid']][] = Array((strtotime($value['time']) + $tzoffset) * 1000, intval($value['count'])); $data[$value['tgid']][] = Array((strtotime($value['time']) + $tzoffset) * 1000, intval($value['count']));
} }
} }
echo json_encode(Array("label" => $label, "data" => $data, echo json_encode(Array("label" => $label, "data" => $data,
"previous" => Array( "previous" => Array(
"from" => $timefrom - (24 * 60 * 60), "from" => $timefrom - (24 * 60 * 60),
"to" => $timefrom) "to" => $timefrom)
, ,
"next" => Array( "next" => Array(
"to" => $timeto + (24 * 60 * 60), "to" => $timeto + (24 * 60 * 60),
"from" => $timeto) "from" => $timeto)
) )
); );
} }
   
   
   
?> ?>
   
<?php <?php
date_default_timezone_set("Australia/Sydney"); date_default_timezone_set("Australia/Sydney");
try { try {
$conn = new PDO("pgsql:dbname=scannr;user=postgres;password=snmc;host=localhost"); $conn = new PDO("pgsql:dbname=scannr;user=postgres;password=snmc;host=localhost");
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} } catch (PDOException $e) {
catch(PDOException $e) {  
die('Unable to connect to database server.'); die('Unable to connect to database server.');
} }
catch(Exception $e) { catch (Exception $e) {
die('Unknown error in ' . __FILE__ . '.'); die('Unknown error in ' . __FILE__ . '.');
} }
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
$basePath = ""; $basePath = "";
$DATA_DIR = "./data"; $DATA_DIR = "./data";
   
/** Returns the offset from the origin timezone to the remote timezone, in seconds. /** Returns the offset from the origin timezone to the remote timezone, in seconds.
* @param $remote_tz; * @param $remote_tz;
* @param $origin_tz; If null the servers current timezone is used as the origin. * @param $origin_tz; If null the servers current timezone is used as the origin.
* @return int; * @return int;
*/ */
function get_timezone_offset($remote_tz, $origin_tz = null) { function get_timezone_offset($remote_tz, $origin_tz = null)
  {
if ($origin_tz === null) { if ($origin_tz === null) {
if (!is_string($origin_tz = date_default_timezone_get())) { if (!is_string($origin_tz = date_default_timezone_get())) {
return false; // A UTC timestamp was returned -- bail out! return false; // A UTC timestamp was returned -- bail out!
} }
} }
$origin_dtz = new DateTimeZone($origin_tz); $origin_dtz = new DateTimeZone($origin_tz);
$remote_dtz = new DateTimeZone($remote_tz); $remote_dtz = new DateTimeZone($remote_tz);
$origin_dt = new DateTime("now", $origin_dtz); $origin_dt = new DateTime("now", $origin_dtz);
$remote_dt = new DateTime("now", $remote_dtz); $remote_dt = new DateTime("now", $remote_dtz);
$offset = $origin_dtz->getOffset($origin_dt) - $remote_dtz->getOffset($remote_dt); $offset = $origin_dtz->getOffset($origin_dt) - $remote_dtz->getOffset($remote_dt);
return $offset; return $offset;
} }
   
   
  function include_header($title)
  {
  global $basePath;
  ?>
  <!DOCTYPE html>
  <!--[if lt IE 7]>
  <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
  <!--[if IE 7]>
  <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
  <!--[if IE 8]>
  <html class="no-js lt-ie9"> <![endif]-->
  <!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
  <head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <title></title>
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width">
   
  <!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
   
  <link rel="stylesheet" href="css/normalize.css">
  <link rel="stylesheet" href="css/main.css">
  <script src="js/vendor/modernizr-2.6.1.min.js"></script>
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
  <!--<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.8.0.min.js"><\/script>')</script>-->
  <script type="text/javascript" src="<?php echo $basePath ?>js/flotr2/flotr2.js"></script>
  <script src="js/plugins.js"></script>
  <script src="js/main.js"></script>
  </head>
  <body>
  <!--[if lt IE 7]>
  <p class="chromeframe">You are using an outdated browser. <a href="http://browsehappy.com/">Upgrade your browser
  today</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to
  better experience this site.</p>
  <![endif]-->
   
  <!-- Add your site or application content here -->
  <?php
  }
   
  function include_footer()
  {
  global $basePath;
  ?>
   
   
  <!-- Google Analytics: change UA-XXXXX-X to be your site's ID. -->
  <script>
  var _gaq = [
  ['_setAccount', 'UA-XXXXX-X'],
  ['_trackPageview']
  ];
  (function (d, t) {
  var g = d.createElement(t), s = d.getElementsByTagName(t)[0];
  g.src = ('https:' == location.protocol ? '//ssl' : '//www') + '.google-analytics.com/ga.js';
  s.parentNode.insertBefore(g, s)
  }(document, 'script'));
  </script>
  </body>
  </html>
   
function include_header($title) { <?php
global $basePath;  
?>  
<!DOCTYPE html>  
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->  
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->  
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->  
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->  
<head>  
<meta charset="utf-8">  
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">  
<title></title>  
<meta name="description" content="">  
<meta name="viewport" content="width=device-width">  
   
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->  
   
<link rel="stylesheet" href="css/normalize.css">  
<link rel="stylesheet" href="css/main.css">  
<script src="js/vendor/modernizr-2.6.1.min.js"></script>  
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>  
<!--<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.8.0.min.js"><\/script>')</script>-->  
<script type="text/javascript" src="<?php echo $basePath ?>js/flotr2/flotr2.js"></script>  
<script src="js/plugins.js"></script>  
<script src="js/main.js"></script>  
</head>  
<body>  
<!--[if lt IE 7]>  
<p class="chromeframe">You are using an outdated browser. <a href="http://browsehappy.com/">Upgrade your browser today</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to better experience this site.</p>  
<![endif]-->  
   
<!-- Add your site or application content here -->  
<?php  
}  
   
function include_footer() {  
global $basePath;  
?>  
   
   
<!-- Google Analytics: change UA-XXXXX-X to be your site's ID. -->  
<script>  
var _gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview']];  
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];  
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';  
s.parentNode.insertBefore(g,s)}(document,'script'));  
</script>  
</body>  
</html>  
   
<?php  
   
} }
   
   
<?php <?php
include('common.inc.php'); include('common.inc.php');
$sth = $conn->prepare( 'select * from recordings limit 100;'); $sth = $conn->prepare('select * from recordings limit 100;');
   
$sth->execute( ); $sth->execute();
$recordings = $sth->fetchAll(); $recordings = $sth->fetchAll();
$convos = Array(); $convos = Array();
$convo = Array(); $convo = Array();
foreach ($recordings as $i => $recording) { foreach ($recordings as $i => $recording) {
   
if (count($convo) > 0) { if (count($convo) > 0) {
echo "<br> ".strcasecmp($convos[count($convos)-1][0]['call_timestamp'],$recording['call_timestamp']); echo "<br> " . strcasecmp($convos[count($convos) - 1][0]['call_timestamp'], $recording['call_timestamp']);
if (abs(strcasecmp($convos[count($convos)-1][0]['call_timestamp'],$recording['call_timestamp'])) > 2) { if (abs(strcasecmp($convos[count($convos) - 1][0]['call_timestamp'], $recording['call_timestamp'])) > 2) {
echo " ".$convos[count($convos)-1][0]['call_timestamp']." ".$recording['call_timestamp']; echo " " . $convos[count($convos) - 1][0]['call_timestamp'] . " " . $recording['call_timestamp'];
} }
if (strcasecmp($convos[count($convos)-1][0]['tgid'], $recording['tgid']) != 0 ) { if (strcasecmp($convos[count($convos) - 1][0]['tgid'], $recording['tgid']) != 0) {
$convos[] = $convo; $convos[] = $convo;
$convo = Array(); $convo = Array();
} }
} ; }
//print_r($recording); ;
$convo[] = $recording; //print_r($recording);
//print_r($convo); $convo[] = $recording;
//echo "<br>\n"; //print_r($convo);
  //echo "<br>\n";
} }
foreach ($convos as $i => $convo) { foreach ($convos as $i => $convo) {
foreach($convo as $recording) { foreach ($convo as $recording) {
echo $recording['filename']." , "; echo $recording['filename'] . " , ";
} }
echo "<br><hr>\n"; echo "<br><hr>\n";
} }
?> ?>
   
   
<?php <?php
$reqfile = "path/to/file.3gp"; $reqfile = "path/to/file.3gp";
$contenttype="audio/3gpp"; $contenttype = "audio/3gpp";
   
if($fn=fopen($reqfile, "rba")){ if ($fn = fopen($reqfile, "rba")) {
header("Content-Type: ".$contenttype); header("Content-Type: " . $contenttype);
header("Content-Length: ".filesize($reqfile)); header("Content-Length: " . filesize($reqfile));
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Pragma: no-cache"); header("Pragma: no-cache");
header("Expires: Mon, 26 Jul 1997 06:00:00 GMT"); header("Expires: Mon, 26 Jul 1997 06:00:00 GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0"); header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0");
passthru("ffmpeg -i 2012-09-29-1348911268.34-demo.wav -ar 8000 -ab 4.75k -"); passthru("ffmpeg -i 2012-09-29-1348911268.34-demo.wav -ar 8000 -ab 4.75k -");
fpassthru($fn); fpassthru($fn);
fclose($fn); fclose($fn);
}else{ } else {
exit("error...."); exit("error....");
} }
exit(); exit();
?> ?>
   
jasmine.HtmlReporterHelpers = {}; jasmine.HtmlReporterHelpers = {};
   
jasmine.HtmlReporterHelpers.createDom = function(type, attrs, childrenVarArgs) { jasmine.HtmlReporterHelpers.createDom = function (type, attrs, childrenVarArgs) {
var el = document.createElement(type); var el = document.createElement(type);
   
for (var i = 2; i < arguments.length; i++) { for (var i = 2; i < arguments.length; i++) {
var child = arguments[i]; var child = arguments[i];
   
if (typeof child === 'string') { if (typeof child === 'string') {
el.appendChild(document.createTextNode(child)); el.appendChild(document.createTextNode(child));
} else { } else {
if (child) { if (child) {
el.appendChild(child); el.appendChild(child);
} }
} }
} }
   
for (var attr in attrs) { for (var attr in attrs) {
if (attr == "className") { if (attr == "className") {
el[attr] = attrs[attr]; el[attr] = attrs[attr];
} else { } else {
el.setAttribute(attr, attrs[attr]); el.setAttribute(attr, attrs[attr]);
} }
} }
   
return el; return el;
}; };
   
jasmine.HtmlReporterHelpers.getSpecStatus = function(child) { jasmine.HtmlReporterHelpers.getSpecStatus = function (child) {
var results = child.results(); var results = child.results();
var status = results.passed() ? 'passed' : 'failed'; var status = results.passed() ? 'passed' : 'failed';
if (results.skipped) { if (results.skipped) {
status = 'skipped'; status = 'skipped';
} }
   
return status; return status;
}; };
   
jasmine.HtmlReporterHelpers.appendToSummary = function(child, childElement) { jasmine.HtmlReporterHelpers.appendToSummary = function (child, childElement) {
var parentDiv = this.dom.summary; var parentDiv = this.dom.summary;
var parentSuite = (typeof child.parentSuite == 'undefined') ? 'suite' : 'parentSuite'; var parentSuite = (typeof child.parentSuite == 'undefined') ? 'suite' : 'parentSuite';
var parent = child[parentSuite]; var parent = child[parentSuite];
   
if (parent) { if (parent) {
if (typeof this.views.suites[parent.id] == 'undefined') { if (typeof this.views.suites[parent.id] == 'undefined') {
this.views.suites[parent.id] = new jasmine.HtmlReporter.SuiteView(parent, this.dom, this.views); this.views.suites[parent.id] = new jasmine.HtmlReporter.SuiteView(parent, this.dom, this.views);
} }
parentDiv = this.views.suites[parent.id].element; parentDiv = this.views.suites[parent.id].element;
} }
   
parentDiv.appendChild(childElement); parentDiv.appendChild(childElement);
}; };
   
   
jasmine.HtmlReporterHelpers.addHelpers = function(ctor) { jasmine.HtmlReporterHelpers.addHelpers = function (ctor) {
for(var fn in jasmine.HtmlReporterHelpers) { for (var fn in jasmine.HtmlReporterHelpers) {
ctor.prototype[fn] = jasmine.HtmlReporterHelpers[fn]; ctor.prototype[fn] = jasmine.HtmlReporterHelpers[fn];
} }
}; };
   
jasmine.HtmlReporter = function(_doc) { jasmine.HtmlReporter = function (_doc) {
var self = this; var self = this;
var doc = _doc || window.document; var doc = _doc || window.document;
   
var reporterView; var reporterView;
   
var dom = {}; var dom = {};
   
// Jasmine Reporter Public Interface // Jasmine Reporter Public Interface
self.logRunningSpecs = false; self.logRunningSpecs = false;
   
self.reportRunnerStarting = function(runner) { self.reportRunnerStarting = function (runner) {
var specs = runner.specs() || []; var specs = runner.specs() || [];
   
if (specs.length == 0) { if (specs.length == 0) {
return; return;
} }
   
createReporterDom(runner.env.versionString()); createReporterDom(runner.env.versionString());
doc.body.appendChild(dom.reporter); doc.body.appendChild(dom.reporter);
   
reporterView = new jasmine.HtmlReporter.ReporterView(dom); reporterView = new jasmine.HtmlReporter.ReporterView(dom);
reporterView.addSpecs(specs, self.specFilter); reporterView.addSpecs(specs, self.specFilter);
}; };
   
self.reportRunnerResults = function(runner) { self.reportRunnerResults = function (runner) {
reporterView && reporterView.complete(); reporterView && reporterView.complete();
}; };
   
self.reportSuiteResults = function(suite) { self.reportSuiteResults = function (suite) {
reporterView.suiteComplete(suite); reporterView.suiteComplete(suite);
}; };
   
self.reportSpecStarting = function(spec) { self.reportSpecStarting = function (spec) {
if (self.logRunningSpecs) { if (self.logRunningSpecs) {
self.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...'); self.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...');
} }
}; };
   
self.reportSpecResults = function(spec) { self.reportSpecResults = function (spec) {
reporterView.specComplete(spec); reporterView.specComplete(spec);
}; };
   
self.log = function() { self.log = function () {
  var console = jasmine.getGlobal().console;
  if (console && console.log) {
  if (console.log.apply) {
  console.log.apply(console, arguments);
  } else {
  console.log(arguments); // ie fix: console.log.apply doesn't exist on ie
  }
  }
  };
   
  self.specFilter = function (spec) {
  if (!focusedSpecName()) {
  return true;
  }
   
  return spec.getFullName().indexOf(focusedSpecName()) === 0;
  };
   
  return self;
   
  function focusedSpecName() {
  var specName;
   
  (function memoizeFocusedSpec() {
  if (specName) {
  return;
  }
   
  var paramMap = [];
  var params = doc.location.search.substring(1).split('&');
   
  for (var i = 0; i < params.length; i++) {
  var p = params[i].split('=');
  paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
  }
   
  specName = paramMap.spec;
  })();
   
  return specName;
  }
   
  function createReporterDom(version) {
  dom.reporter = self.createDom('div', { id: 'HTMLReporter', className: 'jasmine_reporter' },
  dom.banner = self.createDom('div', { className: 'banner' },
  self.createDom('span', { className: 'title' }, "Jasmine "),
  self.createDom('span', { className: 'version' }, version)),
   
  dom.symbolSummary = self.createDom('ul', {className: 'symbolSummary'}),
  dom.alert = self.createDom('div', {className: 'alert'}),
  dom.results = self.createDom('div', {className: 'results'},
  dom.summary = self.createDom('div', { className: 'summary' }),
  dom.details = self.createDom('div', { id: 'details' }))
  );
  }
  };
  jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter);
  jasmine.HtmlReporter.ReporterView = function (dom) {
  this.startedAt = new Date();
  this.runningSpecCount = 0;
  this.completeSpecCount = 0;
  this.passedCount = 0;
  this.failedCount = 0;
  this.skippedCount = 0;
   
  this.createResultsMenu = function () {
  this.resultsMenu = this.createDom('span', {className: 'resultsMenu bar'},
  this.summaryMenuItem = this.createDom('a', {className: 'summaryMenuItem', href: "#"}, '0 specs'),
  ' | ',
  this.detailsMenuItem = this.createDom('a', {className: 'detailsMenuItem', href: "#"}, '0 failing'));
   
  this.summaryMenuItem.onclick = function () {
  dom.reporter.className = dom.reporter.className.replace(/ showDetails/g, '');
  };
   
  this.detailsMenuItem.onclick = function () {
  showDetails();
  };
  };
   
  this.addSpecs = function (specs, specFilter) {
  this.totalSpecCount = specs.length;
   
  this.views = {
  specs: {},
  suites: {}
  };
   
  for (var i = 0; i < specs.length; i++) {
  var spec = specs[i];
  this.views.specs[spec.id] = new jasmine.HtmlReporter.SpecView(spec, dom, this.views);
  if (specFilter(spec)) {
  this.runningSpecCount++;
  }
  }
  };
   
  this.specComplete = function (spec) {
  this.completeSpecCount++;
   
  if (isUndefined(this.views.specs[spec.id])) {
  this.views.specs[spec.id] = new jasmine.HtmlReporter.SpecView(spec, dom);
  }
   
  var specView = this.views.specs[spec.id];
   
  switch (specView.status()) {
  case 'passed':
  this.passedCount++;
  break;
   
  case 'failed':
  this.failedCount++;
  break;
   
  case 'skipped':
  this.skippedCount++;
  break;
  }
   
  specView.refresh();
  this.refresh();
  };
   
  this.suiteComplete = function (suite) {
  var suiteView = this.views.suites[suite.id];
  if (isUndefined(suiteView)) {
  return;
  }
  suiteView.refresh();
  };
   
  this.refresh = function () {
   
  if (isUndefined(this.resultsMenu)) {
  this.createResultsMenu();
  }
   
  // currently running UI
  if (isUndefined(this.runningAlert)) {
  this.runningAlert = this.createDom('a', {href: "?", className: "runningAlert bar"});
  dom.alert.appendChild(this.runningAlert);
  }
  this.runningAlert.innerHTML = "Running " + this.completeSpecCount + " of " + specPluralizedFor(this.totalSpecCount);
   
  // skipped specs UI
  if (isUndefined(this.skippedAlert)) {
  this.skippedAlert = this.createDom('a', {href: "?", className: "skippedAlert bar"});
  }
   
  this.skippedAlert.innerHTML = "Skipping " + this.skippedCount + " of " + specPluralizedFor(this.totalSpecCount) + " - run all";
   
  if (this.skippedCount === 1 && isDefined(dom.alert)) {
  dom.alert.appendChild(this.skippedAlert);
  }
   
  // passing specs UI
  if (isUndefined(this.passedAlert)) {
  this.passedAlert = this.createDom('span', {href: "?", className: "passingAlert bar"});
  }
  this.passedAlert.innerHTML = "Passing " + specPluralizedFor(this.passedCount);
   
  // failing specs UI
  if (isUndefined(this.failedAlert)) {
  this.failedAlert = this.createDom('span', {href: "?", className: "failingAlert bar"});
  }
  this.failedAlert.innerHTML = "Failing " + specPluralizedFor(this.failedCount);
   
  if (this.failedCount === 1 && isDefined(dom.alert)) {
  dom.alert.appendChild(this.failedAlert);
  dom.alert.appendChild(this.resultsMenu);
  }
   
  // summary info
  this.summaryMenuItem.innerHTML = "" + specPluralizedFor(this.runningSpecCount);
  this.detailsMenuItem.innerHTML = "" + this.failedCount + " failing";
  };
   
  this.complete = function () {
  dom.alert.removeChild(this.runningAlert);
   
  this.skippedAlert.innerHTML = "Ran " + this.runningSpecCount + " of " + specPluralizedFor(this.totalSpecCount) + " - run all";
   
  if (this.failedCount === 0) {
  dom.alert.appendChild(this.createDom('span', {className: 'passingAlert bar'}, "Passing " + specPluralizedFor(this.passedCount)));
  } else {
  showDetails();
  }
   
  dom.banner.appendChild(this.createDom('span', {className: 'duration'}, "finished in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s"));
  };
   
  return this;
   
  function showDetails() {
  if (dom.reporter.className.search(/showDetails/) === -1) {
  dom.reporter.className += " showDetails";
  }
  }
   
  function isUndefined(obj) {
  return typeof obj === 'undefined';
  }
   
  function isDefined(obj) {
  return !isUndefined(obj);
  }
   
  function specPluralizedFor(count) {
  var str = count + " spec";
  if (count > 1) {
  str += "s"
  }
  return str;
  }
   
  };
   
  jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.ReporterView);
   
   
  jasmine.HtmlReporter.SpecView = function (spec, dom, views) {
  this.spec = spec;
  this.dom = dom;
  this.views = views;
   
  this.symbol = this.createDom('li', { className: 'pending' });
  this.dom.symbolSummary.appendChild(this.symbol);
   
  this.summary = this.createDom('div', { className: 'specSummary' },
  this.createDom('a', {
  className: 'description',
  href: '?spec=' + encodeURIComponent(this.spec.getFullName()),
  title: this.spec.getFullName()
  }, this.spec.description)
  );
   
  this.detail = this.createDom('div', { className: 'specDetail' },
  this.createDom('a', {
  className: 'description',
  href: '?spec=' + encodeURIComponent(this.spec.getFullName()),
  title: this.spec.getFullName()
  }, this.spec.getFullName())
  );
  };
   
  jasmine.HtmlReporter.SpecView.prototype.status = function () {
  return this.getSpecStatus(this.spec);
  };
   
  jasmine.HtmlReporter.SpecView.prototype.refresh = function () {
  this.symbol.className = this.status();
   
  switch (this.status()) {
  case 'skipped':
  break;
   
  case 'passed':
  this.appendSummaryToSuiteDiv();
  break;
   
  case 'failed':
  this.appendSummaryToSuiteDiv();
  this.appendFailureDetail();
  break;
  }
  };
   
  jasmine.HtmlReporter.SpecView.prototype.appendSummaryToSuiteDiv = function () {
  this.summary.className += ' ' + this.status();
  this.appendToSummary(this.spec, this.summary);
  };
   
  jasmine.HtmlReporter.SpecView.prototype.appendFailureDetail = function () {
  this.detail.className += ' ' + this.status();
   
  var resultItems = this.spec.results().getItems();
  var messagesDiv = this.createDom('div', { className: 'messages' });
   
  for (var i = 0; i < resultItems.length; i++) {
  var result = resultItems[i];
   
  if (result.type == 'log') {
  messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString()));
  } else if (result.type == 'expect' && result.passed && !result.passed()) {
  messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));
   
  if (result.trace.stack) {
  messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));
  }
  }
  }
   
  if (messagesDiv.childNodes.length > 0) {
  this.detail.appendChild(messagesDiv);
  this.dom.details.appendChild(this.detail);
  }
  };
   
  jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SpecView);
  jasmine.HtmlReporter.SuiteView = function (suite, dom, views) {
  this.suite = suite;
  this.dom = dom;
  this.views = views;
   
  this.element = this.createDom('div', { className: 'suite' },
  this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(this.suite.getFullName()) }, this.suite.description)
  );
   
  this.appendToSummary(this.suite, this.element);
  };
   
  jasmine.HtmlReporter.SuiteView.prototype.status = function () {
  return this.getSpecStatus(this.suite);
  };
   
  jasmine.HtmlReporter.SuiteView.prototype.refresh = function () {
  this.element.className += " " + this.status();
  };
   
  jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SuiteView);
   
  /* @deprecated Use jasmine.HtmlReporter instead
  */
  jasmine.TrivialReporter = function (doc) {
  this.document = doc || document;
  this.suiteDivs = {};
  this.logRunningSpecs = false;
  };
   
  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 {
  if (child) {
  el.appendChild(child);
  }
  }
  }
   
  for (var attr in attrs) {
  if (attr == "className") {
  el[attr] = attrs[attr];
  } else {
  el.setAttribute(attr, attrs[attr]);
  }
  }
   
  return el;
  };
   
  jasmine.TrivialReporter.prototype.reportRunnerStarting = function (runner) {
  var showPassed, showSkipped;
   
  this.outerDiv = this.createDom('div', { id: 'TrivialReporter', className: 'jasmine_reporter' },
  this.createDom('div', { className: 'banner' },
  this.createDom('div', { className: 'logo' },
  this.createDom('span', { className: 'title' }, "Jasmine"),
  this.createDom('span', { className: 'version' }, runner.env.versionString())),
  this.createDom('div', { className: 'options' },
  "Show ",
  showPassed = this.createDom('input', { id: "__jasmine_TrivialReporter_showPassed__", type: 'checkbox' }),
  this.createDom('label', { "for": "__jasmine_TrivialReporter_showPassed__" }, " passed "),
  showSkipped = this.createDom('input', { id: "__jasmine_TrivialReporter_showSkipped__", type: 'checkbox' }),
  this.createDom('label', { "for": "__jasmine_TrivialReporter_showSkipped__" }, " skipped")
  )
  ),
   
  this.runnerDiv = this.createDom('div', { className: 'runner running' },
  this.createDom('a', { className: 'run_spec', href: '?' }, "run all"),
  this.runnerMessageSpan = this.createDom('span', {}, "Running..."),
  this.finishedAtSpan = this.createDom('span', { className: 'finished-at' }, ""))
  );
   
  this.document.body.appendChild(this.outerDiv);
   
  var suites = runner.suites();
  for (var i = 0; i < suites.length; i++) {
  var suite = suites[i];
  var suiteDiv = this.createDom('div', { className: 'suite' },
  this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"),
  this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description));
  this.suiteDivs[suite.id] = suiteDiv;
  var parentDiv = this.outerDiv;
  if (suite.parentSuite) {
  parentDiv = this.suiteDivs[suite.parentSuite.id];
  }
  parentDiv.appendChild(suiteDiv);
  }
   
  this.startedAt = new Date();
   
  var self = this;
  showPassed.onclick = function (evt) {
  if (showPassed.checked) {
  self.outerDiv.className += ' show-passed';
  } else {
  self.outerDiv.className = self.outerDiv.className.replace(/ show-passed/, '');
  }
  };
   
  showSkipped.onclick = function (evt) {
  if (showSkipped.checked) {
  self.outerDiv.className += ' show-skipped';
  } else {
  self.outerDiv.className = self.outerDiv.className.replace(/ show-skipped/, '');
  }
  };
  };
   
  jasmine.TrivialReporter.prototype.reportRunnerResults = function (runner) {
  var results = runner.results();
  var className = (results.failedCount > 0) ? "runner failed" : "runner passed";
  this.runnerDiv.setAttribute("class", className);
  //do it twice for IE
  this.runnerDiv.setAttribute("className", className);
  var specs = runner.specs();
  var specCount = 0;
  for (var i = 0; i < specs.length; i++) {
  if (this.specFilter(specs[i])) {
  specCount++;
  }
  }
  var message = "" + specCount + " spec" + (specCount == 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s");
  message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s";
  this.runnerMessageSpan.replaceChild(this.createDom('a', { className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild);
   
  this.finishedAtSpan.appendChild(document.createTextNode("Finished at " + new Date().toString()));
  };
   
  jasmine.TrivialReporter.prototype.reportSuiteResults = function (suite) {
  var results = suite.results();
  var status = results.passed() ? 'passed' : 'failed';
  if (results.totalCount === 0) { // todo: change this to check results.skipped
  status = 'skipped';
  }
  this.suiteDivs[suite.id].className += " " + status;
  };
   
  jasmine.TrivialReporter.prototype.reportSpecStarting = function (spec) {
  if (this.logRunningSpecs) {
  this.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...');
  }
  };
   
  jasmine.TrivialReporter.prototype.reportSpecResults = function (spec) {
  var results = spec.results();
  var status = results.passed() ? 'passed' : 'failed';
  if (results.skipped) {
  status = 'skipped';
  }
  var specDiv = this.createDom('div', { className: 'spec ' + status },
  this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"),
  this.createDom('a', {
  className: 'description',
  href: '?spec=' + encodeURIComponent(spec.getFullName()),
  title: spec.getFullName()
  }, spec.description));
   
   
  var resultItems = results.getItems();
  var messagesDiv = this.createDom('div', { className: 'messages' });
  for (var i = 0; i < resultItems.length; i++) {
  var result = resultItems[i];
   
  if (result.type == 'log') {
  messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString()));
  } else if (result.type == 'expect' && result.passed && !result.passed()) {
  messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));
   
  if (result.trace.stack) {
  messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));
  }
  }
  }
   
  if (messagesDiv.childNodes.length > 0) {
  specDiv.appendChild(messagesDiv);
  }
   
  this.suiteDivs[spec.suite.id].appendChild(specDiv);
  };
   
  jasmine.TrivialReporter.prototype.log = function () {
var console = jasmine.getGlobal().console; var console = jasmine.getGlobal().console;
if (console && console.log) { if (console && console.log) {
if (console.log.apply) { if (console.log.apply) {
console.log.apply(console, arguments); console.log.apply(console, arguments);
} else { } else {
console.log(arguments); // ie fix: console.log.apply doesn't exist on ie console.log(arguments); // ie fix: console.log.apply doesn't exist on ie
} }
} }
}; };
   
self.specFilter = function(spec) { jasmine.TrivialReporter.prototype.getLocation = function () {
if (!focusedSpecName()) { return this.document.location;
return true; };
}  
  jasmine.TrivialReporter.prototype.specFilter = function (spec) {
return spec.getFullName().indexOf(focusedSpecName()) === 0; var paramMap = {};
}; var params = this.getLocation().search.substring(1).split('&');
  for (var i = 0; i < params.length; i++) {
return self;  
   
function focusedSpecName() {  
var specName;  
   
(function memoizeFocusedSpec() {  
if (specName) {  
return;  
}  
   
var paramMap = [];  
var params = doc.location.search.substring(1).split('&');  
   
for (var i = 0; i < params.length; i++) {  
var p = params[i].split('='); var p = params[i].split('=');
paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]); paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
} }
   
specName = paramMap.spec; if (!paramMap.spec) {
})(); return true;
  }
return specName; return spec.getFullName().indexOf(paramMap.spec) === 0;
} };
   
function createReporterDom(version) {  
dom.reporter = self.createDom('div', { id: 'HTMLReporter', className: 'jasmine_reporter' },  
dom.banner = self.createDom('div', { className: 'banner' },  
self.createDom('span', { className: 'title' }, "Jasmine "),  
self.createDom('span', { className: 'version' }, version)),  
   
dom.symbolSummary = self.createDom('ul', {className: 'symbolSummary'}),  
dom.alert = self.createDom('div', {className: 'alert'}),  
dom.results = self.createDom('div', {className: 'results'},  
dom.summary = self.createDom('div', { className: 'summary' }),  
dom.details = self.createDom('div', { id: 'details' }))  
);  
}  
};  
jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter);jasmine.HtmlReporter.ReporterView = function(dom) {  
this.startedAt = new Date();  
this.runningSpecCount = 0;  
this.completeSpecCount = 0;  
this.passedCount = 0;  
this.failedCount = 0;  
this.skippedCount = 0;  
   
this.createResultsMenu = function() {  
this.resultsMenu = this.createDom('span', {className: 'resultsMenu bar'},  
this.summaryMenuItem = this.createDom('a', {className: 'summaryMenuItem', href: "#"}, '0 specs'),  
' | ',  
this.detailsMenuItem = this.createDom('a', {className: 'detailsMenuItem', href: "#"}, '0 failing'));  
   
this.summaryMenuItem.onclick = function() {  
dom.reporter.className = dom.reporter.className.replace(/ showDetails/g, '');  
};  
   
this.detailsMenuItem.onclick = function() {  
showDetails();  
};  
};  
   
this.addSpecs = function(specs, specFilter) {  
this.totalSpecCount = specs.length;  
   
this.views = {  
specs: {},  
suites: {}  
};  
   
for (var i = 0; i < specs.length; i++) {  
var spec = specs[i];  
this.views.specs[spec.id] = new jasmine.HtmlReporter.SpecView(spec, dom, this.views);  
if (specFilter(spec)) {  
this.runningSpecCount++;  
}  
}  
};  
   
this.specComplete = function(spec) {  
this.completeSpecCount++;  
   
if (isUndefined(this.views.specs[spec.id])) {  
this.views.specs[spec.id] = new jasmine.HtmlReporter.SpecView(spec, dom);  
}  
   
var specView = this.views.specs[spec.id];  
   
switch (specView.status()) {  
case 'passed':  
this.passedCount++;  
break;  
   
case 'failed':  
this.failedCount++;  
break;  
   
case 'skipped':  
this.skippedCount++;  
break;  
}  
   
specView.refresh();  
this.refresh();  
};  
   
this.suiteComplete = function(suite) {  
var suiteView = this.views.suites[suite.id];  
if (isUndefined(suiteView)) {  
return;  
}  
suiteView.refresh();  
};  
   
this.refresh = function() {  
   
if (isUndefined(this.resultsMenu)) {  
this.createResultsMenu();  
}  
   
// currently running UI  
if (isUndefined(this.runningAlert)) {  
this.runningAlert = this.createDom('a', {href: "?", className: "runningAlert bar"});  
dom.alert.appendChild(this.runningAlert);  
}  
this.runningAlert.innerHTML = "Running " + this.completeSpecCount + " of " + specPluralizedFor(this.totalSpecCount);  
   
// skipped specs UI  
if (isUndefined(this.skippedAlert)) {  
this.skippedAlert = this.createDom('a', {href: "?", className: "skippedAlert bar"});  
}  
   
this.skippedAlert.innerHTML = "Skipping " + this.skippedCount + " of " + specPluralizedFor(this.totalSpecCount) + " - run all";  
   
if (this.skippedCount === 1 && isDefined(dom.alert)) {  
dom.alert.appendChild(this.skippedAlert);  
}  
   
// passing specs UI  
if (isUndefined(this.passedAlert)) {  
this.passedAlert = this.createDom('span', {href: "?", className: "passingAlert bar"});  
}  
this.passedAlert.innerHTML = "Passing " + specPluralizedFor(this.passedCount);  
   
// failing specs UI  
if (isUndefined(this.failedAlert)) {  
this.failedAlert = this.createDom('span', {href: "?", className: "failingAlert bar"});  
}  
this.failedAlert.innerHTML = "Failing " + specPluralizedFor(this.failedCount);  
   
if (this.failedCount === 1 && isDefined(dom.alert)) {  
dom.alert.appendChild(this.failedAlert);  
dom.alert.appendChild(this.resultsMenu);  
}  
   
// summary info  
this.summaryMenuItem.innerHTML = "" + specPluralizedFor(this.runningSpecCount);  
this.detailsMenuItem.innerHTML = "" + this.failedCount + " failing";  
};  
   
this.complete = function() {  
dom.alert.removeChild(this.runningAlert);  
   
this.skippedAlert.innerHTML = "Ran " + this.runningSpecCount + " of " + specPluralizedFor(this.totalSpecCount) + " - run all";  
   
if (this.failedCount === 0) {  
dom.alert.appendChild(this.createDom('span', {className: 'passingAlert bar'}, "Passing " + specPluralizedFor(this.passedCount)));  
} else {  
showDetails();  
}  
   
dom.banner.appendChild(this.createDom('span', {className: 'duration'}, "finished in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s"));  
};  
   
return this;  
   
function showDetails() {  
if (dom.reporter.className.search(/showDetails/) === -1) {  
dom.reporter.className += " showDetails";  
}  
}  
   
function isUndefined(obj) {  
return typeof obj === 'undefined';  
}  
   
function isDefined(obj) {  
return !isUndefined(obj);  
}  
   
function specPluralizedFor(count) {  
var str = count + " spec";  
if (count > 1) {  
str += "s"  
}  
return str;  
}  
   
};  
   
jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.ReporterView);  
   
   
jasmine.HtmlReporter.SpecView = function(spec, dom, views) {  
this.spec = spec;  
this.dom = dom;  
this.views = views;  
   
this.symbol = this.createDom('li', { className: 'pending' });  
this.dom.symbolSummary.appendChild(this.symbol);  
   
this.summary = this.createDom('div', { className: 'specSummary' },  
this.createDom('a', {  
className: 'description',  
href: '?spec=' + encodeURIComponent(this.spec.getFullName()),  
title: this.spec.getFullName()  
}, this.spec.description)  
);  
   
this.detail = this.createDom('div', { className: 'specDetail' },  
this.createDom('a', {  
className: 'description',  
href: '?spec=' + encodeURIComponent(this.spec.getFullName()),  
title: this.spec.getFullName()  
}, this.spec.getFullName())  
);  
};  
   
jasmine.HtmlReporter.SpecView.prototype.status = function() {  
return this.getSpecStatus(this.spec);  
};  
   
jasmine.HtmlReporter.SpecView.prototype.refresh = function() {  
this.symbol.className = this.status();  
   
switch (this.status()) {  
case 'skipped':  
break;  
   
case 'passed':  
this.appendSummaryToSuiteDiv();  
break;  
   
case 'failed':  
this.appendSummaryToSuiteDiv();  
this.appendFailureDetail();  
break;  
}  
};  
   
jasmine.HtmlReporter.SpecView.prototype.appendSummaryToSuiteDiv = function() {  
this.summary.className += ' ' + this.status();  
this.appendToSummary(this.spec, this.summary);  
};  
   
jasmine.HtmlReporter.SpecView.prototype.appendFailureDetail = function() {  
this.detail.className += ' ' + this.status();  
   
var resultItems = this.spec.results().getItems();  
var messagesDiv = this.createDom('div', { className: 'messages' });  
   
for (var i = 0; i < resultItems.length; i++) {  
var result = resultItems[i];  
   
if (result.type == 'log') {  
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString()));  
} else if (result.type == 'expect' && result.passed && !result.passed()) {  
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));  
   
if (result.trace.stack) {  
messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));  
}  
}  
}  
   
if (messagesDiv.childNodes.length > 0) {  
this.detail.appendChild(messagesDiv);  
this.dom.details.appendChild(this.detail);  
}  
};  
   
jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SpecView);jasmine.HtmlReporter.SuiteView = function(suite, dom, views) {  
this.suite = suite;  
this.dom = dom;  
this.views = views;  
   
this.element = this.createDom('div', { className: 'suite' },  
this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(this.suite.getFullName()) }, this.suite.description)  
);  
   
this.appendToSummary(this.suite, this.element);  
};  
   
jasmine.HtmlReporter.SuiteView.prototype.status = function() {  
return this.getSpecStatus(this.suite);  
};  
   
jasmine.HtmlReporter.SuiteView.prototype.refresh = function() {  
this.element.className += " " + this.status();  
};  
   
jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SuiteView);  
   
/* @deprecated Use jasmine.HtmlReporter instead  
*/  
jasmine.TrivialReporter = function(doc) {  
this.document = doc || document;  
this.suiteDivs = {};  
this.logRunningSpecs = false;  
};  
   
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 {  
if (child) { el.appendChild(child); }  
}  
}  
   
for (var attr in attrs) {  
if (attr == "className") {  
el[attr] = attrs[attr];  
} else {  
el.setAttribute(attr, attrs[attr]);  
}  
}  
   
return el;  
};  
   
jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) {  
var showPassed, showSkipped;  
   
this.outerDiv = this.createDom('div', { id: 'TrivialReporter', className: 'jasmine_reporter' },  
this.createDom('div', { className: 'banner' },  
this.createDom('div', { className: 'logo' },  
this.createDom('span', { className: 'title' }, "Jasmine"),  
this.createDom('span', { className: 'version' }, runner.env.versionString())),  
this.createDom('div', { className: 'options' },  
"Show ",  
showPassed = this.createDom('input', { id: "__jasmine_TrivialReporter_showPassed__", type: 'checkbox' }),  
this.createDom('label', { "for": "__jasmine_TrivialReporter_showPassed__" }, " passed "),  
showSkipped = this.createDom('input', { id: "__jasmine_TrivialReporter_showSkipped__", type: 'checkbox' }),  
this.createDom('label', { "for": "__jasmine_TrivialReporter_showSkipped__" }, " skipped")  
)  
),  
   
this.runnerDiv = this.createDom('div', { className: 'runner running' },  
this.createDom('a', { className: 'run_spec', href: '?' }, "run all"),  
this.runnerMessageSpan = this.createDom('span', {}, "Running..."),  
this.finishedAtSpan = this.createDom('span', { className: 'finished-at' }, ""))  
);  
   
this.document.body.appendChild(this.outerDiv);  
   
var suites = runner.suites();  
for (var i = 0; i < suites.length; i++) {  
var suite = suites[i];  
var suiteDiv = this.createDom('div', { className: 'suite' },  
this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"),  
this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description));  
this.suiteDivs[suite.id] = suiteDiv;  
var parentDiv = this.outerDiv;  
if (suite.parentSuite) {  
parentDiv = this.suiteDivs[suite.parentSuite.id];  
}  
parentDiv.appendChild(suiteDiv);  
}  
   
this.startedAt = new Date();  
   
var self = this;  
showPassed.onclick = function(evt) {  
if (showPassed.checked) {  
self.outerDiv.className += ' show-passed';  
} else {  
self.outerDiv.className = self.outerDiv.className.replace(/ show-passed/, '');  
}  
};  
   
showSkipped.onclick = function(evt) {  
if (showSkipped.checked) {  
self.outerDiv.className += ' show-skipped';  
} else {  
self.outerDiv.className = self.outerDiv.className.replace(/ show-skipped/, '');  
}  
};  
};  
   
jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) {  
var results = runner.results();  
var className = (results.failedCount > 0) ? "runner failed" : "runner passed";  
this.runnerDiv.setAttribute("class", className);  
//do it twice for IE  
this.runnerDiv.setAttribute("className", className);  
var specs = runner.specs();  
var specCount = 0;  
for (var i = 0; i < specs.length; i++) {  
if (this.specFilter(specs[i])) {  
specCount++;  
}  
}  
var message = "" + specCount + " spec" + (specCount == 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s");  
message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s";  
this.runnerMessageSpan.replaceChild(this.createDom('a', { className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild);  
   
this.finishedAtSpan.appendChild(document.createTextNode("Finished at " + new Date().toString()));  
};  
   
jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) {  
var results = suite.results();  
var status = results.passed() ? 'passed' : 'failed';  
if (results.totalCount === 0) { // todo: change this to check results.skipped  
status = 'skipped';  
}  
this.suiteDivs[suite.id].className += " " + status;  
};  
   
jasmine.TrivialReporter.prototype.reportSpecStarting = function(spec) {  
if (this.logRunningSpecs) {  
this.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...');  
}  
};  
   
jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) {  
var results = spec.results();  
var status = results.passed() ? 'passed' : 'failed';  
if (results.skipped) {  
status = 'skipped';  
}  
var specDiv = this.createDom('div', { className: 'spec ' + status },  
this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"),  
this.createDom('a', {  
className: 'description',  
href: '?spec=' + encodeURIComponent(spec.getFullName()),  
title: spec.getFullName()  
}, spec.description));  
   
   
var resultItems = results.getItems();  
var messagesDiv = this.createDom('div', { className: 'messages' });  
for (var i = 0; i < resultItems.length; i++) {  
var result = resultItems[i];  
   
if (result.type == 'log') {  
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString()));  
} else if (result.type == 'expect' && result.passed && !result.passed()) {  
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));  
   
if (result.trace.stack) {  
messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));  
}  
}  
}  
   
if (messagesDiv.childNodes.length > 0) {  
specDiv.appendChild(messagesDiv);  
}  
   
this.suiteDivs[spec.suite.id].appendChild(specDiv);  
};  
   
jasmine.TrivialReporter.prototype.log = function() {  
var console = jasmine.getGlobal().console;  
if (console && console.log) {  
if (console.log.apply) {  
console.log.apply(console, arguments);  
} else {  
console.log(arguments); // ie fix: console.log.apply doesn't exist on ie  
}  
}  
};  
   
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;  
};  
   
body { background-color: #eeeeee; padding: 0; margin: 5px; overflow-y: scroll; } body {
  background-color: #eeeeee;
#HTMLReporter { font-size: 11px; font-family: Monaco, "Lucida Console", monospace; line-height: 14px; color: #333333; } padding: 0;
#HTMLReporter a { text-decoration: none; } margin: 5px;
#HTMLReporter a:hover { text-decoration: underline; } overflow-y: scroll;
#HTMLReporter p, #HTMLReporter h1, #HTMLReporter h2, #HTMLReporter h3, #HTMLReporter h4, #HTMLReporter h5, #HTMLReporter h6 { margin: 0; line-height: 14px; } }
#HTMLReporter .banner, #HTMLReporter .symbolSummary, #HTMLReporter .summary, #HTMLReporter .resultMessage, #HTMLReporter .specDetail .description, #HTMLReporter .alert .bar, #HTMLReporter .stackTrace { padding-left: 9px; padding-right: 9px; }  
#HTMLReporter #jasmine_content { position: fixed; right: 100%; } #HTMLReporter {
#HTMLReporter .version { color: #aaaaaa; } font-size: 11px;
#HTMLReporter .banner { margin-top: 14px; } font-family: Monaco, "Lucida Console", monospace;
#HTMLReporter .duration { color: #aaaaaa; float: right; } line-height: 14px;
#HTMLReporter .symbolSummary { overflow: hidden; *zoom: 1; margin: 14px 0; } color: #333333;
#HTMLReporter .symbolSummary li { display: block; float: left; height: 7px; width: 14px; margin-bottom: 7px; font-size: 16px; } }
#HTMLReporter .symbolSummary li.passed { font-size: 14px; }  
#HTMLReporter .symbolSummary li.passed:before { color: #5e7d00; content: "\02022"; } #HTMLReporter a {
#HTMLReporter .symbolSummary li.failed { line-height: 9px; } text-decoration: none;
#HTMLReporter .symbolSummary li.failed:before { color: #b03911; content: "x"; font-weight: bold; margin-left: -1px; } }
#HTMLReporter .symbolSummary li.skipped { font-size: 14px; }  
#HTMLReporter .symbolSummary li.skipped:before { color: #bababa; content: "\02022"; } #HTMLReporter a:hover {
#HTMLReporter .symbolSummary li.pending { line-height: 11px; } text-decoration: underline;
#HTMLReporter .symbolSummary li.pending:before { color: #aaaaaa; content: "-"; } }
#HTMLReporter .bar { line-height: 28px; font-size: 14px; display: block; color: #eee; }  
#HTMLReporter .runningAlert { background-color: #666666; } #HTMLReporter p, #HTMLReporter h1, #HTMLReporter h2, #HTMLReporter h3, #HTMLReporter h4, #HTMLReporter h5, #HTMLReporter h6 {
#HTMLReporter .skippedAlert { background-color: #aaaaaa; } margin: 0;
#HTMLReporter .skippedAlert:first-child { background-color: #333333; } line-height: 14px;
#HTMLReporter .skippedAlert:hover { text-decoration: none; color: white; text-decoration: underline; } }
#HTMLReporter .passingAlert { background-color: #a6b779; }  
#HTMLReporter .passingAlert:first-child { background-color: #5e7d00; } #HTMLReporter .banner, #HTMLReporter .symbolSummary, #HTMLReporter .summary, #HTMLReporter .resultMessage, #HTMLReporter .specDetail .description, #HTMLReporter .alert .bar, #HTMLReporter .stackTrace {
#HTMLReporter .failingAlert { background-color: #cf867e; } padding-left: 9px;
#HTMLReporter .failingAlert:first-child { background-color: #b03911; } padding-right: 9px;
#HTMLReporter .results { margin-top: 14px; } }
#HTMLReporter #details { display: none; }  
#HTMLReporter .resultsMenu, #HTMLReporter .resultsMenu a { background-color: #fff; color: #333333; } #HTMLReporter #jasmine_content {
#HTMLReporter.showDetails .summaryMenuItem { font-weight: normal; text-decoration: inherit; } position: fixed;
#HTMLReporter.showDetails .summaryMenuItem:hover { text-decoration: underline; } right: 100%;
#HTMLReporter.showDetails .detailsMenuItem { font-weight: bold; text-decoration: underline; } }
#HTMLReporter.showDetails .summary { display: none; }  
#HTMLReporter.showDetails #details { display: block; } #HTMLReporter .version {
#HTMLReporter .summaryMenuItem { font-weight: bold; text-decoration: underline; } color: #aaaaaa;
#HTMLReporter .summary { margin-top: 14px; } }
#HTMLReporter .summary .suite .suite, #HTMLReporter .summary .specSummary { margin-left: 14px; }  
#HTMLReporter .summary .specSummary.passed a { color: #5e7d00; } #HTMLReporter .banner {
#HTMLReporter .summary .specSummary.failed a { color: #b03911; } margin-top: 14px;
#HTMLReporter .description + .suite { margin-top: 0; } }
#HTMLReporter .suite { margin-top: 14px; }  
#HTMLReporter .suite a { color: #333333; } #HTMLReporter .duration {
#HTMLReporter #details .specDetail { margin-bottom: 28px; } color: #aaaaaa;
#HTMLReporter #details .specDetail .description { display: block; color: white; background-color: #b03911; } float: right;
#HTMLReporter .resultMessage { padding-top: 14px; color: #333333; } }
#HTMLReporter .resultMessage span.result { display: block; }  
#HTMLReporter .stackTrace { margin: 5px 0 0 0; max-height: 224px; overflow: auto; line-height: 18px; color: #666666; border: 1px solid #ddd; background: white; white-space: pre; } #HTMLReporter .symbolSummary {
  overflow: hidden;
#TrivialReporter { padding: 8px 13px; position: absolute; top: 0; bottom: 0; left: 0; right: 0; overflow-y: scroll; background-color: white; font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif; /*.resultMessage {*/ /*white-space: pre;*/ /*}*/ } *zoom: 1;
#TrivialReporter a:visited, #TrivialReporter a { color: #303; } margin: 14px 0;
#TrivialReporter a:hover, #TrivialReporter a:active { color: blue; } }
#TrivialReporter .run_spec { float: right; padding-right: 5px; font-size: .8em; text-decoration: none; }  
#TrivialReporter .banner { color: #303; background-color: #fef; padding: 5px; } #HTMLReporter .symbolSummary li {
#TrivialReporter .logo { float: left; font-size: 1.1em; padding-left: 5px; } display: block;
#TrivialReporter .logo .version { font-size: .6em; padding-left: 1em; } float: left;
#TrivialReporter .runner.running { background-color: yellow; } height: 7px;
#TrivialReporter .options { text-align: right; font-size: .8em; } width: 14px;
#TrivialReporter .suite { border: 1px outset gray; margin: 5px 0; padding-left: 1em; } margin-bottom: 7px;
#TrivialReporter .suite .suite { margin: 5px; } font-size: 16px;
#TrivialReporter .suite.passed { background-color: #dfd; } }
#TrivialReporter .suite.failed { background-color: #fdd; }  
#TrivialReporter .spec { margin: 5px; padding-left: 1em; clear: both; } #HTMLReporter .symbolSummary li.passed {
#TrivialReporter .spec.failed, #TrivialReporter .spec.passed, #TrivialReporter .spec.skipped { padding-bottom: 5px; border: 1px solid gray; } font-size: 14px;
#TrivialReporter .spec.failed { background-color: #fbb; border-color: red; } }
#TrivialReporter .spec.passed { background-color: #bfb; border-color: green; }  
#TrivialReporter .spec.skipped { background-color: #bbb; } #HTMLReporter .symbolSummary li.passed:before {
#TrivialReporter .messages { border-left: 1px dashed gray; padding-left: 1em; padding-right: 1em; } color: #5e7d00;
#TrivialReporter .passed { background-color: #cfc; display: none; } content: "\02022";
#TrivialReporter .failed { background-color: #fbb; } }
#TrivialReporter .skipped { color: #777; background-color: #eee; display: none; }  
#TrivialReporter .resultMessage span.result { display: block; line-height: 2em; color: black; } #HTMLReporter .symbolSummary li.failed {
#TrivialReporter .resultMessage .mismatch { color: black; } line-height: 9px;
#TrivialReporter .stackTrace { white-space: pre; font-size: .8em; margin-left: 10px; max-height: 5em; overflow: auto; border: 1px inset red; padding: 1em; background: #eef; } }
#TrivialReporter .finished-at { padding-left: 1em; font-size: .6em; }  
#TrivialReporter.show-passed .passed, #TrivialReporter.show-skipped .skipped { display: block; } #HTMLReporter .symbolSummary li.failed:before {
#TrivialReporter #jasmine_content { position: fixed; right: 100%; } color: #b03911;
#TrivialReporter .runner { border: 1px solid gray; display: block; margin: 5px 0; padding: 2px 0 2px 10px; } content: "x";
  font-weight: bold;
  margin-left: -1px;
  }
   
  #HTMLReporter .symbolSummary li.skipped {
  font-size: 14px;
  }
   
  #HTMLReporter .symbolSummary li.skipped:before {
  color: #bababa;
  content: "\02022";
  }
   
  #HTMLReporter .symbolSummary li.pending {
  line-height: 11px;
  }
   
  #HTMLReporter .symbolSummary li.pending:before {
  color: #aaaaaa;
  content: "-";
  }
   
  #HTMLReporter .bar {
  line-height: 28px;
  font-size: 14px;
  display: block;
  color: #eee;
  }
   
  #HTMLReporter .runningAlert {
  background-color: #666666;
  }
   
  #HTMLReporter .skippedAlert {
  background-color: #aaaaaa;
  }
   
  #HTMLReporter .skippedAlert:first-child {
  background-color: #333333;
  }
   
  #HTMLReporter .skippedAlert:hover {
  text-decoration: none;
  color: white;
  text-decoration: underline;
  }
   
  #HTMLReporter .passingAlert {
  background-color: #a6b779;
  }
   
  #HTMLReporter .passingAlert:first-child {
  background-color: #5e7d00;
  }
   
  #HTMLReporter .failingAlert {
  background-color: #cf867e;
  }
   
  #HTMLReporter .failingAlert:first-child {
  background-color: #b03911;
  }
   
  #HTMLReporter .results {
  margin-top: 14px;
  }
   
  #HTMLReporter #details {
  display: none;
  }
   
  #HTMLReporter .resultsMenu, #HTMLReporter .resultsMenu a {
  background-color: #fff;
  color: #333333;
  }
   
  #HTMLReporter.showDetails .summaryMenuItem {
  font-weight: normal;
  text-decoration: inherit;
  }
   
  #HTMLReporter.showDetails .summaryMenuItem:hover {
  text-decoration: underline;
  }
   
  #HTMLReporter.showDetails .detailsMenuItem {
  font-weight: bold;
  text-decoration: underline;
  }
   
  #HTMLReporter.showDetails .summary {
  display: none;
  }
   
  #HTMLReporter.showDetails #details {
  display: block;
  }
   
  #HTMLReporter .summaryMenuItem {
  font-weight: bold;
  text-decoration: underline;
  }
   
  #HTMLReporter .summary {
  margin-top: 14px;
  }
   
  #HTMLReporter .summary .suite .suite, #HTMLReporter .summary .specSummary {
  margin-left: 14px;
  }
   
  #HTMLReporter .summary .specSummary.passed a {
  color: #5e7d00;
  }
   
  #HTMLReporter .summary .specSummary.failed a {
  color: #b03911;
  }
   
  #HTMLReporter .description + .suite {
  margin-top: 0;
  }
   
  #HTMLReporter .suite {
  margin-top: 14px;
  }
   
  #HTMLReporter .suite a {
  color: #333333;
  }
   
  #HTMLReporter #details .specDetail {
  margin-bottom: 28px;
  }
   
  #HTMLReporter #details .specDetail .description {
  display: block;
  color: white;
  background-color: #b03911;
  }
   
  #HTMLReporter .resultMessage {
  padding-top: 14px;
  color: #333333;
  }
   
  #HTMLReporter .resultMessage span.result {
  display: block;
  }
   
  #HTMLReporter .stackTrace {
  margin: 5px 0 0 0;
  max-height: 224px;
  overflow: auto;
  line-height: 18px;
  color: #666666;
  border: 1px solid #ddd;
  background: white;
  white-space: pre;
  }
   
  #TrivialReporter {
  padding: 8px 13px;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  overflow-y: scroll;
  background-color: white;
  font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif; /*.resultMessage {*/
  /*white-space: pre;*/
  /*}*/
  }
   
  #TrivialReporter a:visited, #TrivialReporter a {
  color: #303;
  }
   
  #TrivialReporter a:hover, #TrivialReporter a:active {
  color: blue;
  }
   
  #TrivialReporter .run_spec {
  float: right;
  padding-right: 5px;
  font-size: .8em;
  text-decoration: none;
  }
   
  #TrivialReporter .banner {
  color: #303;
  background-color: #fef;
  padding: 5px;
  }
   
  #TrivialReporter .logo {
  float: left;
  font-size: 1.1em;
  padding-left: 5px;
  }
   
  #TrivialReporter .logo .version {
  font-size: .6em;
  padding-left: 1em;
  }
   
  #TrivialReporter .runner.running {
  background-color: yellow;
  }
   
  #TrivialReporter .options {
  text-align: right;
  font-size: .8em;
  }
   
  #TrivialReporter .suite {
  border: 1px outset gray;
  margin: 5px 0;
  padding-left: 1em;
  }
   
  #TrivialReporter .suite .suite {
  margin: 5px;
  }
   
  #TrivialReporter .suite.passed {
  background-color: #dfd;
  }
   
  #TrivialReporter .suite.failed {
  background-color: #fdd;
  }
   
  #TrivialReporter .spec {
  margin: 5px;
  padding-left: 1em;
  clear: both;
  }
   
  #TrivialReporter .spec.failed, #TrivialReporter .spec.passed, #TrivialReporter .spec.skipped {
  padding-bottom: 5px;
  border: 1px solid gray;
  }
   
  #TrivialReporter .spec.failed {
  background-color: #fbb;
  border-color: red;
  }
   
  #TrivialReporter .spec.passed {
  background-color: #bfb;
  border-color: green;
  }
   
  #TrivialReporter .spec.skipped {
  background-color: #bbb;
  }
   
  #TrivialReporter .messages {
  border-left: 1px dashed gray;
  padding-left: 1em;
  padding-right: 1em;
  }
   
  #TrivialReporter .passed {
  background-color: #cfc;
  display: none;
  }
   
  #TrivialReporter .failed {
  background-color: #fbb;
  }
   
  #TrivialReporter .skipped {
  color: #777;
  background-color: #eee;
  display: none;
  }
   
  #TrivialReporter .resultMessage span.result {
  display: block;
  line-height: 2em;
  color: black;
  }
   
  #TrivialReporter .resultMessage .mismatch {
  color: black;
  }
   
  #TrivialReporter .stackTrace {
  white-space: pre;
  font-size: .8em;
  margin-left: 10px;
  max-height: 5em;
  overflow: auto;
  border: 1px inset red;
  padding: 1em;
  background: #eef;
  }
   
  #TrivialReporter .finished-at {
  padding-left: 1em;
  font-size: .6em;
  }
   
  #TrivialReporter.show-passed .passed, #TrivialReporter.show-skipped .skipped {
  display: block;
  }
   
  #TrivialReporter #jasmine_content {
  position: fixed;
  right: 100%;
  }
   
  #TrivialReporter .runner {
  border: 1px solid gray;
  display: block;
  margin: 5px 0;
  padding: 2px 0 2px 10px;
  }
   
var isCommonJS = typeof window == "undefined"; 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; if (isCommonJS) exports.jasmine = jasmine;
/** /**
* @private * @private
*/ */
jasmine.unimplementedMethod_ = function() { jasmine.unimplementedMethod_ = function () {
throw new Error("unimplemented method"); throw new Error("unimplemented method");
}; };
   
/** /**
* Use <code>jasmine.undefined</code> instead of <code>undefined</code>, since <code>undefined</code> is just * Use <code>jasmine.undefined</code> instead of <code>undefined</code>, since <code>undefined</code> is just
* a plain old variable and may be redefined by somebody else. * a plain old variable and may be redefined by somebody else.
* *
* @private * @private
*/ */
jasmine.undefined = jasmine.___undefined___; jasmine.undefined = jasmine.___undefined___;
   
/** /**
* Show diagnostic messages in the console if set to true * Show diagnostic messages in the console if set to true
* *
*/ */
jasmine.VERBOSE = false; 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. * 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; jasmine.DEFAULT_UPDATE_INTERVAL = 250;
   
/** /**
* Default timeout interval in milliseconds for waitsFor() blocks. * Default timeout interval in milliseconds for waitsFor() blocks.
*/ */
jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000; jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000;
   
jasmine.getGlobal = function() { jasmine.getGlobal = function () {
function getGlobal() { function getGlobal() {
return this; return this;
} }
   
return getGlobal(); return getGlobal();
}; };
   
/** /**
* Allows for bound functions to be compared. Internal use only. * Allows for bound functions to be compared. Internal use only.
* *
* @ignore * @ignore
* @private * @private
* @param base {Object} bound 'this' for the function * @param base {Object} bound 'this' for the function
* @param name {Function} function to find * @param name {Function} function to find
*/ */
jasmine.bindOriginal_ = function(base, name) { jasmine.bindOriginal_ = function (base, name) {
var original = base[name]; var original = base[name];
if (original.apply) { if (original.apply) {
return function() { return function () {
return original.apply(base, arguments); return original.apply(base, arguments);
}; };
} else { } else {
// IE support // IE support
return jasmine.getGlobal()[name]; return jasmine.getGlobal()[name];
} }
}; };
   
jasmine.setTimeout = jasmine.bindOriginal_(jasmine.getGlobal(), 'setTimeout'); jasmine.setTimeout = jasmine.bindOriginal_(jasmine.getGlobal(), 'setTimeout');
jasmine.clearTimeout = jasmine.bindOriginal_(jasmine.getGlobal(), 'clearTimeout'); jasmine.clearTimeout = jasmine.bindOriginal_(jasmine.getGlobal(), 'clearTimeout');
jasmine.setInterval = jasmine.bindOriginal_(jasmine.getGlobal(), 'setInterval'); jasmine.setInterval = jasmine.bindOriginal_(jasmine.getGlobal(), 'setInterval');
jasmine.clearInterval = jasmine.bindOriginal_(jasmine.getGlobal(), 'clearInterval'); jasmine.clearInterval = jasmine.bindOriginal_(jasmine.getGlobal(), 'clearInterval');
   
jasmine.MessageResult = function(values) { jasmine.MessageResult = function (values) {
this.type = 'log'; this.type = 'log';
this.values = values; this.values = values;
this.trace = new Error(); // todo: test better this.trace = new Error(); // todo: test better
}; };
   
jasmine.MessageResult.prototype.toString = function() { jasmine.MessageResult.prototype.toString = function () {
var text = ""; var text = "";
for (var i = 0; i < this.values.length; i++) { for (var i = 0; i < this.values.length; i++) {
if (i > 0) text += " "; if (i > 0) text += " ";
if (jasmine.isString_(this.values[i])) { if (jasmine.isString_(this.values[i])) {
text += this.values[i]; text += this.values[i];
} else { } else {
text += jasmine.pp(this.values[i]); text += jasmine.pp(this.values[i]);
} }
} }
return text; return text;
}; };
   
jasmine.ExpectationResult = function(params) { jasmine.ExpectationResult = function (params) {
this.type = 'expect'; this.type = 'expect';
this.matcherName = params.matcherName; this.matcherName = params.matcherName;
this.passed_ = params.passed; this.passed_ = params.passed;
this.expected = params.expected; this.expected = params.expected;
this.actual = params.actual; this.actual = params.actual;
this.message = this.passed_ ? 'Passed.' : params.message; this.message = this.passed_ ? 'Passed.' : params.message;
   
var trace = (params.trace || new Error(this.message)); var trace = (params.trace || new Error(this.message));
this.trace = this.passed_ ? '' : trace; this.trace = this.passed_ ? '' : trace;
}; };
   
jasmine.ExpectationResult.prototype.toString = function () { jasmine.ExpectationResult.prototype.toString = function () {
return this.message; return this.message;
}; };
   
jasmine.ExpectationResult.prototype.passed = function () { jasmine.ExpectationResult.prototype.passed = function () {
return this.passed_; return this.passed_;
}; };
   
/** /**
* 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(); var env = jasmine.currentEnv_ = jasmine.currentEnv_ || new jasmine.Env();
return env; return env;
}; };
   
/** /**
* @ignore * @ignore
* @private * @private
* @param value * @param value
* @returns {Boolean} * @returns {Boolean}
*/ */
jasmine.isArray_ = function(value) { jasmine.isArray_ = function (value) {
return jasmine.isA_("Array", value); return jasmine.isA_("Array", value);
}; };
   
/** /**
* @ignore * @ignore
* @private * @private
* @param value * @param value
* @returns {Boolean} * @returns {Boolean}
*/ */
jasmine.isString_ = function(value) { jasmine.isString_ = function (value) {
return jasmine.isA_("String", value); return jasmine.isA_("String", value);
}; };
   
/** /**
* @ignore * @ignore
* @private * @private
* @param value * @param value
* @returns {Boolean} * @returns {Boolean}
*/ */
jasmine.isNumber_ = function(value) { jasmine.isNumber_ = function (value) {
return jasmine.isA_("Number", value); return jasmine.isA_("Number", value);
}; };
   
/** /**
* @ignore * @ignore
* @private * @private
* @param {String} typeName * @param {String} typeName
* @param value * @param value
* @returns {Boolean} * @returns {Boolean}
*/ */
jasmine.isA_ = function(typeName, value) { jasmine.isA_ = function (typeName, value) {
return Object.prototype.toString.apply(value) === '[object ' + typeName + ']'; return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
}; };
   
/** /**
* Pretty printer for expecations. Takes any object and turns it into a human-readable string. * Pretty printer for expecations. Takes any object and turns it into a human-readable string.
* *
* @param value {Object} an object to be outputted * @param value {Object} an object to be outputted
* @returns {String} * @returns {String}
*/ */
jasmine.pp = function(value) { jasmine.pp = function (value) {
var stringPrettyPrinter = new jasmine.StringPrettyPrinter(); var stringPrettyPrinter = new jasmine.StringPrettyPrinter();
stringPrettyPrinter.format(value); stringPrettyPrinter.format(value);
return stringPrettyPrinter.string; return stringPrettyPrinter.string;
}; };
   
/** /**
* Returns true if the object is a DOM Node. * Returns true if the object is a DOM Node.
* *
* @param {Object} obj object to check * @param {Object} obj object to check
* @returns {Boolean} * @returns {Boolean}
*/ */
jasmine.isDomNode = function(obj) { jasmine.isDomNode = function (obj) {
return obj.nodeType > 0; return obj.nodeType > 0;
}; };
   
/** /**
* Returns a matchable 'generic' object of the class type. For use in expecations of type when values don't matter. * Returns a matchable 'generic' object of the class type. For use in expecations of type when values don't matter.
* *
* @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).toHaveBeenCalledWith(jasmine.any(Function));
* *
* @param {Class} clazz * @param {Class} clazz
* @returns matchable object of the type clazz * @returns matchable object of the type clazz
*/ */
jasmine.any = function(clazz) { 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 * 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. * attributes on the object.
* *
* @example * @example
* // don't care about any other attributes than foo. * // don't care about any other attributes than foo.
* expect(mySpy).toHaveBeenCalledWith(jasmine.objectContaining({foo: "bar"}); * expect(mySpy).toHaveBeenCalledWith(jasmine.objectContaining({foo: "bar"});
* *
* @param sample {Object} sample * @param sample {Object} sample
* @returns matchable object for the sample * @returns matchable object for the sample
*/ */
jasmine.objectContaining = function (sample) { jasmine.objectContaining = function (sample) {
return new jasmine.Matchers.ObjectContaining(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 fields: 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
* *
* // spy example * // spy example
* var foo = { * var foo = {
* not: function(bool) { return !bool; } * not: function(bool) { return !bool; }
* } * }
* *
* // actual foo.not will not be called, execution stops * // actual foo.not will not be called, execution stops
* spyOn(foo, 'not'); * spyOn(foo, 'not');
   
// foo.not spied upon, execution will continue to implementation // foo.not spied upon, execution will continue to implementation
* spyOn(foo, 'not').andCallThrough(); * spyOn(foo, 'not').andCallThrough();
* *
* // fake example * // fake example
* var foo = { * var foo = {
* not: function(bool) { return !bool; } * not: function(bool) { return !bool; }
* } * }
* *
* // foo.not(val) will return val * // foo.not(val) will return val
* spyOn(foo, 'not').andCallFake(function(value) {return value;}); * spyOn(foo, 'not').andCallFake(function(value) {return value;});
* *
* // mock example * // mock example
* foo.not(7 == 7); * foo.not(7 == 7);
* expect(foo.not).toHaveBeenCalled(); * expect(foo.not).toHaveBeenCalled();
* expect(foo.not).toHaveBeenCalledWith(true); * expect(foo.not).toHaveBeenCalledWith(true);
* *
* @constructor * @constructor
* @see spyOn, jasmine.createSpy, jasmine.createSpyObj * @see spyOn, jasmine.createSpy, jasmine.createSpyObj
* @param {String} name * @param {String} name
*/ */
jasmine.Spy = function(name) { jasmine.Spy = function (name) {
/** /**
* The name of the spy, if provided. * The name of the spy, if provided.
*/ */
this.identity = name || 'unknown'; this.identity = name || 'unknown';
/** /**
* Is this Object a spy? * Is this Object a spy?
*/ */
this.isSpy = true; this.isSpy = true;
/** /**
* The actual function this spy stubs. * The actual 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
* var mySpy = jasmine.createSpy('foo'); * var mySpy = jasmine.createSpy('foo');
* mySpy(1, 2); * mySpy(1, 2);
* mySpy.mostRecentCall.args = [1, 2]; * mySpy.mostRecentCall.args = [1, 2];
*/ */
this.mostRecentCall = {}; this.mostRecentCall = {};
   
/** /**
* Holds arguments for each call to the spy, indexed by call count * Holds arguments for each call to the spy, indexed by call count
* @example * @example
* var mySpy = jasmine.createSpy('foo'); * var mySpy = jasmine.createSpy('foo');
* mySpy(1, 2); * mySpy(1, 2);
* mySpy(7, 8); * mySpy(7, 8);
* mySpy.mostRecentCall.args = [7, 8]; * mySpy.mostRecentCall.args = [7, 8];
* mySpy.argsForCall[0] = [1, 2]; * mySpy.argsForCall[0] = [1, 2];
* mySpy.argsForCall[1] = [7, 8]; * mySpy.argsForCall[1] = [7, 8];
*/ */
this.argsForCall = []; this.argsForCall = [];
this.calls = []; this.calls = [];
}; };
   
/** /**
* Tells a spy to call through to the actual implemenatation. * Tells a spy to call through to the actual implemenatation.
* *
* @example * @example
* 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();
*/ */
jasmine.Spy.prototype.andCallThrough = function() { jasmine.Spy.prototype.andCallThrough = function () {
this.plan = this.originalValue; this.plan = this.originalValue;
return this; return this;
}; };
   
/** /**
* For setting the return value of a spy. * For setting the return value of a spy.
* *
* @example * @example
* // defining a spy from scratch: foo() returns 'baz' * // defining a spy from scratch: foo() returns 'baz'
* var foo = jasmine.createSpy('spy on foo').andReturn('baz'); * var foo = jasmine.createSpy('spy on foo').andReturn('baz');
* *
* // defining a spy on an existing property: foo.bar() returns 'baz' * // defining a spy on an existing property: foo.bar() returns 'baz'
* spyOn(foo, 'bar').andReturn('baz'); * spyOn(foo, 'bar').andReturn('baz');
* *
* @param {Object} value * @param {Object} value
*/ */
jasmine.Spy.prototype.andReturn = function(value) { jasmine.Spy.prototype.andReturn = function (value) {
this.plan = function() { this.plan = function () {
return value; return value;
}; };
return this; return this;
}; };
   
/** /**
* For throwing an exception when a spy is called. * For throwing an exception when a spy is called.
* *
* @example * @example
* // defining a spy from scratch: foo() throws an exception w/ message 'ouch' * // defining a spy from scratch: foo() throws an exception w/ message 'ouch'
* var foo = jasmine.createSpy('spy on foo').andThrow('baz'); * var foo = jasmine.createSpy('spy on foo').andThrow('baz');
* *
* // defining a spy on an existing property: foo.bar() throws an exception w/ message 'ouch' * // defining a spy on an existing property: foo.bar() throws an exception w/ message 'ouch'
* spyOn(foo, 'bar').andThrow('baz'); * spyOn(foo, 'bar').andThrow('baz');
* *
* @param {String} exceptionMsg * @param {String} exceptionMsg
*/ */
jasmine.Spy.prototype.andThrow = function(exceptionMsg) { jasmine.Spy.prototype.andThrow = function (exceptionMsg) {
this.plan = function() { this.plan = function () {
throw exceptionMsg; throw exceptionMsg;
}; };
return this; return this;
}; };
   
/** /**
* Calls an alternate implementation when a spy is called. * Calls an alternate implementation when a spy is called.
* *
* @example * @example
* var baz = function() { * var baz = function() {
* // do some stuff, return something * // do some stuff, return something
* } * }
* // defining a spy from scratch: foo() calls the function baz * // defining a spy from scratch: foo() calls the function baz
* var foo = jasmine.createSpy('spy on foo').andCall(baz); * var foo = jasmine.createSpy('spy on foo').andCall(baz);
* *
* // defining a spy on an existing property: foo.bar() calls an anonymnous function * // defining a spy on an existing property: foo.bar() calls an anonymnous function
* spyOn(foo, 'bar').andCall(function() { return 'baz';} ); * spyOn(foo, 'bar').andCall(function() { return 'baz';} );
* *
* @param {Function} fakeFunc * @param {Function} fakeFunc
*/ */
jasmine.Spy.prototype.andCallFake = function(fakeFunc) { jasmine.Spy.prototype.andCallFake = function (fakeFunc) {
this.plan = fakeFunc; this.plan = fakeFunc;
return this; return this;
}; };
   
/** /**
* Resets all of a spy's the tracking variables so that it can be used again. * Resets all of a spy's the tracking variables so that it can be used again.
* *
* @example * @example
* spyOn(foo, 'bar'); * spyOn(foo, 'bar');
* *
* foo.bar(); * foo.bar();
* *
* expect(foo.bar.callCount).toEqual(1); * expect(foo.bar.callCount).toEqual(1);
* *
* foo.bar.reset(); * foo.bar.reset();
* *
* expect(foo.bar.callCount).toEqual(0); * expect(foo.bar.callCount).toEqual(0);
*/ */
jasmine.Spy.prototype.reset = function() { jasmine.Spy.prototype.reset = function () {
this.wasCalled = false; this.wasCalled = false;
this.callCount = 0; this.callCount = 0;
this.argsForCall = []; this.argsForCall = [];
this.calls = []; this.calls = [];
this.mostRecentCall = {}; this.mostRecentCall = {};
}; };
   
jasmine.createSpy = function(name) { jasmine.createSpy = function (name) {
   
var spyObj = function() { var spyObj = function () {
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; 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}); 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. * Determines whether an object is a spy.
* *
* @param {jasmine.Spy|Object} putativeSpy * @param {jasmine.Spy|Object} putativeSpy
* @returns {Boolean} * @returns {Boolean}
*/ */
jasmine.isSpy = function(putativeSpy) { jasmine.isSpy = function (putativeSpy) {
return putativeSpy && putativeSpy.isSpy; 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.
* *
* @param {String} baseName name of spy class * @param {String} baseName name of spy class
* @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) { if (!jasmine.isArray_(methodNames) || methodNames.length === 0) {
throw new Error('createSpyObj requires a non-empty array of method names to create spies for'); 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]);
} }
return obj; return obj;
}; };
   
/** /**
* All parameters are pretty-printed and concatenated together, then written to the current spec's output. * All parameters are pretty-printed and concatenated together, then written to the current spec's output.
* *
* Be careful not to leave calls to <code>jasmine.log</code> in production code. * Be careful not to leave calls to <code>jasmine.log</code> in production code.
*/ */
jasmine.log = function() { jasmine.log = function () {
var spec = jasmine.getEnv().currentSpec; var spec = jasmine.getEnv().currentSpec;
spec.log.apply(spec, arguments); spec.log.apply(spec, arguments);
}; };
   
/** /**
* Function that installs a spy on an existing object's method name. Used within a Spec to create a spy. * Function that installs a spy on an existing object's method name. Used within a Spec to create a spy.
* *
* @example * @example
* // spy example * // spy example
* var foo = { * var foo = {
* not: function(bool) { return !bool; } * not: function(bool) { return !bool; }
* } * }
* spyOn(foo, 'not'); // actual foo.not will not be called, execution stops * spyOn(foo, 'not'); // actual foo.not will not be called, execution stops
* *
* @see jasmine.createSpy * @see jasmine.createSpy
* @param obj * @param obj
* @param methodName * @param methodName
* @returns a Jasmine spy that can be chained with all spy methods * @returns a Jasmine spy that can be chained with all spy methods
*/ */
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; 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.
* *
* // TODO: pending tests * // TODO: pending tests
* *
* @example * @example
* it('should be true', function() { * it('should be true', function() {
* expect(true).toEqual(true); * expect(true).toEqual(true);
* }); * });
* *
* @param {String} desc description of this specification * @param {String} desc description of this specification
* @param {Function} func defines the preconditions and expectations of the spec * @param {Function} func defines the preconditions and expectations of the spec
*/ */
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; if (isCommonJS) exports.it = it;
   
/** /**
* Creates a <em>disabled</em> Jasmine spec. * Creates a <em>disabled</em> Jasmine spec.
* *
* A convenience method that allows existing specs to be disabled temporarily during development. * A convenience method that allows existing specs to be disabled temporarily during development.
* *
* @param {String} desc description of this specification * @param {String} desc description of this specification
* @param {Function} func defines the preconditions and expectations of the spec * @param {Function} func defines the preconditions and expectations of the spec
*/ */
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; if (isCommonJS) exports.xit = xit;
   
/** /**
* Starts a chain for a Jasmine expectation. * 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 * It is passed an Object that is the actual value and should chain to one of the many
* jasmine.Matchers functions. * jasmine.Matchers functions.
* *
* @param {Object} actual Actual value to test against and expected value * @param {Object} actual Actual value to test against and expected value
*/ */
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; 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.
* *
* @param {Function} func Function that defines part of a jasmine spec. * @param {Function} func Function that defines part of a jasmine spec.
*/ */
var runs = function(func) { var runs = function (func) {
jasmine.getEnv().currentSpec.runs(func); jasmine.getEnv().currentSpec.runs(func);
}; };
if (isCommonJS) exports.runs = runs; if (isCommonJS) exports.runs = runs;
   
/** /**
* Waits a fixed time period before moving to the next block. * Waits a fixed time period before moving to the next block.
* *
* @deprecated Use waitsFor() instead * @deprecated Use waitsFor() instead
* @param {Number} timeout milliseconds to wait * @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; 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 block.
* *
* @param {Function} latchFunction * @param {Function} latchFunction
* @param {String} optional_timeoutMessage * @param {String} optional_timeoutMessage
* @param {Number} optional_timeout * @param {Number} optional_timeout
*/ */
var waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout) { var waitsFor = function (latchFunction, optional_timeoutMessage, optional_timeout) {
jasmine.getEnv().currentSpec.waitsFor.apply(jasmine.getEnv().currentSpec, arguments); jasmine.getEnv().currentSpec.waitsFor.apply(jasmine.getEnv().currentSpec, arguments);
}; };
if (isCommonJS) exports.waitsFor = waitsFor; 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.
* *
* Used for spec setup, including validating assumptions. * Used for spec setup, including validating assumptions.
* *
* @param {Function} beforeEachFunction * @param {Function} beforeEachFunction
*/ */
var beforeEach = function(beforeEachFunction) { var beforeEach = function (beforeEachFunction) {
jasmine.getEnv().beforeEach(beforeEachFunction); jasmine.getEnv().beforeEach(beforeEachFunction);
}; };
if (isCommonJS) exports.beforeEach = beforeEach; 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.
* *
* Used for restoring any state that is hijacked during spec execution. * Used for restoring any state that is hijacked during spec execution.
* *
* @param {Function} afterEachFunction * @param {Function} afterEachFunction
*/ */
var afterEach = function(afterEachFunction) { var afterEach = function (afterEachFunction) {
jasmine.getEnv().afterEach(afterEachFunction); jasmine.getEnv().afterEach(afterEachFunction);
}; };
if (isCommonJS) exports.afterEach = afterEach; if (isCommonJS) exports.afterEach = afterEach;
   
/** /**
* Defines a suite of specifications. * Defines a suite of specifications.
* *
* Stores the description and all defined specs in the Jasmine environment as one suite of specs. Variables declared * 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 * are accessible by calls to beforeEach, it, and afterEach. Describe blocks can be nested, allowing for specialization
* of setup in some tests. * of setup in some tests.
* *
* @example * @example
* // TODO: a simple suite * // TODO: a simple suite
* *
* // TODO: a simple suite with a nested describe block * // TODO: a simple suite with a nested describe block
* *
* @param {String} description A string, usually the class under test. * @param {String} description A string, usually the class under test.
* @param {Function} specDefinitions function that defines several specs. * @param {Function} specDefinitions function that defines several specs.
*/ */
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; 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.
* *
* @param {String} description A string, usually the class under test. * @param {String} description A string, usually the class under test.
* @param {Function} specDefinitions function that defines several specs. * @param {Function} specDefinitions function that defines several specs.
*/ */
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; if (isCommonJS) exports.xdescribe = xdescribe;
   
   
// 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() { jasmine.XmlHttpRequest = (typeof XMLHttpRequest == "undefined") ? function () {
function tryIt(f) { function tryIt(f) {
try { try {
return f(); return f();
} catch(e) { } catch (e) {
} }
return null; return null;
} }
   
var xhr = tryIt(function() { var xhr = tryIt(function () {
return new ActiveXObject("Msxml2.XMLHTTP.6.0"); return new ActiveXObject("Msxml2.XMLHTTP.6.0");
}) ||  
tryIt(function() {  
return new ActiveXObject("Msxml2.XMLHTTP.3.0");  
}) || }) ||
tryIt(function() { tryIt(function () {
return new ActiveXObject("Msxml2.XMLHTTP"); return new ActiveXObject("Msxml2.XMLHTTP.3.0");
}) || }) ||
tryIt(function() { tryIt(function () {
return new ActiveXObject("Microsoft.XMLHTTP"); return new ActiveXObject("Msxml2.XMLHTTP");
}); }) ||
  tryIt(function () {
if (!xhr) throw new Error("This browser does not support XMLHttpRequest."); return new ActiveXObject("Microsoft.XMLHTTP");
  });
return xhr;  
  if (!xhr) throw new Error("This browser does not support XMLHttpRequest.");
   
  return xhr;
} : XMLHttpRequest; } : XMLHttpRequest;
/** /**
* @namespace * @namespace
*/ */
jasmine.util = {}; jasmine.util = {};
   
/** /**
* Declare that a child class inherit it's prototype from the parent class. * Declare that a child class inherit 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 * @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) {
var lineNumber; var lineNumber;
if (e.line) { if (e.line) {
lineNumber = e.line; lineNumber = e.line;
} }
else if (e.lineNumber) { else if (e.lineNumber) {
lineNumber = e.lineNumber; lineNumber = e.lineNumber;
} }
   
var file; var file;
   
if (e.sourceURL) { if (e.sourceURL) {
file = e.sourceURL; file = e.sourceURL;
} }
else if (e.fileName) { else if (e.fileName) {
file = e.fileName; file = e.fileName;
} }
   
var message = (e.name && e.message) ? (e.name + ': ' + e.message) : e.toString(); var message = (e.name && e.message) ? (e.name + ': ' + e.message) : e.toString();
   
if (file && lineNumber) { if (file && lineNumber) {
message += ' in ' + file + ' (line ' + lineNumber + ')'; message += ' in ' + file + ' (line ' + lineNumber + ')';
} }
   
return message; return message;
}; };
   
jasmine.util.htmlEscape = function(str) { jasmine.util.htmlEscape = function (str) {
if (!str) return str; if (!str) return str;
return str.replace(/&/g, '&amp;') return str.replace(/&/g, '&amp;')
.replace(/</g, '&lt;') .replace(/</g, '&lt;')
.replace(/>/g, '&gt;'); .replace(/>/g, '&gt;');
}; };
   
jasmine.util.argsToArray = function(args) { jasmine.util.argsToArray = function (args) {
var arrayOfArgs = []; var arrayOfArgs = [];
for (var i = 0; i < args.length; i++) arrayOfArgs.push(args[i]); for (var i = 0; i < args.length; i++) arrayOfArgs.push(args[i]);
return arrayOfArgs; return arrayOfArgs;
}; };
   
jasmine.util.extend = function(destination, source) { jasmine.util.extend = function (destination, source) {
for (var property in source) destination[property] = source[property]; for (var property in source) destination[property] = source[property];
return destination; return destination;
}; };
   
/** /**
* Environment for Jasmine * Environment for Jasmine
* *
* @constructor * @constructor
*/ */
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.reporter = new jasmine.MultiReporter(); this.reporter = new jasmine.MultiReporter();
   
this.updateInterval = jasmine.DEFAULT_UPDATE_INTERVAL; this.updateInterval = jasmine.DEFAULT_UPDATE_INTERVAL;
this.defaultTimeoutInterval = jasmine.DEFAULT_TIMEOUT_INTERVAL; this.defaultTimeoutInterval = jasmine.DEFAULT_TIMEOUT_INTERVAL;
this.lastUpdate = 0; this.lastUpdate = 0;
this.specFilter = function() { this.specFilter = function () {
return true; return true;
}; };
   
this.nextSpecId_ = 0; this.nextSpecId_ = 0;
this.nextSuiteId_ = 0; this.nextSuiteId_ = 0;
this.equalityTesters_ = []; this.equalityTesters_ = [];
   
// wrap matchers // wrap matchers
this.matchersClass = function() { this.matchersClass = function () {
jasmine.Matchers.apply(this, arguments); jasmine.Matchers.apply(this, arguments);
}; };
jasmine.util.inherit(this.matchersClass, jasmine.Matchers); jasmine.util.inherit(this.matchersClass, jasmine.Matchers);
   
jasmine.Matchers.wrapInto_(jasmine.Matchers.prototype, this.matchersClass); jasmine.Matchers.wrapInto_(jasmine.Matchers.prototype, this.matchersClass);
}; };
   
   
jasmine.Env.prototype.setTimeout = jasmine.setTimeout; jasmine.Env.prototype.setTimeout = jasmine.setTimeout;
jasmine.Env.prototype.clearTimeout = jasmine.clearTimeout; 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. * @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_;
} else { } else {
throw new Error('Version not set'); throw new Error('Version not set');
} }
}; };
   
/** /**
* @returns string containing jasmine version build info, if set. * @returns string containing jasmine version build info, if set.
*/ */
jasmine.Env.prototype.versionString = function() { jasmine.Env.prototype.versionString = function () {
if (!jasmine.version_) { if (!jasmine.version_) {
return "version unknown"; return "version unknown";
} }
   
var version = this.version(); var version = this.version();
var versionString = version.major + "." + version.minor + "." + version.build; var versionString = version.major + "." + version.minor + "." + version.build;
if (version.release_candidate) { if (version.release_candidate) {
versionString += ".rc" + version.release_candidate; versionString += ".rc" + version.release_candidate;
} }
versionString += " revision " + version.revision; versionString += " revision " + version.revision;
return versionString; return versionString;
}; };
   
/** /**
* @returns a sequential integer starting at 0 * @returns a sequential integer starting at 0
*/ */
jasmine.Env.prototype.nextSpecId = function () { jasmine.Env.prototype.nextSpecId = function () {
return this.nextSpecId_++; return this.nextSpecId_++;
}; };
   
/** /**
* @returns a sequential integer starting at 0 * @returns a sequential integer starting at 0
*/ */
jasmine.Env.prototype.nextSuiteId = function () { jasmine.Env.prototype.nextSuiteId = function () {
return this.nextSuiteId_++; 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.
*/ */
jasmine.Env.prototype.addReporter = function(reporter) { jasmine.Env.prototype.addReporter = function (reporter) {
this.reporter.addReporter(reporter); this.reporter.addReporter(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) {
var suite = new jasmine.Suite(this, description, specDefinitions, this.currentSuite); var suite = new jasmine.Suite(this, description, specDefinitions, this.currentSuite);
   
var parentSuite = this.currentSuite; var parentSuite = this.currentSuite;
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; var declarationError = null;
try { try {
specDefinitions.call(suite); specDefinitions.call(suite);
} catch(e) { } catch (e) {
declarationError = e; declarationError = e;
} }
   
if (declarationError) { if (declarationError) {
this.it("encountered a declaration exception", function() { this.it("encountered a declaration exception", function () {
throw declarationError; throw declarationError;
}); });
} }
   
this.currentSuite = parentSuite; this.currentSuite = parentSuite;
   
return suite; return suite;
}; };
   
jasmine.Env.prototype.beforeEach = function(beforeEachFunction) { jasmine.Env.prototype.beforeEach = function (beforeEachFunction) {
if (this.currentSuite) { if (this.currentSuite) {
this.currentSuite.beforeEach(beforeEachFunction); this.currentSuite.beforeEach(beforeEachFunction);
} else { } else {
this.currentRunner_.beforeEach(beforeEachFunction); this.currentRunner_.beforeEach(beforeEachFunction);
} }
}; };
   
jasmine.Env.prototype.currentRunner = function () { jasmine.Env.prototype.currentRunner = function () {
return this.currentRunner_; return this.currentRunner_;
}; };
   
jasmine.Env.prototype.afterEach = function(afterEachFunction) { jasmine.Env.prototype.afterEach = function (afterEachFunction) {
if (this.currentSuite) { if (this.currentSuite) {
this.currentSuite.afterEach(afterEachFunction); this.currentSuite.afterEach(afterEachFunction);
} else { } else {
this.currentRunner_.afterEach(afterEachFunction); this.currentRunner_.afterEach(afterEachFunction);
} }
   
}; };
   
jasmine.Env.prototype.xdescribe = function(desc, specDefinitions) { jasmine.Env.prototype.xdescribe = function (desc, specDefinitions) {
return { return {
execute: function() { execute: function () {
} }
}; };
}; };
   
jasmine.Env.prototype.it = function(description, func) { jasmine.Env.prototype.it = function (description, func) {
var spec = new jasmine.Spec(this, this.currentSuite, description); var spec = new jasmine.Spec(this, this.currentSuite, description);
this.currentSuite.add(spec); this.currentSuite.add(spec);
this.currentSpec = spec; this.currentSpec = spec;
   
if (func) { if (func) {
spec.runs(func); spec.runs(func);
} }
   
return spec; return spec;
}; };
   
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 () {
} }
}; };
}; };
   
jasmine.Env.prototype.compareObjects_ = function(a, b, mismatchKeys, mismatchValues) { jasmine.Env.prototype.compareObjects_ = function (a, b, mismatchKeys, mismatchValues) {
if (a.__Jasmine_been_here_before__ === b && b.__Jasmine_been_here_before__ === a) { if (a.__Jasmine_been_here_before__ === b && b.__Jasmine_been_here_before__ === a) {
return true; return true;
} }
   
a.__Jasmine_been_here_before__ = b; a.__Jasmine_been_here_before__ = b;
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] !== jasmine.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 actual.");
} }
} }
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("expected 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 '" + (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.");
} }
} }
   
if (jasmine.isArray_(a) && jasmine.isArray_(b) && a.length != b.length) { if (jasmine.isArray_(a) && jasmine.isArray_(b) && a.length != b.length) {
mismatchValues.push("arrays were not the same length"); mismatchValues.push("arrays were not the same length");
} }
   
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++) { for (var i = 0; i < this.equalityTesters_.length; i++) {
var equalityTester = this.equalityTesters_[i]; var equalityTester = this.equalityTesters_[i];
var result = equalityTester(a, b, this, mismatchKeys, mismatchValues); var result = equalityTester(a, b, this, mismatchKeys, mismatchValues);
if (result !== jasmine.undefined) return result; 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 === jasmine.undefined || a === null || b === jasmine.undefined || b === null) {
return (a == jasmine.undefined && b == jasmine.undefined); return (a == jasmine.undefined && b == jasmine.undefined);
} }
   
if (jasmine.isDomNode(a) && jasmine.isDomNode(b)) { if (jasmine.isDomNode(a) && jasmine.isDomNode(b)) {
return a === b; return a === b;
} }
   
if (a instanceof Date && b instanceof Date) { if (a instanceof Date && b instanceof Date) {
return a.getTime() == b.getTime(); return a.getTime() == b.getTime();
} }
   
if (a.jasmineMatches) { if (a.jasmineMatches) {
return a.jasmineMatches(b); return a.jasmineMatches(b);
} }
   
if (b.jasmineMatches) { if (b.jasmineMatches) {
return b.jasmineMatches(a); return b.jasmineMatches(a);
} }
   
if (a instanceof jasmine.Matchers.ObjectContaining) { 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.ObjectContaining) {
return b.matches(a); return b.matches(a);
} }
   
if (jasmine.isString_(a) && jasmine.isString_(b)) { if (jasmine.isString_(a) && jasmine.isString_(b)) {
return (a == b); return (a == b);
} }
   
if (jasmine.isNumber_(a) && jasmine.isNumber_(b)) { if (jasmine.isNumber_(a) && jasmine.isNumber_(b)) {
return (a == 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);
} }
   
//Straight check //Straight check
return (a === b); return (a === b);
}; };
   
jasmine.Env.prototype.contains_ = function(haystack, needle) { jasmine.Env.prototype.contains_ = function (haystack, needle) {
if (jasmine.isArray_(haystack)) { if (jasmine.isArray_(haystack)) {
for (var i = 0; i < haystack.length; i++) { for (var i = 0; i < haystack.length; i++) {
if (this.equals_(haystack[i], needle)) return true; if (this.equals_(haystack[i], needle)) return true;
} }
return false; return false;
} }
return haystack.indexOf(needle) >= 0; return haystack.indexOf(needle) >= 0;
}; };
   
jasmine.Env.prototype.addEqualityTester = function(equalityTester) { jasmine.Env.prototype.addEqualityTester = function (equalityTester) {
this.equalityTesters_.push(equalityTester); this.equalityTesters_.push(equalityTester);
}; };
/** No-op base class for Jasmine reporters. /** No-op base class for Jasmine reporters.
* *
* @constructor * @constructor
*/ */
jasmine.Reporter = function() { jasmine.Reporter = function () {
}; };
   
//noinspection JSUnusedLocalSymbols //noinspection JSUnusedLocalSymbols
jasmine.Reporter.prototype.reportRunnerStarting = function(runner) { jasmine.Reporter.prototype.reportRunnerStarting = function (runner) {
}; };
   
//noinspection JSUnusedLocalSymbols //noinspection JSUnusedLocalSymbols
jasmine.Reporter.prototype.reportRunnerResults = function(runner) { jasmine.Reporter.prototype.reportRunnerResults = function (runner) {
}; };
   
//noinspection JSUnusedLocalSymbols //noinspection JSUnusedLocalSymbols
jasmine.Reporter.prototype.reportSuiteResults = function(suite) { jasmine.Reporter.prototype.reportSuiteResults = function (suite) {
}; };
   
//noinspection JSUnusedLocalSymbols //noinspection JSUnusedLocalSymbols
jasmine.Reporter.prototype.reportSpecStarting = function(spec) { jasmine.Reporter.prototype.reportSpecStarting = function (spec) {
}; };
   
//noinspection JSUnusedLocalSymbols //noinspection JSUnusedLocalSymbols
jasmine.Reporter.prototype.reportSpecResults = function(spec) { jasmine.Reporter.prototype.reportSpecResults = function (spec) {
}; };
   
//noinspection JSUnusedLocalSymbols //noinspection JSUnusedLocalSymbols
jasmine.Reporter.prototype.log = function(str) { jasmine.Reporter.prototype.log = function (str) {
}; };
   
/** /**
* Blocks are functions with executable code that make up a spec. * Blocks are functions with executable code that make up a spec.
* *
* @constructor * @constructor
* @param {jasmine.Env} env * @param {jasmine.Env} env
* @param {Function} func * @param {Function} func
* @param {jasmine.Spec} spec * @param {jasmine.Spec} spec
*/ */
jasmine.Block = function(env, func, spec) { jasmine.Block = function (env, func, spec) {
this.env = env; this.env = env;
this.func = func; this.func = func;
this.spec = spec; this.spec = spec;
}; };
   
jasmine.Block.prototype.execute = function(onComplete) { 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.spec.fail(e);
} }
onComplete(); onComplete();
}; };
/** JavaScript API reporter. /** JavaScript API reporter.
* *
* @constructor * @constructor
*/ */
jasmine.JsApiReporter = function() { jasmine.JsApiReporter = function () {
this.started = false; this.started = false;
this.finished = false; this.finished = false;
this.suites_ = []; this.suites_ = [];
this.results_ = {}; this.results_ = {};
}; };
   
jasmine.JsApiReporter.prototype.reportRunnerStarting = function(runner) { jasmine.JsApiReporter.prototype.reportRunnerStarting = function (runner) {
this.started = true; this.started = true;
var suites = runner.topLevelSuites(); var suites = runner.topLevelSuites();
for (var i = 0; i < suites.length; i++) { for (var i = 0; i < suites.length; i++) {
var suite = suites[i]; var suite = suites[i];
this.suites_.push(this.summarize_(suite)); this.suites_.push(this.summarize_(suite));
} }
}; };
   
jasmine.JsApiReporter.prototype.suites = function() { jasmine.JsApiReporter.prototype.suites = function () {
return this.suites_; return this.suites_;
}; };
   
jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) { jasmine.JsApiReporter.prototype.summarize_ = function (suiteOrSpec) {
var isSuite = suiteOrSpec instanceof jasmine.Suite; var isSuite = suiteOrSpec instanceof jasmine.Suite;
var summary = { var summary = {
id: suiteOrSpec.id, id: suiteOrSpec.id,
name: suiteOrSpec.description, name: suiteOrSpec.description,
type: isSuite ? 'suite' : 'spec', type: isSuite ? 'suite' : 'spec',
children: [] children: []
}; };
   
if (isSuite) { if (isSuite) {
var children = suiteOrSpec.children(); var children = suiteOrSpec.children();
for (var i = 0; i < children.length; i++) { for (var i = 0; i < children.length; i++) {
summary.children.push(this.summarize_(children[i])); summary.children.push(this.summarize_(children[i]));
} }
} }
return summary; return summary;
}; };
   
jasmine.JsApiReporter.prototype.results = function() { jasmine.JsApiReporter.prototype.results = function () {
return this.results_; return this.results_;
}; };
   
jasmine.JsApiReporter.prototype.resultsForSpec = function(specId) { jasmine.JsApiReporter.prototype.resultsForSpec = function (specId) {
return this.results_[specId]; return this.results_[specId];
}; };
   
//noinspection JSUnusedLocalSymbols //noinspection JSUnusedLocalSymbols
jasmine.JsApiReporter.prototype.reportRunnerResults = function(runner) { jasmine.JsApiReporter.prototype.reportRunnerResults = function (runner) {
this.finished = true; this.finished = true;
}; };
   
//noinspection JSUnusedLocalSymbols //noinspection JSUnusedLocalSymbols
jasmine.JsApiReporter.prototype.reportSuiteResults = function(suite) { jasmine.JsApiReporter.prototype.reportSuiteResults = function (suite) {
}; };
   
//noinspection JSUnusedLocalSymbols //noinspection JSUnusedLocalSymbols
jasmine.JsApiReporter.prototype.reportSpecResults = function(spec) { jasmine.JsApiReporter.prototype.reportSpecResults = function (spec) {
this.results_[spec.id] = { this.results_[spec.id] = {
messages: spec.results().getItems(), messages: spec.results().getItems(),
result: spec.results().failedCount > 0 ? "failed" : "passed" result: spec.results().failedCount > 0 ? "failed" : "passed"
}; };
}; };
   
//noinspection JSUnusedLocalSymbols //noinspection JSUnusedLocalSymbols
jasmine.JsApiReporter.prototype.log = function(str) { jasmine.JsApiReporter.prototype.log = function (str) {
}; };
   
jasmine.JsApiReporter.prototype.resultsForSpecs = function(specIds){ jasmine.JsApiReporter.prototype.resultsForSpecs = function (specIds) {
var results = {}; var results = {};
for (var i = 0; i < specIds.length; i++) { for (var i = 0; i < specIds.length; i++) {
var specId = specIds[i]; var specId = specIds[i];
results[specId] = this.summarizeResult_(this.results_[specId]); results[specId] = this.summarizeResult_(this.results_[specId]);
} }
return results; return results;
}; };
   
jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){ jasmine.JsApiReporter.prototype.summarizeResult_ = function (result) {
var summaryMessages = []; var summaryMessages = [];
var messagesLength = result.messages.length; var messagesLength = result.messages.length;
for (var messageIndex = 0; messageIndex < messagesLength; messageIndex++) { for (var messageIndex = 0; messageIndex < messagesLength; messageIndex++) {
var resultMessage = result.messages[messageIndex]; var resultMessage = result.messages[messageIndex];
summaryMessages.push({ summaryMessages.push({
text: resultMessage.type == 'log' ? resultMessage.toString() : jasmine.undefined, text: resultMessage.type == 'log' ? resultMessage.toString() : jasmine.undefined,
passed: resultMessage.passed ? resultMessage.passed() : true, passed: resultMessage.passed ? resultMessage.passed() : true,
type: resultMessage.type, type: resultMessage.type,
message: resultMessage.message, message: resultMessage.message,
trace: { trace: {
stack: resultMessage.passed && !resultMessage.passed() ? resultMessage.trace.stack : jasmine.undefined stack: resultMessage.passed && !resultMessage.passed() ? resultMessage.trace.stack : jasmine.undefined
} }
}); });
} }
   
return { return {
result : result.result, result: result.result,
messages : summaryMessages messages: summaryMessages
}; };
}; };
   
/** /**
* @constructor * @constructor
* @param {jasmine.Env} env * @param {jasmine.Env} env
* @param actual * @param actual
* @param {jasmine.Spec} spec * @param {jasmine.Spec} spec
*/ */
jasmine.Matchers = function(env, actual, spec, opt_isNot) { jasmine.Matchers = function (env, actual, spec, opt_isNot) {
this.env = env; this.env = env;
this.actual = actual; this.actual = actual;
this.spec = spec; this.spec = spec;
this.isNot = opt_isNot || false; this.isNot = opt_isNot || false;
this.reportWasCalled_ = false; this.reportWasCalled_ = false;
}; };
   
// todo: @deprecated as of Jasmine 0.11, remove soon [xw] // todo: @deprecated as of Jasmine 0.11, remove soon [xw]
jasmine.Matchers.pp = function(str) { jasmine.Matchers.pp = function (str) {
throw new Error("jasmine.Matchers.pp() is no longer supported, please use jasmine.pp() instead!"); throw new Error("jasmine.Matchers.pp() is no longer supported, please use jasmine.pp() instead!");
}; };
   
// todo: @deprecated Deprecated as of Jasmine 0.10. Rewrite your custom matchers to return true or false. [xw] // todo: @deprecated Deprecated as of Jasmine 0.10. Rewrite your custom matchers to return true or false. [xw]
jasmine.Matchers.prototype.report = function(result, failing_message, details) { jasmine.Matchers.prototype.report = function (result, failing_message, details) {
throw new Error("As of jasmine 0.11, custom matchers must be implemented differently -- please see jasmine docs"); throw new Error("As of jasmine 0.11, custom matchers must be implemented differently -- please see jasmine docs");
}; };
   
jasmine.Matchers.wrapInto_ = function(prototype, matchersClass) { jasmine.Matchers.wrapInto_ = function (prototype, matchersClass) {
for (var methodName in prototype) { for (var methodName in prototype) {
if (methodName == 'report') continue; if (methodName == 'report') continue;
var orig = prototype[methodName]; var orig = prototype[methodName];
matchersClass.prototype[methodName] = jasmine.Matchers.matcherFn_(methodName, orig); matchersClass.prototype[methodName] = jasmine.Matchers.matcherFn_(methodName, orig);
} }
}; };
   
jasmine.Matchers.matcherFn_ = function(matcherName, matcherFunction) { jasmine.Matchers.matcherFn_ = function (matcherName, matcherFunction) {
return function() { return function () {
var matcherArgs = jasmine.util.argsToArray(arguments); var matcherArgs = jasmine.util.argsToArray(arguments);
var result = matcherFunction.apply(this, arguments); var result = matcherFunction.apply(this, arguments);
   
if (this.isNot) { if (this.isNot) {
result = !result; result = !result;
} }
   
if (this.reportWasCalled_) return result; if (this.reportWasCalled_) return result;
   
var message; var message;
if (!result) { if (!result) {
if (this.message) { if (this.message) {
message = this.message.apply(this, arguments); message = this.message.apply(this, arguments);
if (jasmine.isArray_(message)) { if (jasmine.isArray_(message)) {
message = message[this.isNot ? 1 : 0]; message = message[this.isNot ? 1 : 0];
} }
} else { } else {
var englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) { return ' ' + s.toLowerCase(); }); var englishyPredicate = matcherName.replace(/[A-Z]/g, function (s) {
message = "Expected " + jasmine.pp(this.actual) + (this.isNot ? " not " : " ") + englishyPredicate; return ' ' + s.toLowerCase();
if (matcherArgs.length > 0) { });
for (var i = 0; i < matcherArgs.length; i++) { message = "Expected " + jasmine.pp(this.actual) + (this.isNot ? " not " : " ") + englishyPredicate;
if (i > 0) message += ","; if (matcherArgs.length > 0) {
message += " " + jasmine.pp(matcherArgs[i]); for (var i = 0; i < matcherArgs.length; i++) {
} if (i > 0) message += ",";
} message += " " + jasmine.pp(matcherArgs[i]);
message += "."; }
} }
} message += ".";
var expectationResult = new jasmine.ExpectationResult({ }
matcherName: matcherName, }
passed: result, var expectationResult = new jasmine.ExpectationResult({
expected: matcherArgs.length > 1 ? matcherArgs : matcherArgs[0], matcherName: matcherName,
actual: this.actual, passed: result,
message: message expected: matcherArgs.length > 1 ? matcherArgs : matcherArgs[0],
}); actual: this.actual,
this.spec.addMatcherResult(expectationResult); message: message
return jasmine.undefined; });
}; this.spec.addMatcherResult(expectationResult);
}; return jasmine.undefined;
  };
  };
   
   
/** /**
* toBe: compares the actual to the expected using === * toBe: compares the actual to the expected using ===
* @param expected * @param expected
*/ */
jasmine.Matchers.prototype.toBe = function(expected) { jasmine.Matchers.prototype.toBe = function (expected) {
return this.actual === expected; return this.actual === expected;
}; };
   
/** /**
* toNotBe: compares the actual to the expected using !== * toNotBe: compares the actual to the expected using !==
* @param expected * @param expected
* @deprecated as of 1.0. Use not.toBe() instead. * @deprecated as of 1.0. Use not.toBe() instead.
*/ */
jasmine.Matchers.prototype.toNotBe = function(expected) { jasmine.Matchers.prototype.toNotBe = function (expected) {
return this.actual !== expected; return this.actual !== expected;
}; };
   
/** /**
* toEqual: compares the actual to the expected using common sense equality. Handles Objects, Arrays, etc. * toEqual: compares the actual to the expected using common sense equality. Handles Objects, Arrays, etc.
* *
* @param expected * @param expected
*/ */
jasmine.Matchers.prototype.toEqual = function(expected) { jasmine.Matchers.prototype.toEqual = function (expected) {
return this.env.equals_(this.actual, expected); return this.env.equals_(this.actual, expected);
}; };
   
/** /**
* toNotEqual: compares the actual to the expected using the ! of jasmine.Matchers.toEqual * toNotEqual: compares the actual to the expected using the ! of jasmine.Matchers.toEqual
* @param expected * @param expected
* @deprecated as of 1.0. Use not.toEqual() instead. * @deprecated as of 1.0. Use not.toEqual() instead.
*/ */
jasmine.Matchers.prototype.toNotEqual = function(expected) { jasmine.Matchers.prototype.toNotEqual = function (expected) {
return !this.env.equals_(this.actual, expected); return !this.env.equals_(this.actual, expected);
}; };
   
/** /**
* Matcher that compares the actual to the expected using a regular expression. Constructs a RegExp, so takes * Matcher that compares the actual to the expected using a regular expression. Constructs a RegExp, so takes
* a pattern or a String. * a pattern or a String.
* *
* @param expected * @param expected
*/ */
jasmine.Matchers.prototype.toMatch = function(expected) { jasmine.Matchers.prototype.toMatch = function (expected) {
return new RegExp(expected).test(this.actual); return new RegExp(expected).test(this.actual);
}; };
   
/** /**
* Matcher that compares the actual to the expected using the boolean inverse of jasmine.Matchers.toMatch * Matcher that compares the actual to the expected using the boolean inverse of jasmine.Matchers.toMatch
* @param expected * @param expected
* @deprecated as of 1.0. Use not.toMatch() instead. * @deprecated as of 1.0. Use not.toMatch() instead.
*/ */
jasmine.Matchers.prototype.toNotMatch = function(expected) { jasmine.Matchers.prototype.toNotMatch = function (expected) {
return !(new RegExp(expected).test(this.actual)); return !(new RegExp(expected).test(this.actual));
}; };
   
/** /**
* Matcher that compares the actual to jasmine.undefined. * Matcher that compares the actual to jasmine.undefined.
*/ */
jasmine.Matchers.prototype.toBeDefined = function() { jasmine.Matchers.prototype.toBeDefined = function () {
return (this.actual !== jasmine.undefined); return (this.actual !== jasmine.undefined);
}; };
   
/** /**
* Matcher that compares the actual to jasmine.undefined. * Matcher that compares the actual to jasmine.undefined.
*/ */
jasmine.Matchers.prototype.toBeUndefined = function() { jasmine.Matchers.prototype.toBeUndefined = function () {
return (this.actual === jasmine.undefined); return (this.actual === jasmine.undefined);
}; };
   
/** /**
* Matcher that compares the actual to null. * Matcher that compares the actual to null.
*/ */
jasmine.Matchers.prototype.toBeNull = function() { jasmine.Matchers.prototype.toBeNull = function () {
return (this.actual === null); return (this.actual === null);
}; };
   
/** /**
* Matcher that boolean not-nots the actual. * Matcher that boolean not-nots the actual.
*/ */
jasmine.Matchers.prototype.toBeTruthy = function() { jasmine.Matchers.prototype.toBeTruthy = function () {
return !!this.actual; return !!this.actual;
}; };
   
   
/** /**
* Matcher that boolean nots the actual. * Matcher that boolean nots the actual.
*/ */
jasmine.Matchers.prototype.toBeFalsy = function() { jasmine.Matchers.prototype.toBeFalsy = function () {
return !this.actual; return !this.actual;
}; };
   
   
/** /**
* Matcher that checks to see if the actual, a Jasmine spy, was called. * Matcher that checks to see if the actual, a Jasmine spy, was called.
*/ */
jasmine.Matchers.prototype.toHaveBeenCalled = function() { jasmine.Matchers.prototype.toHaveBeenCalled = function () {
if (arguments.length > 0) { if (arguments.length > 0) {
throw new Error('toHaveBeenCalled does not take arguments, use toHaveBeenCalledWith'); throw new Error('toHaveBeenCalled does not take arguments, use toHaveBeenCalledWith');
} }
   
if (!jasmine.isSpy(this.actual)) { if (!jasmine.isSpy(this.actual)) {
throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.'); throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
} }
   
this.message = function() { this.message = function () {
return [ return [
"Expected spy " + this.actual.identity + " to have been called.", "Expected spy " + this.actual.identity + " to have been called.",
"Expected spy " + this.actual.identity + " not to have been called." "Expected spy " + this.actual.identity + " not to have been called."
]; ];
}; };
   
return this.actual.wasCalled; return this.actual.wasCalled;
}; };
   
/** @deprecated Use expect(xxx).toHaveBeenCalled() instead */ /** @deprecated Use expect(xxx).toHaveBeenCalled() instead */
jasmine.Matchers.prototype.wasCalled = jasmine.Matchers.prototype.toHaveBeenCalled; jasmine.Matchers.prototype.wasCalled = jasmine.Matchers.prototype.toHaveBeenCalled;
   
/** /**
* Matcher that checks to see if the actual, a Jasmine spy, was not called. * Matcher that checks to see if the actual, a Jasmine spy, was not called.
* *
* @deprecated Use expect(xxx).not.toHaveBeenCalled() instead * @deprecated Use expect(xxx).not.toHaveBeenCalled() instead
*/ */
jasmine.Matchers.prototype.wasNotCalled = function() { jasmine.Matchers.prototype.wasNotCalled = function () {
if (arguments.length > 0) { if (arguments.length > 0) {
throw new Error('wasNotCalled does not take arguments'); throw new Error('wasNotCalled does not take arguments');
} }
   
if (!jasmine.isSpy(this.actual)) { if (!jasmine.isSpy(this.actual)) {
throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.'); throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
} }
   
this.message = function() { this.message = function () {
return [ return [
"Expected spy " + this.actual.identity + " to not have been called.", "Expected spy " + this.actual.identity + " to not have been called.",
"Expected spy " + this.actual.identity + " to have been called." "Expected spy " + this.actual.identity + " to have been called."
]; ];
}; };
   
return !this.actual.wasCalled; return !this.actual.wasCalled;
}; };
   
/** /**
* Matcher that checks to see if the actual, a Jasmine spy, was called with a set of parameters. * Matcher that checks to see if the actual, a Jasmine spy, was called with a set of parameters.
* *
* @example * @example
* *
*/ */
jasmine.Matchers.prototype.toHaveBeenCalledWith = function() { jasmine.Matchers.prototype.toHaveBeenCalledWith = function () {
var expectedArgs = jasmine.util.argsToArray(arguments); var expectedArgs = jasmine.util.argsToArray(arguments);
if (!jasmine.isSpy(this.actual)) { if (!jasmine.isSpy(this.actual)) {
throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.'); throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
} }
this.message = function() { this.message = function () {
if (this.actual.callCount === 0) { if (this.actual.callCount === 0) {
// todo: what should the failure message for .not.toHaveBeenCalledWith() be? is this right? test better. [xw] // todo: what should the failure message for .not.toHaveBeenCalledWith() be? is this right? test better. [xw]
return [ return [
"Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but it was never called.", "Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but it was never called.",
"Expected spy " + this.actual.identity + " not to have been called with " + jasmine.pp(expectedArgs) + " but it was." "Expected spy " + this.actual.identity + " not to have been called with " + jasmine.pp(expectedArgs) + " but it was."
]; ];
} else { } else {
return [ return [
"Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but was called with " + jasmine.pp(this.actual.argsForCall), "Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but was called with " + jasmine.pp(this.actual.argsForCall),
"Expected spy " + this.actual.identity + " not to have been called with " + jasmine.pp(expectedArgs) + " but was called with " + jasmine.pp(this.actual.argsForCall) "Expected spy " + this.actual.identity + " not to have been called with " + jasmine.pp(expectedArgs) + " but was called with " + jasmine.pp(this.actual.argsForCall)
]; ];
} }
}; };
   
return this.env.contains_(this.actual.argsForCall, expectedArgs); return this.env.contains_(this.actual.argsForCall, expectedArgs);
}; };
   
/** @deprecated Use expect(xxx).toHaveBeenCalledWith() instead */ /** @deprecated Use expect(xxx).toHaveBeenCalledWith() instead */
jasmine.Matchers.prototype.wasCalledWith = jasmine.Matchers.prototype.toHaveBeenCalledWith; jasmine.Matchers.prototype.wasCalledWith = jasmine.Matchers.prototype.toHaveBeenCalledWith;
   
/** @deprecated Use expect(xxx).not.toHaveBeenCalledWith() instead */ /** @deprecated Use expect(xxx).not.toHaveBeenCalledWith() instead */
jasmine.Matchers.prototype.wasNotCalledWith = function() { jasmine.Matchers.prototype.wasNotCalledWith = function () {
var expectedArgs = jasmine.util.argsToArray(arguments); var expectedArgs = jasmine.util.argsToArray(arguments);
if (!jasmine.isSpy(this.actual)) { if (!jasmine.isSpy(this.actual)) {
throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.'); throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
} }
   
this.message = function() { this.message = function () {
return [ return [
"Expected spy not to have been called with " + jasmine.pp(expectedArgs) + " but it was", "Expected spy not to have been called with " + jasmine.pp(expectedArgs) + " but it was",
"Expected spy to have been called with " + jasmine.pp(expectedArgs) + " but it was" "Expected spy to have been called with " + jasmine.pp(expectedArgs) + " but it was"
]; ];
}; };
   
return !this.env.contains_(this.actual.argsForCall, expectedArgs); return !this.env.contains_(this.actual.argsForCall, expectedArgs);
}; };
   
/** /**
* Matcher that checks that the expected item is an element in the actual Array. * Matcher that checks that the expected item is an element in the actual Array.
* *
* @param {Object} expected * @param {Object} expected
*/ */
jasmine.Matchers.prototype.toContain = function(expected) { jasmine.Matchers.prototype.toContain = function (expected) {
return this.env.contains_(this.actual, expected); return this.env.contains_(this.actual, expected);
}; };
   
/** /**
* Matcher that checks that the expected item is NOT an element in the actual Array. * Matcher that checks that the expected item is NOT an element in the actual Array.
* *
* @param {Object} expected * @param {Object} expected
* @deprecated as of 1.0. Use not.toContain() instead. * @deprecated as of 1.0. Use not.toContain() instead.
*/ */
jasmine.Matchers.prototype.toNotContain = function(expected) { jasmine.Matchers.prototype.toNotContain = function (expected) {
return !this.env.contains_(this.actual, expected); return !this.env.contains_(this.actual, expected);
}; };
   
jasmine.Matchers.prototype.toBeLessThan = function(expected) { jasmine.Matchers.prototype.toBeLessThan = function (expected) {
return this.actual < expected; return this.actual < expected;
}; };
   
jasmine.Matchers.prototype.toBeGreaterThan = function(expected) { jasmine.Matchers.prototype.toBeGreaterThan = function (expected) {
return this.actual > expected; return this.actual > expected;
}; };
   
/** /**
* Matcher that checks that the expected item is equal to the actual item * Matcher that checks that the expected item is equal to the actual item
* up to a given level of decimal precision (default 2). * up to a given level of decimal precision (default 2).
* *
* @param {Number} expected * @param {Number} expected
* @param {Number} precision * @param {Number} precision
*/ */
jasmine.Matchers.prototype.toBeCloseTo = function(expected, precision) { jasmine.Matchers.prototype.toBeCloseTo = function (expected, precision) {
if (!(precision === 0)) { if (!(precision === 0)) {
precision = precision || 2; precision = precision || 2;
} }
var multiplier = Math.pow(10, precision); var multiplier = Math.pow(10, precision);
var actual = Math.round(this.actual * multiplier); var actual = Math.round(this.actual * multiplier);
expected = Math.round(expected * multiplier); expected = Math.round(expected * multiplier);
return expected == actual; return expected == actual;
}; };
   
/** /**
* Matcher that checks that the expected exception was thrown by the actual. * Matcher that checks that the expected exception was thrown by the actual.
* *
* @param {String} expected * @param {String} expected
*/ */
jasmine.Matchers.prototype.toThrow = function(expected) { jasmine.Matchers.prototype.toThrow = function (expected) {
var result = false; var result = false;
var exception; var exception;
if (typeof this.actual != 'function') { if (typeof this.actual != 'function') {
throw new Error('Actual is not a function'); throw new Error('Actual is not a function');
} }
try { try {
this.actual(); this.actual();
} catch (e) { } catch (e) {
exception = e; exception = e;
} }
if (exception) { if (exception) {
result = (expected === jasmine.undefined || this.env.equals_(exception.message || exception, expected.message || expected)); result = (expected === jasmine.undefined || this.env.equals_(exception.message || exception, expected.message || expected));
} }
   
var not = this.isNot ? "not " : ""; var not = this.isNot ? "not " : "";
   
this.message = function() { this.message = function () {
if (exception && (expected === jasmine.undefined || !this.env.equals_(exception.message || exception, expected.message || expected))) { if (exception && (expected === jasmine.undefined || !this.env.equals_(exception.message || exception, expected.message || expected))) {
return ["Expected function " + not + "to throw", expected ? expected.message || expected : "an exception", ", but it threw", exception.message || exception].join(' '); return ["Expected function " + not + "to throw", expected ? expected.message || expected : "an exception", ", but it threw", exception.message || exception].join(' ');
} else { } else {
return "Expected function to throw an exception."; return "Expected function to throw an exception.";
} }
}; };
   
return result; return result;
}; };
   
jasmine.Matchers.Any = function(expectedClass) { jasmine.Matchers.Any = function (expectedClass) {
this.expectedClass = expectedClass; this.expectedClass = expectedClass;
}; };
   
jasmine.Matchers.Any.prototype.jasmineMatches = function(other) { jasmine.Matchers.Any.prototype.jasmineMatches = function (other) {
if (this.expectedClass == String) { if (this.expectedClass == String) {
return typeof other == 'string' || other instanceof String; return typeof other == 'string' || other instanceof String;
} }
   
if (this.expectedClass == Number) { if (this.expectedClass == Number) {
return typeof other == 'number' || other instanceof Number; return typeof other == 'number' || other instanceof Number;
} }
   
if (this.expectedClass == Function) { if (this.expectedClass == Function) {
return typeof other == 'function' || other instanceof Function; return typeof other == 'function' || other instanceof Function;
} }
   
if (this.expectedClass == Object) { if (this.expectedClass == Object) {
return typeof other == 'object'; return typeof other == 'object';
} }
   
return other instanceof this.expectedClass; return other instanceof this.expectedClass;
}; };
   
jasmine.Matchers.Any.prototype.jasmineToString = function() { jasmine.Matchers.Any.prototype.jasmineToString = function () {
return '<jasmine.any(' + this.expectedClass + ')>'; return '<jasmine.any(' + this.expectedClass + ')>';
}; };
   
jasmine.Matchers.ObjectContaining = function (sample) { jasmine.Matchers.ObjectContaining = function (sample) {
this.sample = sample; this.sample = sample;
}; };
   
jasmine.Matchers.ObjectContaining.prototype.jasmineMatches = function(other, mismatchKeys, mismatchValues) { jasmine.Matchers.ObjectContaining.prototype.jasmineMatches = function (other, mismatchKeys, mismatchValues) {
mismatchKeys = mismatchKeys || []; mismatchKeys = mismatchKeys || [];
mismatchValues = mismatchValues || []; mismatchValues = mismatchValues || [];
   
var env = jasmine.getEnv(); var env = jasmine.getEnv();
   
var hasKey = function(obj, keyName) { var hasKey = function (obj, keyName) {
return obj != null && obj[keyName] !== jasmine.undefined; return obj != null && obj[keyName] !== jasmine.undefined;
}; };
   
for (var property in this.sample) { for (var property in this.sample) {
if (!hasKey(other, property) && hasKey(this.sample, property)) { if (!hasKey(other, property) && hasKey(this.sample, property)) {
mismatchKeys.push("expected has key '" + property + "', but missing from actual."); mismatchKeys.push("expected has key '" + property + "', but missing from actual.");
} }
else if (!env.equals_(this.sample[property], other[property], mismatchKeys, mismatchValues)) { else if (!env.equals_(this.sample[property], other[property], mismatchKeys, mismatchValues)) {
mismatchValues.push("'" + property + "' was '" + (other[property] ? jasmine.util.htmlEscape(other[property].toString()) : other[property]) + "' in expected, but was '" + (this.sample[property] ? jasmine.util.htmlEscape(this.sample[property].toString()) : this.sample[property]) + "' in actual."); mismatchValues.push("'" + property + "' was '" + (other[property] ? jasmine.util.htmlEscape(other[property].toString()) : other[property]) + "' in expected, but was '" + (this.sample[property] ? jasmine.util.htmlEscape(this.sample[property].toString()) : this.sample[property]) + "' in actual.");
} }
} }
   
return (mismatchKeys.length === 0 && mismatchValues.length === 0); return (mismatchKeys.length === 0 && mismatchValues.length === 0);
}; };
   
jasmine.Matchers.ObjectContaining.prototype.jasmineToString = function () { jasmine.Matchers.ObjectContaining.prototype.jasmineToString = function () {
return "<jasmine.objectContaining(" + jasmine.pp(this.sample) + ")>"; return "<jasmine.objectContaining(" + jasmine.pp(this.sample) + ")>";
}; };
// 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] = jasmine.undefined;
}; };
   
self.clearInterval = function(timeoutKey) { self.clearInterval = function (timeoutKey) {
self.scheduledFunctions[timeoutKey] = jasmine.undefined; self.scheduledFunctions[timeoutKey] = jasmine.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 != jasmine.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] = jasmine.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 * @namespace
*/ */
jasmine.Clock = { jasmine.Clock = {
defaultFakeTimer: new jasmine.FakeTimer(), defaultFakeTimer: new jasmine.FakeTimer(),
   
reset: function() { reset: function () {
jasmine.Clock.assertInstalled(); jasmine.Clock.assertInstalled();
jasmine.Clock.defaultFakeTimer.reset(); jasmine.Clock.defaultFakeTimer.reset();
}, },
   
tick: function(millis) { tick: function (millis) {
jasmine.Clock.assertInstalled(); jasmine.Clock.assertInstalled();
jasmine.Clock.defaultFakeTimer.tick(millis); jasmine.Clock.defaultFakeTimer.tick(millis);
}, },
   
runFunctionsWithinRange: function(oldMillis, nowMillis) { runFunctionsWithinRange: function (oldMillis, nowMillis) {
jasmine.Clock.defaultFakeTimer.runFunctionsWithinRange(oldMillis, nowMillis); jasmine.Clock.defaultFakeTimer.runFunctionsWithinRange(oldMillis, nowMillis);
}, },
   
scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) { scheduleFunction: function (timeoutKey, funcToCall, millis, recurring) {
jasmine.Clock.defaultFakeTimer.scheduleFunction(timeoutKey, funcToCall, millis, recurring); jasmine.Clock.defaultFakeTimer.scheduleFunction(timeoutKey, funcToCall, millis, recurring);
}, },
   
useMock: function() { useMock: function () {
if (!jasmine.Clock.isInstalled()) { if (!jasmine.Clock.isInstalled()) {
var spec = jasmine.getEnv().currentSpec; var spec = jasmine.getEnv().currentSpec;
spec.after(jasmine.Clock.uninstallMock); spec.after(jasmine.Clock.uninstallMock);
   
jasmine.Clock.installMock(); jasmine.Clock.installMock();
} }
}, },
   
installMock: function() { installMock: function () {
jasmine.Clock.installed = jasmine.Clock.defaultFakeTimer; jasmine.Clock.installed = jasmine.Clock.defaultFakeTimer;
}, },
   
uninstallMock: function() { uninstallMock: function () {
jasmine.Clock.assertInstalled(); jasmine.Clock.assertInstalled();
jasmine.Clock.installed = jasmine.Clock.real; jasmine.Clock.installed = jasmine.Clock.real;
}, },
   
real: { real: {
setTimeout: jasmine.getGlobal().setTimeout, setTimeout: jasmine.getGlobal().setTimeout,
clearTimeout: jasmine.getGlobal().clearTimeout, clearTimeout: jasmine.getGlobal().clearTimeout,
setInterval: jasmine.getGlobal().setInterval, setInterval: jasmine.getGlobal().setInterval,
clearInterval: jasmine.getGlobal().clearInterval clearInterval: jasmine.getGlobal().clearInterval
}, },
   
assertInstalled: function() { assertInstalled: function () {
if (!jasmine.Clock.isInstalled()) { if (!jasmine.Clock.isInstalled()) {
throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()"); throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()");
} }
}, },
   
isInstalled: function() { isInstalled: function () {
return jasmine.Clock.installed == jasmine.Clock.defaultFakeTimer; return jasmine.Clock.installed == jasmine.Clock.defaultFakeTimer;
}, },
   
installed: null installed: null
}; };
jasmine.Clock.installed = jasmine.Clock.real; jasmine.Clock.installed = jasmine.Clock.real;
   
//else for IE support //else for IE support
jasmine.getGlobal().setTimeout = function(funcToCall, millis) { jasmine.getGlobal().setTimeout = function (funcToCall, millis) {
if (jasmine.Clock.installed.setTimeout.apply) { if (jasmine.Clock.installed.setTimeout.apply) {
return jasmine.Clock.installed.setTimeout.apply(this, arguments); return jasmine.Clock.installed.setTimeout.apply(this, arguments);
} else { } else {
return jasmine.Clock.installed.setTimeout(funcToCall, millis); return jasmine.Clock.installed.setTimeout(funcToCall, millis);
} }
}; };
   
jasmine.getGlobal().setInterval = function(funcToCall, millis) { jasmine.getGlobal().setInterval = function (funcToCall, millis) {
if (jasmine.Clock.installed.setInterval.apply) { if (jasmine.Clock.installed.setInterval.apply) {
return jasmine.Clock.installed.setInterval.apply(this, arguments); return jasmine.Clock.installed.setInterval.apply(this, arguments);
} else { } else {
return jasmine.Clock.installed.setInterval(funcToCall, millis); return jasmine.Clock.installed.setInterval(funcToCall, millis);
} }
}; };
   
jasmine.getGlobal().clearTimeout = function(timeoutKey) { jasmine.getGlobal().clearTimeout = function (timeoutKey) {
if (jasmine.Clock.installed.clearTimeout.apply) { if (jasmine.Clock.installed.clearTimeout.apply) {
return jasmine.Clock.installed.clearTimeout.apply(this, arguments); return jasmine.Clock.installed.clearTimeout.apply(this, arguments);
} else { } else {
return jasmine.Clock.installed.clearTimeout(timeoutKey); return jasmine.Clock.installed.clearTimeout(timeoutKey);
} }
}; };
   
jasmine.getGlobal().clearInterval = function(timeoutKey) { jasmine.getGlobal().clearInterval = function (timeoutKey) {
if (jasmine.Clock.installed.clearTimeout.apply) { if (jasmine.Clock.installed.clearTimeout.apply) {
return jasmine.Clock.installed.clearInterval.apply(this, arguments); return jasmine.Clock.installed.clearInterval.apply(this, arguments);
} else { } else {
return jasmine.Clock.installed.clearInterval(timeoutKey); return jasmine.Clock.installed.clearInterval(timeoutKey);
} }
}; };
   
/** /**
* @constructor * @constructor
*/ */
jasmine.MultiReporter = function() { jasmine.MultiReporter = function () {
this.subReporters_ = []; this.subReporters_ = [];
}; };
jasmine.util.inherit(jasmine.MultiReporter, jasmine.Reporter); jasmine.util.inherit(jasmine.MultiReporter, jasmine.Reporter);
   
jasmine.MultiReporter.prototype.addReporter = function(reporter) { jasmine.MultiReporter.prototype.addReporter = function (reporter) {
this.subReporters_.push(reporter); this.subReporters_.push(reporter);
}; };
   
(function() { (function () {
var functionNames = [ var functionNames = [
"reportRunnerStarting", "reportRunnerStarting",
"reportRunnerResults", "reportRunnerResults",
"reportSuiteResults", "reportSuiteResults",
"reportSpecStarting", "reportSpecStarting",
"reportSpecResults", "reportSpecResults",
"log" "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) {
return function() { return function () {
for (var j = 0; j < this.subReporters_.length; j++) { for (var j = 0; j < this.subReporters_.length; j++) {
var subReporter = this.subReporters_[j]; var subReporter = this.subReporters_[j];
if (subReporter[functionName]) { if (subReporter[functionName]) {
subReporter[functionName].apply(subReporter, arguments); subReporter[functionName].apply(subReporter, arguments);
} }
} }
}; };
})(functionName); })(functionName);
} }
})(); })();
/** /**
* Holds results for a set of Jasmine spec. Allows for the results array to hold another jasmine.NestedResults * Holds results for a set of Jasmine spec. Allows for the results array to hold another jasmine.NestedResults
* *
* @constructor * @constructor
*/ */
jasmine.NestedResults = function() { jasmine.NestedResults = function () {
/** /**
* The total count of results * The total count of results
*/ */
this.totalCount = 0; this.totalCount = 0;
/** /**
* Number of passed results * Number of passed results
*/ */
this.passedCount = 0; this.passedCount = 0;
/** /**
* Number of failed results * Number of failed results
*/ */
this.failedCount = 0; this.failedCount = 0;
/** /**
* Was this suite/spec skipped? * Was this suite/spec skipped?
*/ */
this.skipped = false; this.skipped = false;
/** /**
* @ignore * @ignore
*/ */
this.items_ = []; this.items_ = [];
}; };
   
/** /**
* Roll up the result counts. * Roll up the result counts.
* *
* @param result * @param result
*/ */
jasmine.NestedResults.prototype.rollupCounts = function(result) { jasmine.NestedResults.prototype.rollupCounts = function (result) {
this.totalCount += result.totalCount; this.totalCount += result.totalCount;
this.passedCount += result.passedCount; this.passedCount += result.passedCount;
this.failedCount += result.failedCount; this.failedCount += result.failedCount;
}; };
   
/** /**
* Adds a log message. * Adds a log message.
* @param values Array of message parts which will be concatenated later. * @param values Array of message parts which will be concatenated later.
*/ */
jasmine.NestedResults.prototype.log = function(values) { jasmine.NestedResults.prototype.log = function (values) {
this.items_.push(new jasmine.MessageResult(values)); this.items_.push(new jasmine.MessageResult(values));
}; };
   
/** /**
* Getter for the results: message & results. * Getter for the results: message & results.
*/ */
jasmine.NestedResults.prototype.getItems = function() { jasmine.NestedResults.prototype.getItems = function () {
return this.items_; return this.items_;
}; };
   
/** /**
* Adds a result, tracking counts (total, passed, & failed) * Adds a result, tracking counts (total, passed, & failed)
* @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 != 'log') {
if (result.items_) { if (result.items_) {
this.rollupCounts(result); this.rollupCounts(result);
} else { } else {
this.totalCount++; this.totalCount++;
if (result.passed()) { if (result.passed()) {
this.passedCount++; this.passedCount++;
} else { } else {
this.failedCount++; this.failedCount++;
} }
} }
} }
this.items_.push(result); this.items_.push(result);
}; };
   
/** /**
* @returns {Boolean} True if <b>everything</b> below passed * @returns {Boolean} True if <b>everything</b> below passed
*/ */
jasmine.NestedResults.prototype.passed = function() { jasmine.NestedResults.prototype.passed = function () {
return this.passedCount === this.totalCount; return this.passedCount === this.totalCount;
}; };
/** /**
* Base class for pretty printing for expectation results. * Base class for pretty printing for expectation results.
*/ */
jasmine.PrettyPrinter = function() { jasmine.PrettyPrinter = function () {
this.ppNestLevel_ = 0; this.ppNestLevel_ = 0;
}; };
   
/** /**
* Formats a value in a nice, human-readable string. * Formats a value in a nice, human-readable string.
* *
* @param value * @param value
*/ */
jasmine.PrettyPrinter.prototype.format = function(value) { jasmine.PrettyPrinter.prototype.format = function (value) {
if (this.ppNestLevel_ > 40) { if (this.ppNestLevel_ > 40) {
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 === jasmine.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 === jasmine.getGlobal()) {
this.emitScalar('<global>'); this.emitScalar('<global>');
} else if (value.jasmineToString) { } else if (value.jasmineToString) {
this.emitScalar(value.jasmineToString()); this.emitScalar(value.jasmineToString());
} else if (typeof value === 'string') { } else if (typeof value === 'string') {
this.emitString(value); this.emitString(value);
} else if (jasmine.isSpy(value)) { } else if (jasmine.isSpy(value)) {
this.emitScalar("spy on " + value.identity); this.emitScalar("spy on " + value.identity);
} else if (value instanceof RegExp) { } else if (value instanceof RegExp) {
this.emitScalar(value.toString()); 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') {
this.emitScalar('HTMLNode'); this.emitScalar('HTMLNode');
} else if (value instanceof Date) { } else if (value instanceof Date) {
this.emitScalar('Date(' + value + ')'); this.emitScalar('Date(' + value + ')');
} else if (value.__Jasmine_been_here_before__) { } else if (value.__Jasmine_been_here_before__) {
this.emitScalar('<circular reference: ' + (jasmine.isArray_(value) ? 'Array' : 'Object') + '>'); this.emitScalar('<circular reference: ' + (jasmine.isArray_(value) ? 'Array' : 'Object') + '>');
} else if (jasmine.isArray_(value) || typeof value == 'object') { } else if (jasmine.isArray_(value) || typeof value == 'object') {
value.__Jasmine_been_here_before__ = true; value.__Jasmine_been_here_before__ = true;
if (jasmine.isArray_(value)) { if (jasmine.isArray_(value)) {
this.emitArray(value); this.emitArray(value);
} else { } else {
this.emitObject(value); this.emitObject(value);
} }
delete value.__Jasmine_been_here_before__; delete value.__Jasmine_been_here_before__;
} else { } else {
this.emitScalar(value.toString()); this.emitScalar(value.toString());
} }
} finally { } finally {
this.ppNestLevel_--; this.ppNestLevel_--;
} }
}; };
   
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__ ? (obj.__lookupGetter__(property) !== jasmine.undefined &&
obj.__lookupGetter__(property) !== null) : false); obj.__lookupGetter__(property) !== null) : false);
} }
}; };
   
jasmine.PrettyPrinter.prototype.emitArray = jasmine.unimplementedMethod_; jasmine.PrettyPrinter.prototype.emitArray = jasmine.unimplementedMethod_;
jasmine.PrettyPrinter.prototype.emitObject = jasmine.unimplementedMethod_; jasmine.PrettyPrinter.prototype.emitObject = jasmine.unimplementedMethod_;
jasmine.PrettyPrinter.prototype.emitScalar = jasmine.unimplementedMethod_; jasmine.PrettyPrinter.prototype.emitScalar = jasmine.unimplementedMethod_;
jasmine.PrettyPrinter.prototype.emitString = jasmine.unimplementedMethod_; jasmine.PrettyPrinter.prototype.emitString = jasmine.unimplementedMethod_;
   
jasmine.StringPrettyPrinter = function() { jasmine.StringPrettyPrinter = function () {
jasmine.PrettyPrinter.call(this); jasmine.PrettyPrinter.call(this);
   
this.string = ''; this.string = '';
}; };
jasmine.util.inherit(jasmine.StringPrettyPrinter, jasmine.PrettyPrinter); jasmine.util.inherit(jasmine.StringPrettyPrinter, jasmine.PrettyPrinter);
   
jasmine.StringPrettyPrinter.prototype.emitScalar = function(value) { jasmine.StringPrettyPrinter.prototype.emitScalar = function (value) {
this.append(value); this.append(value);
}; };
   
jasmine.StringPrettyPrinter.prototype.emitString = function(value) { jasmine.StringPrettyPrinter.prototype.emitString = function (value) {
this.append("'" + value + "'"); this.append("'" + value + "'");
}; };
   
jasmine.StringPrettyPrinter.prototype.emitArray = function(array) { jasmine.StringPrettyPrinter.prototype.emitArray = function (array) {
this.append('[ '); this.append('[ ');
for (var i = 0; i < array.length; i++) { for (var i = 0; i < array.length; i++) {
if (i > 0) { if (i > 0) {
this.append(', '); this.append(', ');
} }
this.format(array[i]); this.format(array[i]);
} }
this.append(' ]'); this.append(' ]');
}; };
   
jasmine.StringPrettyPrinter.prototype.emitObject = function(obj) { jasmine.StringPrettyPrinter.prototype.emitObject = function (obj) {
var self = this; var self = this;
this.append('{ '); this.append('{ ');
var first = true; var first = true;
   
this.iterateObject(obj, function(property, isGetter) { this.iterateObject(obj, function (property, isGetter) {
if (first) { if (first) {
first = false; first = false;
} else { } else {
self.append(', '); self.append(', ');
} }
   
self.append(property); self.append(property);
self.append(' : '); self.append(' : ');
if (isGetter) { if (isGetter) {
self.append('<getter>'); self.append('<getter>');
} else { } else {
self.format(obj[property]); self.format(obj[property]);
} }
}); });
   
this.append(' }'); this.append(' }');
}; };
   
jasmine.StringPrettyPrinter.prototype.append = function(value) { jasmine.StringPrettyPrinter.prototype.append = function (value) {
this.string += value; this.string += value;
}; };
jasmine.Queue = function(env) { jasmine.Queue = function (env) {
this.env = env; this.env = env;
this.blocks = []; this.blocks = [];
this.running = false; this.running = false;
this.index = 0; this.index = 0;
this.offset = 0; this.offset = 0;
this.abort = false; this.abort = false;
}; };
   
jasmine.Queue.prototype.addBefore = function(block) { jasmine.Queue.prototype.addBefore = function (block) {
this.blocks.unshift(block); this.blocks.unshift(block);
}; };
   
jasmine.Queue.prototype.add = function(block) { jasmine.Queue.prototype.add = function (block) {
this.blocks.push(block); this.blocks.push(block);
}; };
   
jasmine.Queue.prototype.insertNext = function(block) { jasmine.Queue.prototype.insertNext = function (block) {
this.blocks.splice((this.index + this.offset + 1), 0, block); this.blocks.splice((this.index + this.offset + 1), 0, block);
this.offset++; this.offset++;
}; };
   
jasmine.Queue.prototype.start = function(onComplete) { jasmine.Queue.prototype.start = function (onComplete) {
this.running = true; this.running = true;
this.onComplete = onComplete; this.onComplete = onComplete;
this.next_(); this.next_();
}; };
   
jasmine.Queue.prototype.isRunning = function() { jasmine.Queue.prototype.isRunning = function () {
return this.running; return this.running;
}; };
   
jasmine.Queue.LOOP_DONT_RECURSE = true; jasmine.Queue.LOOP_DONT_RECURSE = true;
   
jasmine.Queue.prototype.next_ = function() { jasmine.Queue.prototype.next_ = function () {
var self = this; var self = this;
var goAgain = true; var goAgain = true;
   
while (goAgain) { while (goAgain) {
goAgain = false; goAgain = false;
   
if (self.index < self.blocks.length && !this.abort) { if (self.index < self.blocks.length && !this.abort) {
var calledSynchronously = true; var calledSynchronously = true;
var completedSynchronously = false; var completedSynchronously = false;
   
var onComplete = function () { var onComplete = function () {
if (jasmine.Queue.LOOP_DONT_RECURSE && calledSynchronously) { if (jasmine.Queue.LOOP_DONT_RECURSE && calledSynchronously) {
completedSynchronously = true; completedSynchronously = true;
return; return;
} }
   
if (self.blocks[self.index].abort) { if (self.blocks[self.index].abort) {
self.abort = true; self.abort = true;
} }
   
self.offset = 0; self.offset = 0;
self.index++; self.index++;
   
var now = new Date().getTime(); var now = new Date().getTime();
if (self.env.updateInterval && now - self.env.lastUpdate > self.env.updateInterval) { if (self.env.updateInterval && now - self.env.lastUpdate > self.env.updateInterval) {
self.env.lastUpdate = now; self.env.lastUpdate = now;
self.env.setTimeout(function() { self.env.setTimeout(function () {
self.next_(); self.next_();
}, 0); }, 0);
  } else {
  if (jasmine.Queue.LOOP_DONT_RECURSE && completedSynchronously) {
  goAgain = true;
  } else {
  self.next_();
  }
  }
  };
  self.blocks[self.index].execute(onComplete);
   
  calledSynchronously = false;
  if (completedSynchronously) {
  onComplete();
  }
   
} else { } else {
if (jasmine.Queue.LOOP_DONT_RECURSE && completedSynchronously) { self.running = false;
goAgain = true; if (self.onComplete) {
} else { self.onComplete();
self.next_(); }
} }
} }
}; };
self.blocks[self.index].execute(onComplete);  
  jasmine.Queue.prototype.results = function () {
calledSynchronously = false; var results = new jasmine.NestedResults();
if (completedSynchronously) { for (var i = 0; i < this.blocks.length; i++) {
onComplete(); if (this.blocks[i].results) {
} results.addResult(this.blocks[i].results());
  }
} else { }
self.running = false; return results;
if (self.onComplete) {  
self.onComplete();  
}  
}  
}  
};  
   
jasmine.Queue.prototype.results = function() {  
var results = new jasmine.NestedResults();  
for (var i = 0; i < this.blocks.length; i++) {  
if (this.blocks[i].results) {  
results.addResult(this.blocks[i].results());  
}  
}  
return results;  
}; };
   
   
/** /**
* Runner * Runner
* *
* @constructor * @constructor
* @param {jasmine.Env} env * @param {jasmine.Env} env
*/ */
jasmine.Runner = function(env) { jasmine.Runner = function (env) {
var self = this; var self = this;
self.env = env; self.env = env;
self.queue = new jasmine.Queue(env); self.queue = new jasmine.Queue(env);
self.before_ = []; self.before_ = [];
self.after_ = []; self.after_ = [];
self.suites_ = []; self.suites_ = [];
}; };
   
jasmine.Runner.prototype.execute = function() { jasmine.Runner.prototype.execute = function () {
var self = this; var self = this;
if (self.env.reporter.reportRunnerStarting) { if (self.env.reporter.reportRunnerStarting) {
self.env.reporter.reportRunnerStarting(this); self.env.reporter.reportRunnerStarting(this);
} }
self.queue.start(function () { self.queue.start(function () {
self.finishCallback(); self.finishCallback();
}); });
}; };
   
jasmine.Runner.prototype.beforeEach = function(beforeEachFunction) { jasmine.Runner.prototype.beforeEach = function (beforeEachFunction) {
beforeEachFunction.typeName = 'beforeEach'; beforeEachFunction.typeName = 'beforeEach';
this.before_.splice(0,0,beforeEachFunction); this.before_.splice(0, 0, beforeEachFunction);
}; };
   
jasmine.Runner.prototype.afterEach = function(afterEachFunction) { jasmine.Runner.prototype.afterEach = function (afterEachFunction) {
afterEachFunction.typeName = 'afterEach'; afterEachFunction.typeName = 'afterEach';
this.after_.splice(0,0,afterEachFunction); this.after_.splice(0, 0, afterEachFunction);
}; };
   
   
jasmine.Runner.prototype.finishCallback = function() { jasmine.Runner.prototype.finishCallback = function () {
this.env.reporter.reportRunnerResults(this); this.env.reporter.reportRunnerResults(this);
}; };
   
jasmine.Runner.prototype.addSuite = function(suite) { jasmine.Runner.prototype.addSuite = function (suite) {
this.suites_.push(suite); this.suites_.push(suite);
}; };
   
jasmine.Runner.prototype.add = function(block) { jasmine.Runner.prototype.add = function (block) {
if (block instanceof jasmine.Suite) { if (block instanceof jasmine.Suite) {
this.addSuite(block); this.addSuite(block);
} }
this.queue.add(block); this.queue.add(block);
}; };
   
jasmine.Runner.prototype.specs = function () { jasmine.Runner.prototype.specs = function () {
var suites = this.suites(); var suites = this.suites();
var specs = []; var specs = [];
for (var i = 0; i < suites.length; i++) { for (var i = 0; i < suites.length; i++) {
specs = specs.concat(suites[i].specs()); specs = specs.concat(suites[i].specs());
} }
return specs; return specs;
}; };
   
jasmine.Runner.prototype.suites = function() { jasmine.Runner.prototype.suites = function () {
return this.suites_; return this.suites_;
}; };
   
jasmine.Runner.prototype.topLevelSuites = function() { jasmine.Runner.prototype.topLevelSuites = function () {
var topLevelSuites = []; var topLevelSuites = [];
for (var i = 0; i < this.suites_.length; i++) { for (var i = 0; i < this.suites_.length; i++) {
if (!this.suites_[i].parentSuite) { if (!this.suites_[i].parentSuite) {
topLevelSuites.push(this.suites_[i]); topLevelSuites.push(this.suites_[i]);
} }
} }
return topLevelSuites; return topLevelSuites;
}; };
   
jasmine.Runner.prototype.results = function() { jasmine.Runner.prototype.results = function () {
return this.queue.results(); return this.queue.results();
}; };
/** /**
* Internal representation of a Jasmine specification, or test. * Internal representation of a Jasmine specification, or test.
* *
* @constructor * @constructor
* @param {jasmine.Env} env * @param {jasmine.Env} env
* @param {jasmine.Suite} suite * @param {jasmine.Suite} suite
* @param {String} description * @param {String} description
*/ */
jasmine.Spec = function(env, suite, description) { jasmine.Spec = function (env, suite, description) {
if (!env) { if (!env) {
throw new Error('jasmine.Env() required'); throw new Error('jasmine.Env() required');
} }
if (!suite) { if (!suite) {
throw new Error('jasmine.Suite() required'); throw new Error('jasmine.Suite() required');
} }
var spec = this; var spec = this;
spec.id = env.nextSpecId ? env.nextSpecId() : null; spec.id = env.nextSpecId ? env.nextSpecId() : null;
spec.env = env; spec.env = env;
spec.suite = suite; spec.suite = suite;
spec.description = description; spec.description = description;
spec.queue = new jasmine.Queue(env); spec.queue = new jasmine.Queue(env);
   
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;
}; };
   
jasmine.Spec.prototype.getFullName = function() { jasmine.Spec.prototype.getFullName = function () {
return this.suite.getFullName() + ' ' + this.description + '.'; return this.suite.getFullName() + ' ' + this.description + '.';
}; };
   
   
jasmine.Spec.prototype.results = 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. * 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. * Be careful not to leave calls to <code>jasmine.log</code> in production code.
*/ */
jasmine.Spec.prototype.log = function() { jasmine.Spec.prototype.log = function () {
return this.results_.log(arguments); return this.results_.log(arguments);
}; };
   
jasmine.Spec.prototype.runs = function (func) { jasmine.Spec.prototype.runs = function (func) {
var block = new jasmine.Block(this.env, func, this); var block = new jasmine.Block(this.env, func, this);
this.addToQueue(block); this.addToQueue(block);
return this; return this;
}; };
   
jasmine.Spec.prototype.addToQueue = function (block) { jasmine.Spec.prototype.addToQueue = function (block) {
if (this.queue.isRunning()) { if (this.queue.isRunning()) {
this.queue.insertNext(block); this.queue.insertNext(block);
} else { } else {
this.queue.add(block); this.queue.add(block);
} }
}; };
   
/** /**
* @param {jasmine.ExpectationResult} result * @param {jasmine.ExpectationResult} result
*/ */
jasmine.Spec.prototype.addMatcherResult = function(result) { jasmine.Spec.prototype.addMatcherResult = function (result) {
this.results_.addResult(result); this.results_.addResult(result);
}; };
   
jasmine.Spec.prototype.expect = function(actual) { jasmine.Spec.prototype.expect = function (actual) {
var positive = new (this.getMatchersClass_())(this.env, actual, this); var positive = new (this.getMatchersClass_())(this.env, actual, this);
positive.not = new (this.getMatchersClass_())(this.env, actual, this, true); positive.not = new (this.getMatchersClass_())(this.env, actual, this, true);
return positive; return positive;
}; };
   
/** /**
* Waits a fixed time period before moving to the next block. * Waits a fixed time period before moving to the next block.
* *
* @deprecated Use waitsFor() instead * @deprecated Use waitsFor() instead
* @param {Number} timeout milliseconds to wait * @param {Number} timeout milliseconds to wait
*/ */
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;
}; };
   
/** /**
* 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 block.
* *
* @param {Function} latchFunction * @param {Function} latchFunction
* @param {String} optional_timeoutMessage * @param {String} optional_timeoutMessage
* @param {Number} optional_timeout * @param {Number} optional_timeout
*/ */
jasmine.Spec.prototype.waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout) { jasmine.Spec.prototype.waitsFor = function (latchFunction, optional_timeoutMessage, optional_timeout) {
var latchFunction_ = null; var latchFunction_ = null;
var optional_timeoutMessage_ = null; var optional_timeoutMessage_ = null;
var optional_timeout_ = null; var optional_timeout_ = null;
   
for (var i = 0; i < arguments.length; i++) { for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i]; var arg = arguments[i];
switch (typeof arg) { switch (typeof arg) {
case 'function': case 'function':
latchFunction_ = arg; latchFunction_ = arg;
break; break;
case 'string': case 'string':
optional_timeoutMessage_ = arg; optional_timeoutMessage_ = arg;
break; break;
case 'number': case 'number':
optional_timeout_ = arg; optional_timeout_ = arg;
break; break;
} }
} }
   
var waitsForFunc = new jasmine.WaitsForBlock(this.env, optional_timeout_, latchFunction_, optional_timeoutMessage_, this); 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.fail = function (e) {
var expectationResult = new jasmine.ExpectationResult({ var expectationResult = new jasmine.ExpectationResult({
passed: false, passed: false,
message: e ? jasmine.util.formatException(e) : 'Exception', message: e ? jasmine.util.formatException(e) : 'Exception',
trace: { stack: e.stack } trace: { stack: e.stack }
}); });
this.results_.addResult(expectationResult); this.results_.addResult(expectationResult);
}; };
   
jasmine.Spec.prototype.getMatchersClass_ = function() { jasmine.Spec.prototype.getMatchersClass_ = function () {
return this.matchersClass || this.env.matchersClass; return this.matchersClass || this.env.matchersClass;
}; };
   
jasmine.Spec.prototype.addMatchers = function(matchersPrototype) { jasmine.Spec.prototype.addMatchers = function (matchersPrototype) {
var parent = this.getMatchersClass_(); var parent = this.getMatchersClass_();
var newMatchersClass = function() { var newMatchersClass = function () {
parent.apply(this, arguments); parent.apply(this, arguments);
}; };
jasmine.util.inherit(newMatchersClass, parent); jasmine.util.inherit(newMatchersClass, parent);
jasmine.Matchers.wrapInto_(matchersPrototype, newMatchersClass); jasmine.Matchers.wrapInto_(matchersPrototype, newMatchersClass);
this.matchersClass = newMatchersClass; this.matchersClass = newMatchersClass;
}; };
   
jasmine.Spec.prototype.finishCallback = function() { jasmine.Spec.prototype.finishCallback = function () {
this.env.reporter.reportSpecResults(this); this.env.reporter.reportSpecResults(this);
}; };
   
jasmine.Spec.prototype.finish = function(onComplete) { jasmine.Spec.prototype.finish = function (onComplete) {
this.removeAllSpies(); this.removeAllSpies();
this.finishCallback(); this.finishCallback();
if (onComplete) { if (onComplete) {
onComplete(); onComplete();
} }
}; };
   
jasmine.Spec.prototype.after = function(doAfter) { jasmine.Spec.prototype.after = function (doAfter) {
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.reportSpecStarting(this); this.env.reporter.reportSpecStarting(this);
   
spec.env.currentSpec = spec; spec.env.currentSpec = spec;
   
spec.addBeforesAndAftersToQueue(); spec.addBeforesAndAftersToQueue();
   
spec.queue.start(function () { spec.queue.start(function () {
spec.finish(onComplete); spec.finish(onComplete);
}); });
}; };
   
jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() { jasmine.Spec.prototype.addBeforesAndAftersToQueue = function () {
var runner = this.env.currentRunner(); var runner = this.env.currentRunner();
var i; 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++) { for (i = 0; i < suite.before_.length; i++) {
this.queue.addBefore(new jasmine.Block(this.env, suite.before_[i], this)); this.queue.addBefore(new jasmine.Block(this.env, suite.before_[i], this));
} }
} }
for (i = 0; i < runner.before_.length; i++) { for (i = 0; i < runner.before_.length; i++) {
this.queue.addBefore(new jasmine.Block(this.env, runner.before_[i], this)); 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++) { for (i = 0; i < suite.after_.length; i++) {
this.queue.add(new jasmine.Block(this.env, suite.after_[i], this)); this.queue.add(new jasmine.Block(this.env, suite.after_[i], this));
} }
} }
for (i = 0; i < runner.after_.length; i++) { for (i = 0; i < runner.after_.length; i++) {
this.queue.add(new jasmine.Block(this.env, runner.after_[i], this)); this.queue.add(new jasmine.Block(this.env, runner.after_[i], this));
} }
}; };
   
jasmine.Spec.prototype.explodes = function() { jasmine.Spec.prototype.explodes = function () {
throw 'explodes function should not have been called'; throw 'explodes function should not have been called';
}; };
   
jasmine.Spec.prototype.spyOn = function(obj, methodName, ignoreMethodDoesntExist) { jasmine.Spec.prototype.spyOn = function (obj, methodName, ignoreMethodDoesntExist) {
if (obj == jasmine.undefined) { if (obj == jasmine.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] === jasmine.undefined) {
throw methodName + '() method does not exist'; throw methodName + '() method does not exist';
} }
   
if (!ignoreMethodDoesntExist && obj[methodName] && obj[methodName].isSpy) { if (!ignoreMethodDoesntExist && obj[methodName] && obj[methodName].isSpy) {
throw new Error(methodName + ' has already been spied upon'); throw new Error(methodName + ' has already been spied upon');
} }
   
var spyObj = jasmine.createSpy(methodName); var spyObj = jasmine.createSpy(methodName);
   
this.spies_.push(spyObj); this.spies_.push(spyObj);
spyObj.baseObj = obj; spyObj.baseObj = obj;
spyObj.methodName = methodName; spyObj.methodName = methodName;
spyObj.originalValue = obj[methodName]; spyObj.originalValue = obj[methodName];
   
obj[methodName] = spyObj; obj[methodName] = spyObj;
   
return spyObj; return spyObj;
}; };
   
jasmine.Spec.prototype.removeAllSpies = function() { jasmine.Spec.prototype.removeAllSpies = function () {
for (var i = 0; i < this.spies_.length; i++) { for (var i = 0; i < this.spies_.length; i++) {
var spy = this.spies_[i]; var spy = this.spies_[i];
spy.baseObj[spy.methodName] = spy.originalValue; spy.baseObj[spy.methodName] = spy.originalValue;
} }
this.spies_ = []; this.spies_ = [];
}; };
   
/** /**
* Internal representation of a Jasmine suite. * Internal representation of a Jasmine suite.
* *
* @constructor * @constructor
* @param {jasmine.Env} env * @param {jasmine.Env} env
* @param {String} description * @param {String} description
* @param {Function} specDefinitions * @param {Function} specDefinitions
* @param {jasmine.Suite} parentSuite * @param {jasmine.Suite} parentSuite
*/ */
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 ? env.nextSuiteId() : null;
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.before_ = [];
self.after_ = []; self.after_ = [];
self.children_ = []; self.children_ = [];
self.suites_ = []; self.suites_ = [];
self.specs_ = []; self.specs_ = [];
}; };
   
jasmine.Suite.prototype.getFullName = function() { jasmine.Suite.prototype.getFullName = function () {
var fullName = this.description; var fullName = this.description;
for (var parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) { for (var parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) {
fullName = parentSuite.description + ' ' + fullName; fullName = parentSuite.description + ' ' + fullName;
} }
return fullName; return fullName;
}; };
   
jasmine.Suite.prototype.finish = function(onComplete) { jasmine.Suite.prototype.finish = function (onComplete) {
this.env.reporter.reportSuiteResults(this); this.env.reporter.reportSuiteResults(this);
this.finished = true; this.finished = true;
if (typeof(onComplete) == 'function') { if (typeof(onComplete) == 'function') {
onComplete(); onComplete();
} }
}; };
   
jasmine.Suite.prototype.beforeEach = function(beforeEachFunction) { jasmine.Suite.prototype.beforeEach = function (beforeEachFunction) {
beforeEachFunction.typeName = 'beforeEach'; beforeEachFunction.typeName = 'beforeEach';
this.before_.unshift(beforeEachFunction); this.before_.unshift(beforeEachFunction);
}; };
   
jasmine.Suite.prototype.afterEach = function(afterEachFunction) { jasmine.Suite.prototype.afterEach = function (afterEachFunction) {
afterEachFunction.typeName = 'afterEach'; afterEachFunction.typeName = 'afterEach';
this.after_.unshift(afterEachFunction); this.after_.unshift(afterEachFunction);
}; };
   
jasmine.Suite.prototype.results = function() { jasmine.Suite.prototype.results = function () {
return this.queue.results(); return this.queue.results();
}; };
   
jasmine.Suite.prototype.add = function(suiteOrSpec) { jasmine.Suite.prototype.add = function (suiteOrSpec) {
this.children_.push(suiteOrSpec); this.children_.push(suiteOrSpec);
if (suiteOrSpec instanceof jasmine.Suite) { if (suiteOrSpec instanceof jasmine.Suite) {
this.suites_.push(suiteOrSpec); this.suites_.push(suiteOrSpec);
this.env.currentRunner().addSuite(suiteOrSpec); this.env.currentRunner().addSuite(suiteOrSpec);
} else { } else {
this.specs_.push(suiteOrSpec); this.specs_.push(suiteOrSpec);
} }
this.queue.add(suiteOrSpec); this.queue.add(suiteOrSpec);
}; };
   
jasmine.Suite.prototype.specs = function() { jasmine.Suite.prototype.specs = function () {
return this.specs_; return this.specs_;
}; };
   
jasmine.Suite.prototype.suites = function() { jasmine.Suite.prototype.suites = function () {
return this.suites_; return this.suites_;
}; };
   
jasmine.Suite.prototype.children = function() { jasmine.Suite.prototype.children = function () {
return this.children_; 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);
}); });
}; };
jasmine.WaitsBlock = function(env, timeout, spec) { jasmine.WaitsBlock = function (env, timeout, spec) {
this.timeout = timeout; this.timeout = timeout;
jasmine.Block.call(this, env, null, spec); jasmine.Block.call(this, env, null, 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) { 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);
}; };
/** /**
* A block which waits for some condition to become true, with timeout. * A block which waits for some condition to become true, with timeout.
* *
* @constructor * @constructor
* @extends jasmine.Block * @extends jasmine.Block
* @param {jasmine.Env} env The Jasmine environment. * @param {jasmine.Env} env The Jasmine environment.
* @param {Number} timeout The maximum time in milliseconds to wait for the condition to become true. * @param {Number} timeout The maximum time in milliseconds to wait for the condition to become true.
* @param {Function} latchFunction A function which returns true when the desired condition has been met. * @param {Function} latchFunction A function which returns true when the desired condition has been met.
* @param {String} message The message to display if the desired condition hasn't been met within the given time period. * @param {String} message The message to display if the desired condition hasn't been met within the given time period.
* @param {jasmine.Spec} spec The Jasmine spec. * @param {jasmine.Spec} spec The Jasmine spec.
*/ */
jasmine.WaitsForBlock = function(env, timeout, latchFunction, message, spec) { jasmine.WaitsForBlock = function (env, timeout, latchFunction, message, spec) {
this.timeout = timeout || env.defaultTimeoutInterval; this.timeout = timeout || env.defaultTimeoutInterval;
this.latchFunction = latchFunction; this.latchFunction = latchFunction;
this.message = message; this.message = message;
this.totalTimeSpentWaitingForLatch = 0; this.totalTimeSpentWaitingForLatch = 0;
jasmine.Block.call(this, env, null, spec); jasmine.Block.call(this, env, null, spec);
}; };
jasmine.util.inherit(jasmine.WaitsForBlock, jasmine.Block); jasmine.util.inherit(jasmine.WaitsForBlock, jasmine.Block);
   
jasmine.WaitsForBlock.TIMEOUT_INCREMENT = 10; jasmine.WaitsForBlock.TIMEOUT_INCREMENT = 10;
   
jasmine.WaitsForBlock.prototype.execute = function(onComplete) { jasmine.WaitsForBlock.prototype.execute = function (onComplete) {
if (jasmine.VERBOSE) { if (jasmine.VERBOSE) {
this.env.reporter.log('>> Jasmine waiting for ' + (this.message || 'something to happen')); this.env.reporter.log('>> Jasmine waiting for ' + (this.message || 'something to happen'));
} }
var latchFunctionResult; var latchFunctionResult;
try { try {
latchFunctionResult = this.latchFunction.apply(this.spec); latchFunctionResult = this.latchFunction.apply(this.spec);
} catch (e) { } catch (e) {
this.spec.fail(e); this.spec.fail(e);
onComplete(); onComplete();
return; return;
} }
   
if (latchFunctionResult) { if (latchFunctionResult) {
onComplete(); onComplete();
} else if (this.totalTimeSpentWaitingForLatch >= this.timeout) { } else if (this.totalTimeSpentWaitingForLatch >= this.timeout) {
var message = 'timed out after ' + this.timeout + ' msec waiting for ' + (this.message || 'something to happen'); var message = 'timed out after ' + this.timeout + ' msec waiting for ' + (this.message || 'something to happen');
this.spec.fail({ this.spec.fail({
name: 'timeout', name: 'timeout',
message: message message: message
}); });
   
this.abort = true; this.abort = true;
onComplete(); onComplete();
} else { } else {
this.totalTimeSpentWaitingForLatch += jasmine.WaitsForBlock.TIMEOUT_INCREMENT; this.totalTimeSpentWaitingForLatch += jasmine.WaitsForBlock.TIMEOUT_INCREMENT;
var self = this; var self = this;
this.env.setTimeout(function() { this.env.setTimeout(function () {
self.execute(onComplete); self.execute(onComplete);
}, jasmine.WaitsForBlock.TIMEOUT_INCREMENT); }, jasmine.WaitsForBlock.TIMEOUT_INCREMENT);
} }
}; };
   
jasmine.version_= { jasmine.version_ = {
"major": 1, "major": 1,
"minor": 2, "minor": 2,
"build": 0, "build": 0,
"revision": 1337005947 "revision": 1337005947
}; };
   
{ {
"JAVASCRIPT": { "JAVASCRIPT": {
"DIST_DIR": "./build", "DIST_DIR": "./build",
"flotr2-basic": [ "flotr2-basic": [
"./js/Flotr.js", "./js/Flotr.js",
"./js/DefaultOptions.js", "./js/DefaultOptions.js",
"./js/DOM.js", "./js/DOM.js",
"./js/EventAdapter.js", "./js/EventAdapter.js",
"./js/Color.js", "./js/Color.js",
"./js/Date.js", "./js/Date.js",
"./js/Text.js", "./js/Text.js",
"./js/Graph.js", "./js/Graph.js",
"./js/Axis.js", "./js/Axis.js",
"./js/Series.js", "./js/Series.js",
"./js/types/lines.js", "./js/types/lines.js",
"./js/types/bars.js", "./js/types/bars.js",
"./js/types/markers.js", "./js/types/markers.js",
"./js/types/points.js", "./js/types/points.js",
"./js/plugins/grid.js", "./js/plugins/grid.js",
"./js/plugins/labels.js", "./js/plugins/labels.js",
"./js/plugins/legend.js", "./js/plugins/legend.js",
"./js/plugins/titles.js" "./js/plugins/titles.js"
] ]
} }
} }
   
{ {
"JAVASCRIPT": { "JAVASCRIPT": {
"DIST_DIR": "./build", "DIST_DIR": "./build",
"ie": [ "ie": [
{ "src": "./lib/excanvas.js", "jshint": false }, {
{ "src": "./lib/base64.js", "jshint": false }, "src": "./lib/excanvas.js",
{ "src": "./lib/canvastext.js", "jshint": false } "jshint": false
], },
"lib": [ {
{ "src": "./lib/bean.js", "jshint": false }, "src": "./lib/base64.js",
{ "src": "./lib/underscore.js", "jshint": false } "jshint": false
], },
"flotr2": [ {
"./js/Flotr.js", "src": "./lib/canvastext.js",
"./js/DefaultOptions.js", "jshint": false
"./js/Color.js", }
"./js/Date.js", ],
"./js/DOM.js", "lib": [
"./js/EventAdapter.js", {
"./js/Text.js", "src": "./lib/bean.js",
"./js/Graph.js", "jshint": false
"./js/Axis.js", },
"./js/Series.js", {
"./js/types/lines.js", "src": "./lib/underscore.js",
"./js/types/bars.js", "jshint": false
"./js/types/bubbles.js", }
"./js/types/candles.js", ],
"./js/types/gantt.js", "flotr2": [
"./js/types/markers.js", "./js/Flotr.js",
"./js/types/pie.js", "./js/DefaultOptions.js",
"./js/types/points.js", "./js/Color.js",
"./js/types/radar.js", "./js/Date.js",
"./js/types/timeline.js", "./js/DOM.js",
"./js/plugins/crosshair.js", "./js/EventAdapter.js",
"./js/plugins/download.js", "./js/Text.js",
"./js/plugins/grid.js", "./js/Graph.js",
"./js/plugins/hit.js", "./js/Axis.js",
"./js/plugins/selection.js", "./js/Series.js",
"./js/plugins/labels.js", "./js/types/lines.js",
"./js/plugins/legend.js", "./js/types/bars.js",
"./js/plugins/spreadsheet.js", "./js/types/bubbles.js",
"./js/plugins/titles.js" "./js/types/candles.js",
], "./js/types/gantt.js",
"flotr2-basic": [ "./js/types/markers.js",
"./js/Flotr.js", "./js/types/pie.js",
"./js/DefaultOptions.js", "./js/types/points.js",
"./js/DOM.js", "./js/types/radar.js",
"./js/EventAdapter.js", "./js/types/timeline.js",
"./js/Color.js", "./js/plugins/crosshair.js",
"./js/Date.js", "./js/plugins/download.js",
"./js/Text.js", "./js/plugins/grid.js",
"./js/Graph.js", "./js/plugins/hit.js",
"./js/Axis.js", "./js/plugins/selection.js",
"./js/Series.js", "./js/plugins/labels.js",
"./js/types/lines.js", "./js/plugins/legend.js",
"./js/types/bars.js", "./js/plugins/spreadsheet.js",
"./js/types/markers.js", "./js/plugins/titles.js"
"./js/types/points.js", ],
"./js/plugins/grid.js", "flotr2-basic": [
"./js/plugins/labels.js", "./js/Flotr.js",
"./js/plugins/legend.js", "./js/DefaultOptions.js",
"./js/plugins/titles.js" "./js/DOM.js",
], "./js/EventAdapter.js",
"examples": [ "./js/Color.js",
"./examples/js/Examples.js", "./js/Date.js",
"./examples/js/Example.js", "./js/Text.js",
"./examples/js/Editor.js", "./js/Graph.js",
"./examples/js/Profile.js" "./js/Axis.js",
], "./js/Series.js",
"examples-types": [ "./js/types/lines.js",
"./examples/js/ExampleList.js", "./js/types/bars.js",
"./examples/js/examples/basic.js", "./js/types/markers.js",
"./examples/js/examples/basic-stacked.js", "./js/types/points.js",
"./examples/js/examples/basic-axis.js", "./js/plugins/grid.js",
"./examples/js/examples/basic-bars.js", "./js/plugins/labels.js",
"./examples/js/examples/basic-bars-stacked.js", "./js/plugins/legend.js",
"./examples/js/examples/basic-pie.js", "./js/plugins/titles.js"
"./examples/js/examples/basic-radar.js", ],
"./examples/js/examples/basic-bubble.js", "examples": [
"./examples/js/examples/basic-candle.js", "./examples/js/Examples.js",
"./examples/js/examples/basic-legend.js", "./examples/js/Example.js",
"./examples/js/examples/mouse-tracking.js", "./examples/js/Editor.js",
"./examples/js/examples/mouse-zoom.js", "./examples/js/Profile.js"
"./examples/js/examples/mouse-drag.js", ],
"./examples/js/examples/basic-time.js", "examples-types": [
"./examples/js/examples/negative-values.js", "./examples/js/ExampleList.js",
"./examples/js/examples/click-example.js", "./examples/js/examples/basic.js",
"./examples/js/examples/download-image.js", "./examples/js/examples/basic-stacked.js",
"./examples/js/examples/download-data.js", "./examples/js/examples/basic-axis.js",
"./examples/js/examples/advanced-titles.js", "./examples/js/examples/basic-bars.js",
"./examples/js/examples/color-gradients.js", "./examples/js/examples/basic-bars-stacked.js",
"./examples/js/examples/profile-bars.js", "./examples/js/examples/basic-pie.js",
"./examples/js/examples/basic-timeline.js", "./examples/js/examples/basic-radar.js",
"./examples/js/examples/advanced-markers.js" "./examples/js/examples/basic-bubble.js",
] "./examples/js/examples/basic-candle.js",
} "./examples/js/examples/basic-legend.js",
  "./examples/js/examples/mouse-tracking.js",
  "./examples/js/examples/mouse-zoom.js",
  "./examples/js/examples/mouse-drag.js",
  "./examples/js/examples/basic-time.js",
  "./examples/js/examples/negative-values.js",
  "./examples/js/examples/click-example.js",
  "./examples/js/examples/download-image.js",
  "./examples/js/examples/download-data.js",
  "./examples/js/examples/advanced-titles.js",
  "./examples/js/examples/color-gradients.js",
  "./examples/js/examples/profile-bars.js",
  "./examples/js/examples/basic-timeline.js",
  "./examples/js/examples/advanced-markers.js"
  ]
  }
} }
   
{ {
"JAVASCRIPT": { "JAVASCRIPT": {
"DIST_DIR": "./build", "DIST_DIR": "./build",
"examples": [ "examples": [
"./examples/js/Examples.js", "./examples/js/Examples.js",
"./examples/js/Example.js", "./examples/js/Example.js",
"./examples/js/Editor.js", "./examples/js/Editor.js",
"./examples/js/Profile.js" "./examples/js/Profile.js"
], ],
"examples-types": [ "examples-types": [
"./examples/js/ExampleList.js", "./examples/js/ExampleList.js",
"./examples/js/examples/basic.js", "./examples/js/examples/basic.js",
"./examples/js/examples/basic-stacked.js", "./examples/js/examples/basic-stacked.js",
"./examples/js/examples/basic-stepped.js", "./examples/js/examples/basic-stepped.js",
"./examples/js/examples/basic-axis.js", "./examples/js/examples/basic-axis.js",
"./examples/js/examples/basic-bars.js", "./examples/js/examples/basic-bars.js",
"./examples/js/examples/basic-bars-stacked.js", "./examples/js/examples/basic-bars-stacked.js",
"./examples/js/examples/basic-pie.js", "./examples/js/examples/basic-pie.js",
"./examples/js/examples/basic-radar.js", "./examples/js/examples/basic-radar.js",
"./examples/js/examples/basic-bubble.js", "./examples/js/examples/basic-bubble.js",
"./examples/js/examples/basic-candle.js", "./examples/js/examples/basic-candle.js",
"./examples/js/examples/basic-legend.js", "./examples/js/examples/basic-legend.js",
"./examples/js/examples/mouse-tracking.js", "./examples/js/examples/mouse-tracking.js",
"./examples/js/examples/mouse-zoom.js", "./examples/js/examples/mouse-zoom.js",
"./examples/js/examples/mouse-drag.js", "./examples/js/examples/mouse-drag.js",
"./examples/js/examples/basic-time.js", "./examples/js/examples/basic-time.js",
"./examples/js/examples/negative-values.js", "./examples/js/examples/negative-values.js",
"./examples/js/examples/click-example.js", "./examples/js/examples/click-example.js",
"./examples/js/examples/download-image.js", "./examples/js/examples/download-image.js",
"./examples/js/examples/download-data.js", "./examples/js/examples/download-data.js",
"./examples/js/examples/advanced-titles.js", "./examples/js/examples/advanced-titles.js",
"./examples/js/examples/color-gradients.js", "./examples/js/examples/color-gradients.js",
"./examples/js/examples/profile-bars.js", "./examples/js/examples/profile-bars.js",
"./examples/js/examples/basic-timeline.js", "./examples/js/examples/basic-timeline.js",
"./examples/js/examples/advanced-markers.js" "./examples/js/examples/advanced-markers.js"
] ]
} }
} }
   
{ {
"JAVASCRIPT": { "JAVASCRIPT": {
"DIST_DIR": "./build", "DIST_DIR": "./build",
"flotr2": [ "flotr2": [
"./js/Flotr.js", "./js/Flotr.js",
"./js/DefaultOptions.js", "./js/DefaultOptions.js",
"./js/Color.js", "./js/Color.js",
"./js/Date.js", "./js/Date.js",
"./js/DOM.js", "./js/DOM.js",
"./js/EventAdapter.js", "./js/EventAdapter.js",
"./js/Text.js", "./js/Text.js",
"./js/Graph.js", "./js/Graph.js",
"./js/Axis.js", "./js/Axis.js",
"./js/Series.js", "./js/Series.js",
"./js/types/lines.js", "./js/types/lines.js",
"./js/types/bars.js", "./js/types/bars.js",
"./js/types/bubbles.js", "./js/types/bubbles.js",
"./js/types/candles.js", "./js/types/candles.js",
"./js/types/gantt.js", "./js/types/gantt.js",
"./js/types/markers.js", "./js/types/markers.js",
"./js/types/pie.js", "./js/types/pie.js",
"./js/types/points.js", "./js/types/points.js",
"./js/types/radar.js", "./js/types/radar.js",
"./js/types/timeline.js", "./js/types/timeline.js",
"./js/plugins/crosshair.js", "./js/plugins/crosshair.js",
"./js/plugins/download.js", "./js/plugins/download.js",
"./js/plugins/grid.js", "./js/plugins/grid.js",
"./js/plugins/hit.js", "./js/plugins/hit.js",
"./js/plugins/selection.js", "./js/plugins/selection.js",
"./js/plugins/labels.js", "./js/plugins/labels.js",
"./js/plugins/legend.js", "./js/plugins/legend.js",
"./js/plugins/spreadsheet.js", "./js/plugins/spreadsheet.js",
"./js/plugins/titles.js" "./js/plugins/titles.js"
] ]
} }
} }
   
{ {
"JAVASCRIPT": { "JAVASCRIPT": {
"DIST_DIR": "./build", "DIST_DIR": "./build",
"ie": [ "ie": [
{ "src": "./lib/excanvas.js", "jshint": false }, {
{ "src": "./lib/base64.js", "jshint": false }, "src": "./lib/excanvas.js",
{ "src": "./lib/canvastext.js", "jshint": false } "jshint": false
] },
} {
  "src": "./lib/base64.js",
  "jshint": false
  },
  {
  "src": "./lib/canvastext.js",
  "jshint": false
  }
  ]
  }
} }
   
{ {
"JAVASCRIPT": { "JAVASCRIPT": {
"DIST_DIR": "./build", "DIST_DIR": "./build",
"bean": [ "bean": [
{ "src": "./lib/bean.js", "jshint": false } {
], "src": "./lib/bean.js",
"underscore": [ "jshint": false
{ "src": "./lib/underscore.js", "jshint": false } }
] ],
} "underscore": [
  {
  "src": "./lib/underscore.js",
  "jshint": false
  }
  ]
  }
} }
   
describe('Charts', function () { describe('Charts', function () {
   
var var
width = 480, width = 480,
height = 320, height = 320,
a, b, options, defaults; a, b, options, defaults;
   
defaults = { defaults = {
width : 480, width: 480,
height : 320, height: 320,
color : "rgb(192,216,0)", color: "rgb(192,216,0)",
context : null, context: null,
data : null, data: null,
fill : false, fill: false,
fillColor : null, fillColor: null,
fillOpacity : 0.4, fillOpacity: 0.4,
fillStyle : "rgba(192,216,0,0.4)", fillStyle: "rgba(192,216,0,0.4)",
fontColor : "#545454", fontColor: "#545454",
fontSize : 7.5, fontSize: 7.5,
htmlText : true, htmlText: true,
lineWidth : 2, lineWidth: 2,
shadowSize : 4, shadowSize: 4,
show : false, show: false,
stacked : false, stacked: false,
textEnabled : true, textEnabled: true,
xScale : function (x) { return x; }, xScale: function (x) {
yScale : function (y) { return height - y; } return x;
}; },
  yScale: function (y) {
  return height - y;
  }
  };
   
/** /**
* @param skip bool Skip test against development version (use this when developing test) * @param skip bool Skip test against development version (use this when developing test)
*/ */
function drawTest (data, o, skip) { function drawTest(data, o, skip) {
options.data = data; options.data = data;
if (o) _.extend(options, o); if (o) _.extend(options, o);
   
if (!skip) TestFlotr.graphTypes.lines.draw(options); if (!skip) TestFlotr.graphTypes.lines.draw(options);
options.context = b.getContext('2d'); options.context = b.getContext('2d');
StableFlotr.graphTypes.lines.draw(options); StableFlotr.graphTypes.lines.draw(options);
   
expect(b).toImageDiffEqual(a); expect(b).toImageDiffEqual(a);
} }
   
describe('Lines', function () { describe('Lines', function () {
   
beforeEach(function () { beforeEach(function () {
options = _.clone(defaults); options = _.clone(defaults);
  });
   
  /*
  describe('Data', function () {
  it('gets a range', function () {
  options.stacked = true;
  options.data = [[0, 0], [240, 160], [480, 320]];
  range = TestFlotr.graphTypes.lines.range(options);
  expect(range.min).toEqual(0);
  expect(range.max).toEqual(320);
  });
  });
  */
   
  describe('Draw', function () {
   
  beforeEach(function () {
  this.addMatchers(imagediff.jasmine);
  a = imagediff.createCanvas(width, height);
  b = imagediff.createCanvas(width, height);
  options.context = a.getContext('2d');
  });
   
  it('draws a line chart', function () {
  drawTest([
  [0, 0],
  [240, 300],
  [480, 0]
  ]);
  });
   
  it('skips null values', function () {
  drawTest([
  [0, 0],
  [100, 50],
  [200, null],
  [300, 150],
  [400, 200],
  [480, 240]
  ]);
  });
   
  it('draws two lines', function () {
  // First line
  drawTest([
  [0, 0],
  [240, 160],
  [480, 320]
  ]);
   
  // Second Line
  options.context = a.getContext('2d');
  drawTest([
  [0, 320],
  [240, 160],
  [480, 0]
  ]);
  });
   
  it('fills a line', function () {
  drawTest([
  [0, 0],
  [240, 300],
  [480, 0]
  ], {
  fill: true
  });
  });
   
  it('draws no shadow', function () {
  drawTest([
  [0, 0],
  [240, 300],
  [480, 0]
  ], {
  shadowSize: 0
  });
  });
  });
}); });
   
/*  
describe('Data', function () {  
it('gets a range', function () {  
options.stacked = true;  
options.data = [[0, 0], [240, 160], [480, 320]];  
range = TestFlotr.graphTypes.lines.range(options);  
expect(range.min).toEqual(0);  
expect(range.max).toEqual(320);  
});  
});  
*/  
   
describe('Draw', function () {  
   
beforeEach(function () {  
this.addMatchers(imagediff.jasmine);  
a = imagediff.createCanvas(width, height);  
b = imagediff.createCanvas(width, height);  
options.context = a.getContext('2d');  
});  
   
it('draws a line chart', function () {  
drawTest([  
[0, 0],  
[240, 300],  
[480, 0]  
]);  
});  
   
it('skips null values', function () {  
drawTest([  
[0, 0],  
[100, 50],  
[200, null],  
[300, 150],  
[400, 200],  
[480, 240]  
]);  
});  
   
it('draws two lines', function () {  
// First line  
drawTest([[0, 0], [240, 160], [480, 320]]);  
   
// Second Line  
options.context = a.getContext('2d');  
drawTest([[0, 320], [240, 160], [480, 0]]);  
});  
   
it('fills a line', function () {  
drawTest([  
[0, 0],  
[240, 300],  
[480, 0]  
], {  
fill : true  
});  
});  
   
it('draws no shadow', function () {  
drawTest([  
[0, 0],  
[240, 300],  
[480, 0]  
], {  
shadowSize : 0  
});  
});  
});  
});  
}); });
   
describe('Colors', function () { describe('Colors', function () {
   
describe('Color Construction', function () { describe('Color Construction', function () {
it('should have a color class', function () { it('should have a color class', function () {
expect(TestFlotr.Color).not.toBeUndefined(); expect(TestFlotr.Color).not.toBeUndefined();
  });
   
  it('should create a color', function () {
  var color = new TestFlotr.Color(0, 0, 0, 0);
  expect(color).toBeTruthy();
  });
   
  it('should have rgba attributes', function () {
  var color = new TestFlotr.Color(0, 0, 0, 0);
  expect(color.r).toEqual(0);
  expect(color.g).toEqual(0);
  expect(color.b).toEqual(0);
  expect(color.a).toEqual(1.0);
  });
}); });
   
it('should create a color', function () { describe('Color Manipulation', function () {
var color = new TestFlotr.Color(0, 0, 0, 0);  
expect(color).toBeTruthy(); var
  color;
   
  afterEach(function () {
  color = null;
  });
   
  it('normalizes colors to upper bound', function () {
  color = new TestFlotr.Color(1000, 1000, 1000, 10);
  expect(color.r).toEqual(255);
  expect(color.g).toEqual(255);
  expect(color.b).toEqual(255);
  expect(color.a).toEqual(1.0);
  });
   
  it('normalizes colors to lower bound', function () {
  color = new TestFlotr.Color(-1000, -1000, -1000, -10);
  expect(color.r).toEqual(0);
  expect(color.g).toEqual(0);
  expect(color.b).toEqual(0);
  expect(color.a).toEqual(0.0);
  });
   
  it('scales colors', function () {
  color = new TestFlotr.Color(200, 200, 200, 1.0);
  color.scale(.5, .5, .5, .5);
  expect(color.r).toEqual(100);
  expect(color.g).toEqual(100);
  expect(color.b).toEqual(100);
  expect(color.a).toEqual(0.5);
  });
}); });
   
it('should have rgba attributes', function () { describe('Color Conversion', function () {
var color = new TestFlotr.Color(0, 0, 0, 0);  
expect(color.r).toEqual(0); var
expect(color.g).toEqual(0); color;
expect(color.b).toEqual(0);  
expect(color.a).toEqual(1.0); beforeEach(function () {
  color = new TestFlotr.Color(200, 200, 200, 1.0);
  });
  afterEach(function () {
  color = null;
  });
   
  it('should convert colors to strings, rgb', function () {
  expect(color.toString()).toEqual('rgb(200,200,200)');
  });
   
  it('should convert colors to strings, rgba', function () {
  color.a = 0.5;
  color.normalize();
  expect(color.toString()).toEqual('rgba(200,200,200,0.5)');
  });
   
  it('should clone colors', function () {
   
  var
  color2 = color.clone();
   
  expect(color.toString()).toEqual(color2.toString());
   
  color.a = 0.5;
  color.normalize();
  color2 = color.clone();
  expect(color.toString()).toEqual(color2.toString());
  });
}); });
});  
   
describe('Color Manipulation', function () {  
   
var  
color;  
   
afterEach(function () {  
color = null;  
});  
   
it('normalizes colors to upper bound', function () {  
color = new TestFlotr.Color(1000, 1000, 1000, 10);  
expect(color.r).toEqual(255);  
expect(color.g).toEqual(255);  
expect(color.b).toEqual(255);  
expect(color.a).toEqual(1.0);  
});  
   
it('normalizes colors to lower bound', function () {  
color = new TestFlotr.Color(-1000, -1000, -1000, -10);  
expect(color.r).toEqual(0);  
expect(color.g).toEqual(0);  
expect(color.b).toEqual(0);  
expect(color.a).toEqual(0.0);  
});  
   
it('scales colors', function () {  
color = new TestFlotr.Color(200, 200, 200, 1.0);  
color.scale(.5, .5, .5, .5);  
expect(color.r).toEqual(100);  
expect(color.g).toEqual(100);  
expect(color.b).toEqual(100);  
expect(color.a).toEqual(0.5);  
});  
});  
   
describe('Color Conversion', function () {  
   
var  
color;  
   
beforeEach(function () {  
color = new TestFlotr.Color(200, 200, 200, 1.0);  
});  
afterEach(function () {  
color = null;  
});  
   
it('should convert colors to strings, rgb', function () {  
expect(color.toString()).toEqual('rgb(200,200,200)');  
});  
   
it('should convert colors to strings, rgba', function () {  
color.a = 0.5;  
color.normalize();  
expect(color.toString()).toEqual('rgba(200,200,200,0.5)');  
});  
   
it('should clone colors', function () {  
   
var  
color2 = color.clone();  
   
expect(color.toString()).toEqual(color2.toString());  
   
color.a = 0.5;  
color.normalize();  
color2 = color.clone();  
expect(color.toString()).toEqual(color2.toString());  
});  
});  
}); });
   
describe('Flotr', function () { describe('Flotr', function () {
   
describe('Plots', function () { describe('Plots', function () {
   
var var
nodeA, nodeB, nodeA, nodeB,
a, b; a, b;
   
beforeEach(function () { beforeEach(function () {
   
// Add imagediff matchers // Add imagediff matchers
this.addMatchers(imagediff.jasmine); this.addMatchers(imagediff.jasmine);
   
nodeA = buildNode(); nodeA = buildNode();
nodeB = buildNode(); nodeB = buildNode();
  });
   
  afterEach(function () {
  destroyNode(nodeA);
  destroyNode(nodeB);
  a = null;
  b = null;
  Flotr = null;
  });
   
  _.each(TestFlotr.ExampleList.examples, function (example, key) {
   
  it('should draw a `' + example.name + '`line graph', function () {
   
  executeExampleTest(example, StableFlotr, nodeA);
  executeExampleTest(example, TestFlotr, nodeB);
   
  if (example.timeout) {
  waits(example.timeout);
  runs(function () {
  expect(nodeB.graph.ctx).toImageDiffEqual(nodeA.graph.ctx, example.tolerance || 0);
  });
  } else {
  expect(nodeB.graph.ctx).toImageDiffEqual(nodeA.graph.ctx, example.tolerance || 0);
  }
  });
  });
   
  // Helpers
   
  function executeExampleTest(example, flotr, node) {
  Math.seedrandom(example.key);
  Flotr = flotr;
  example.callback.apply(this, [node].concat(example.args || []));
  }
   
  function buildNode() {
  var node = document.createElement('div');
  document.body.appendChild(node);
  node.style.width = '320px';
  node.style.height = '240px';
  return node;
  }
   
  function destroyNode(node) {
  document.body.removeChild(node);
  }
}); });
   
afterEach(function () { describe('Main', function () {
destroyNode(nodeA);  
destroyNode(nodeB); it('gets a tick size', function () {
a = null; expect(TestFlotr.getTickSize).not.toBeUndefined();
b = null; expect(TestFlotr.getTickSize(10, 0, 100, 1)).toEqual(10);
Flotr = null; expect(TestFlotr.getTickSize(20, 0, 100, 1)).toEqual(5);
  expect(TestFlotr.getTickSize(5, 10, 110, 1)).toEqual(20);
  expect(TestFlotr.getTickSize(0, 0, 10, 1)).toEqual(Number.POSITIVE_INFINITY);
  expect(isNaN(TestFlotr.getTickSize(0, 0, -10, 1))).toBeTruthy();
  });
}); });
   
_.each(TestFlotr.ExampleList.examples, function (example, key) {  
   
it('should draw a `' + example.name + '`line graph', function () {  
   
executeExampleTest(example, StableFlotr, nodeA);  
executeExampleTest(example, TestFlotr, nodeB);  
   
if (example.timeout) {  
waits(example.timeout);  
runs (function () {  
expect(nodeB.graph.ctx).toImageDiffEqual(nodeA.graph.ctx, example.tolerance || 0);  
});  
} else {  
expect(nodeB.graph.ctx).toImageDiffEqual(nodeA.graph.ctx, example.tolerance || 0);  
}  
});  
});  
   
// Helpers  
   
function executeExampleTest (example, flotr, node) {  
Math.seedrandom(example.key);  
Flotr = flotr;  
example.callback.apply(this, [node].concat(example.args || []));