upjs-rails 0.11.0 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -1
- data/dist/up.js +138 -81
- data/dist/up.min.js +2 -2
- data/lib/assets/javascripts/up/boot.js.coffee +3 -0
- data/lib/assets/javascripts/up/browser.js.coffee +42 -26
- data/lib/assets/javascripts/up/flow.js.coffee +6 -4
- data/lib/assets/javascripts/up/history.js.coffee +1 -1
- data/lib/assets/javascripts/up/modal.js.coffee +4 -4
- data/lib/assets/javascripts/up/motion.js.coffee +6 -4
- data/lib/assets/javascripts/up/proxy.js.coffee +2 -1
- data/lib/assets/javascripts/up/util.js.coffee +61 -32
- data/lib/assets/javascripts/up.js.coffee +1 -10
- data/lib/upjs/rails/version.rb +1 -1
- data/spec_app/config/environments/development.rb +1 -1
- data/spec_app/spec/javascripts/helpers/reset_path.js.coffee +3 -2
- data/spec_app/spec/javascripts/up/flow_spec.js.coffee +1 -1
- data/spec_app/spec/javascripts/up/history_spec.js.coffee +53 -47
- data/spec_app/spec/javascripts/up/link_spec.js.coffee +1 -1
- data/spec_app/spec/javascripts/up/motion_spec.js.coffee +4 -4
- data/spec_app/spec/javascripts/up/proxy_spec.js.coffee +18 -9
- data/spec_app/vendor/assets/bower_components/jasmine/.bower.json +43 -7
- data/spec_app/vendor/assets/bower_components/jasmine/CONTRIBUTING.md +26 -17
- data/spec_app/vendor/assets/bower_components/jasmine/README.md +27 -18
- data/spec_app/vendor/assets/bower_components/jasmine/RELEASE.md +15 -5
- data/spec_app/vendor/assets/bower_components/jasmine/bower.json +41 -0
- data/spec_app/vendor/assets/bower_components/jasmine/lib/console/console.js +27 -3
- data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/boot.js +10 -9
- data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/example/node_example/{src → lib/jasmine_examples}/Player.js +0 -0
- data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/example/node_example/{src → lib/jasmine_examples}/Song.js +0 -0
- data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/jasmine-html.js +76 -20
- data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/jasmine.css +15 -18
- data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/jasmine.js +1399 -694
- data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/json2.js +73 -62
- data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/node_boot.js +1 -1
- data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core.js +29 -31
- data/spec_app/vendor/assets/bower_components/jasmine/package.json +18 -7
- data/spec_app/vendor/assets/bower_components/jasmine-ajax/.bower.json +11 -13
- data/spec_app/vendor/assets/bower_components/jasmine-ajax/MIT.LICENSE +1 -1
- data/spec_app/vendor/assets/bower_components/jasmine-ajax/README.markdown +198 -125
- data/spec_app/vendor/assets/bower_components/jasmine-ajax/bower.json +9 -10
- data/spec_app/vendor/assets/bower_components/jasmine-ajax/lib/mock-ajax.js +250 -59
- data/spec_app/vendor/assets/bower_components/jasmine-ajax/package.json +9 -4
- data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/2.0.2.md +50 -0
- data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/2.99.md +14 -0
- data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/3.0.md +28 -0
- data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/3.1.0.md +24 -0
- data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/3.1.1.md +23 -0
- data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/3.2.0.md +20 -0
- data/spec_app/vendor/assets/bower_components/jasmine-fixture/.bower.json +4 -4
- data/spec_app/vendor/assets/bower_components/jasmine-fixture/bower.json +1 -1
- data/spec_app/vendor/assets/bower_components/jasmine-fixture/dist/jasmine-fixture.js +4 -4
- data/spec_app/vendor/assets/bower_components/jasmine-fixture/dist/jasmine-fixture.min.js +2 -2
- data/spec_app/vendor/assets/bower_components/jasmine-jquery/.bower.json +4 -4
- data/spec_app/vendor/assets/bower_components/jasmine-jquery/Gruntfile.js +17 -1
- data/spec_app/vendor/assets/bower_components/jasmine-jquery/{MIT.LICENSE → LICENSE} +0 -0
- data/spec_app/vendor/assets/bower_components/jasmine-jquery/README.md +14 -9
- data/spec_app/vendor/assets/bower_components/jasmine-jquery/bower.json +0 -1
- data/spec_app/vendor/assets/bower_components/jasmine-jquery/lib/jasmine-jquery.js +35 -10
- data/spec_app/vendor/assets/bower_components/jasmine-jquery/package.json +33 -24
- data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/fixtures/fixture_with_checkbox_with_checked.html +6 -0
- data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/suites/jasmine-jquery-spec.js +61 -1
- data/spec_app/vendor/assets/bower_components/jquery/.bower.json +5 -4
- data/spec_app/vendor/assets/bower_components/jquery/bower.json +2 -1
- data/spec_app/vendor/assets/bower_components/jquery/dist/jquery.js +9 -4
- data/spec_app/vendor/assets/bower_components/jquery/dist/jquery.min.js +4 -4
- data/spec_app/vendor/assets/bower_components/jquery/dist/jquery.min.map +1 -1
- data/spec_app/vendor/assets/bower_components/jquery/src/core.js +6 -1
- metadata +14 -175
- data/spec_app/vendor/assets/bower_components/jasmine/.gitignore +0 -24
- data/spec_app/vendor/assets/bower_components/jasmine/.gitmodules +0 -3
- data/spec_app/vendor/assets/bower_components/jasmine/.jshintrc +0 -9
- data/spec_app/vendor/assets/bower_components/jasmine/.npmignore +0 -21
- data/spec_app/vendor/assets/bower_components/jasmine/.rspec +0 -1
- data/spec_app/vendor/assets/bower_components/jasmine/.travis.yml +0 -51
- data/spec_app/vendor/assets/bower_components/jasmine/Gemfile +0 -12
- data/spec_app/vendor/assets/bower_components/jasmine/Gruntfile.js +0 -53
- data/spec_app/vendor/assets/bower_components/jasmine/Rakefile +0 -18
- data/spec_app/vendor/assets/bower_components/jasmine/dist/jasmine-standalone-1.0.0.zip +0 -0
- data/spec_app/vendor/assets/bower_components/jasmine/dist/jasmine-standalone-1.1.0.zip +0 -0
- data/spec_app/vendor/assets/bower_components/jasmine/dist/jasmine-standalone-1.2.0.zip +0 -0
- data/spec_app/vendor/assets/bower_components/jasmine/dist/jasmine-standalone-1.3.0.zip +0 -0
- data/spec_app/vendor/assets/bower_components/jasmine/dist/jasmine-standalone-1.3.1.zip +0 -0
- data/spec_app/vendor/assets/bower_components/jasmine/dist/jasmine-standalone-2.0.0.zip +0 -0
- data/spec_app/vendor/assets/bower_components/jasmine/dist/jasmine-standalone-2.0.1.zip +0 -0
- data/spec_app/vendor/assets/bower_components/jasmine/dist/jasmine-standalone-2.0.2.zip +0 -0
- data/spec_app/vendor/assets/bower_components/jasmine/dist/jasmine-standalone-2.0.3.zip +0 -0
- data/spec_app/vendor/assets/bower_components/jasmine/grunt/config/compass.js +0 -10
- data/spec_app/vendor/assets/bower_components/jasmine/grunt/config/compress.js +0 -66
- data/spec_app/vendor/assets/bower_components/jasmine/grunt/config/concat.js +0 -61
- data/spec_app/vendor/assets/bower_components/jasmine/grunt/config/jshint.js +0 -11
- data/spec_app/vendor/assets/bower_components/jasmine/grunt/tasks/build_standalone.js +0 -31
- data/spec_app/vendor/assets/bower_components/jasmine/grunt/tasks/version.js +0 -14
- data/spec_app/vendor/assets/bower_components/jasmine/grunt/templates/SpecRunner.html.jst +0 -26
- data/spec_app/vendor/assets/bower_components/jasmine/grunt/templates/licenseBanner.js.jst +0 -22
- data/spec_app/vendor/assets/bower_components/jasmine/grunt/templates/version.rb.jst +0 -9
- data/spec_app/vendor/assets/bower_components/jasmine/images/__init__.py +0 -0
- data/spec_app/vendor/assets/bower_components/jasmine/jasmine-core.gemspec +0 -23
- data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/__init__.py +0 -1
- data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/boot/boot.js +0 -120
- data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/boot/node_boot.js +0 -19
- data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/core.py +0 -60
- data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/example/node_example/spec/PlayerSpec.js +0 -60
- data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/example/node_example/spec/SpecHelper.js +0 -15
- data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/example/spec/PlayerSpec.js +0 -58
- data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/example/spec/SpecHelper.js +0 -15
- data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/example/src/Player.js +0 -22
- data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/example/src/Song.js +0 -7
- data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/version.rb +0 -9
- data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core.rb +0 -53
- data/spec_app/vendor/assets/bower_components/jasmine/release_notes/2.0.1.md +0 -70
- data/spec_app/vendor/assets/bower_components/jasmine/release_notes/2.0.2.md +0 -25
- data/spec_app/vendor/assets/bower_components/jasmine/release_notes/20.md +0 -179
- data/spec_app/vendor/assets/bower_components/jasmine/setup.py +0 -47
- data/spec_app/vendor/assets/bower_components/jasmine/spec/console/ConsoleReporterSpec.js +0 -239
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/AnySpec.js +0 -46
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/CallTrackerSpec.js +0 -105
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/ClockSpec.js +0 -445
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/DelayedFunctionSchedulerSpec.js +0 -246
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/EnvSpec.js +0 -85
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/ExceptionFormatterSpec.js +0 -63
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/ExceptionsSpec.js +0 -68
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/ExpectationResultSpec.js +0 -61
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/ExpectationSpec.js +0 -427
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/JsApiReporterSpec.js +0 -214
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/MockDateSpec.js +0 -199
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/ObjectContainingSpec.js +0 -70
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/PrettyPrintSpec.js +0 -156
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/QueueRunnerSpec.js +0 -271
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/ReportDispatcherSpec.js +0 -40
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/SpecSpec.js +0 -260
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/SpySpec.js +0 -67
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/SpyStrategySpec.js +0 -111
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/SuiteSpec.js +0 -216
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/TimerSpec.js +0 -31
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/UtilSpec.js +0 -28
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/integration/CustomMatchersSpec.js +0 -149
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/integration/EnvSpec.js +0 -506
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/integration/SpecRunningSpec.js +0 -306
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/matchersUtilSpec.js +0 -239
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toBeCloseToSpec.js +0 -51
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toBeDefinedSpec.js +0 -18
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toBeFalsySpec.js +0 -38
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toBeGreaterThanSpec.js +0 -20
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toBeLessThanSpec.js +0 -20
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toBeNaNSpec.js +0 -37
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toBeNullSpec.js +0 -17
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toBeSpec.js +0 -17
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toBeTruthySpec.js +0 -38
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toBeUndefinedSpec.js +0 -18
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toContainSpec.js +0 -26
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toEqualSpec.js +0 -28
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toHaveBeenCalledSpec.js +0 -47
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toHaveBeenCalledWithSpec.js +0 -66
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toMatchSpec.js +0 -34
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toThrowErrorSpec.js +0 -280
- data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toThrowSpec.js +0 -99
- data/spec_app/vendor/assets/bower_components/jasmine/spec/helpers/BrowserFlags.js +0 -23
- data/spec_app/vendor/assets/bower_components/jasmine/spec/helpers/defineJasmineUnderTest.js +0 -7
- data/spec_app/vendor/assets/bower_components/jasmine/spec/helpers/nodeDefineJasmineUnderTest.js +0 -33
- data/spec_app/vendor/assets/bower_components/jasmine/spec/html/HtmlReporterSpec.js +0 -616
- data/spec_app/vendor/assets/bower_components/jasmine/spec/html/HtmlSpecFilterSpec.js +0 -18
- data/spec_app/vendor/assets/bower_components/jasmine/spec/html/MatchersHtmlSpec.js +0 -37
- data/spec_app/vendor/assets/bower_components/jasmine/spec/html/PrettyPrintHtmlSpec.js +0 -15
- data/spec_app/vendor/assets/bower_components/jasmine/spec/html/QueryStringSpec.js +0 -43
- data/spec_app/vendor/assets/bower_components/jasmine/spec/html/ResultsNodeSpec.js +0 -62
- data/spec_app/vendor/assets/bower_components/jasmine/spec/javascripts/support/jasmine_selenium_runner.yml +0 -16
- data/spec_app/vendor/assets/bower_components/jasmine/spec/performance/large_object_test.js +0 -36
- data/spec_app/vendor/assets/bower_components/jasmine/spec/performance/performance_test.js +0 -10
- data/spec_app/vendor/assets/bower_components/jasmine/spec/support/jasmine-performance.json +0 -9
- data/spec_app/vendor/assets/bower_components/jasmine/spec/support/jasmine-performance.yml +0 -9
- data/spec_app/vendor/assets/bower_components/jasmine/spec/support/jasmine.json +0 -10
- data/spec_app/vendor/assets/bower_components/jasmine/spec/support/jasmine.yml +0 -25
- data/spec_app/vendor/assets/bower_components/jasmine/src/console/ConsoleReporter.js +0 -131
- data/spec_app/vendor/assets/bower_components/jasmine/src/console/requireConsole.js +0 -12
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/Any.js +0 -36
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/CallTracker.js +0 -50
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/Clock.js +0 -113
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/DelayedFunctionScheduler.js +0 -145
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/Env.js +0 -341
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/ExceptionFormatter.js +0 -29
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/Expectation.js +0 -107
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/ExpectationResult.js +0 -45
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/JsApiReporter.js +0 -73
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/MockDate.js +0 -81
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/ObjectContaining.js +0 -34
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/PrettyPrinter.js +0 -137
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/QueueRunner.js +0 -92
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/ReportDispatcher.js +0 -35
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/Spec.js +0 -126
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js +0 -51
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/Suite.js +0 -92
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/Timer.js +0 -22
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/base.js +0 -102
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/matchersUtil.js +0 -181
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/requireMatchers.js +0 -29
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toBe.js +0 -13
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toBeCloseTo.js +0 -18
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toBeDefined.js +0 -13
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toBeFalsy.js +0 -13
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toBeGreaterThan.js +0 -15
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toBeLessThan.js +0 -14
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toBeNaN.js +0 -22
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toBeNull.js +0 -14
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toBeTruthy.js +0 -14
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toBeUndefined.js +0 -14
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toContain.js +0 -16
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toEqual.js +0 -20
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toHaveBeenCalled.js +0 -28
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toHaveBeenCalledWith.js +0 -33
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toMatch.js +0 -16
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toThrow.js +0 -46
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toThrowError.js +0 -156
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/requireCore.js +0 -39
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/requireInterface.js +0 -59
- data/spec_app/vendor/assets/bower_components/jasmine/src/core/util.js +0 -44
- data/spec_app/vendor/assets/bower_components/jasmine/src/html/HtmlReporter.js +0 -280
- data/spec_app/vendor/assets/bower_components/jasmine/src/html/HtmlSpecFilter.js +0 -12
- data/spec_app/vendor/assets/bower_components/jasmine/src/html/QueryString.js +0 -47
- data/spec_app/vendor/assets/bower_components/jasmine/src/html/ResultsNode.js +0 -19
- data/spec_app/vendor/assets/bower_components/jasmine/src/html/_HTMLReporter.scss +0 -355
- data/spec_app/vendor/assets/bower_components/jasmine/src/html/jasmine.scss +0 -1
- data/spec_app/vendor/assets/bower_components/jasmine/src/html/requireHtml.js +0 -6
- data/spec_app/vendor/assets/bower_components/jasmine/src/templates/example_project_jasmine_tags.html.erb +0 -3
- data/spec_app/vendor/assets/bower_components/jasmine/src/templates/version.js.erb +0 -7
- data/spec_app/vendor/assets/bower_components/jasmine/src/templates/version.rb.erb +0 -6
- data/spec_app/vendor/assets/bower_components/jasmine/src/version.js +0 -3
- data/spec_app/vendor/assets/bower_components/jasmine/travis-core-script.sh +0 -14
- data/spec_app/vendor/assets/bower_components/jasmine/travis-docs-script.sh +0 -5
- data/spec_app/vendor/assets/bower_components/jasmine/travis-node-script.sh +0 -6
- data/spec_app/vendor/assets/bower_components/jasmine-ajax/Gruntfile.js +0 -63
- data/spec_app/vendor/assets/bower_components/jasmine-ajax/src/boot.js +0 -11
- data/spec_app/vendor/assets/bower_components/jasmine-ajax/src/fakeRequest.js +0 -262
- data/spec_app/vendor/assets/bower_components/jasmine-ajax/src/mockAjax.js +0 -45
- data/spec_app/vendor/assets/bower_components/jasmine-ajax/src/paramParser.js +0 -56
- data/spec_app/vendor/assets/bower_components/jasmine-ajax/src/requestStub.js +0 -42
- data/spec_app/vendor/assets/bower_components/jasmine-ajax/src/requestTracker.js +0 -51
- data/spec_app/vendor/assets/bower_components/jasmine-ajax/src/requireAjax.js +0 -44
- data/spec_app/vendor/assets/bower_components/jasmine-ajax/src/stubTracker.js +0 -24
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
Copyright (c) 2008-
|
2
|
+
Copyright (c) 2008-2015 Pivotal Labs
|
3
3
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining
|
5
5
|
a copy of this software and associated documentation files (the
|
@@ -20,45 +20,62 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
20
20
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
21
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
22
|
*/
|
23
|
-
|
23
|
+
var getJasmineRequireObj = (function (jasmineGlobal) {
|
24
|
+
var jasmineRequire;
|
25
|
+
|
24
26
|
if (typeof module !== 'undefined' && module.exports) {
|
25
|
-
|
27
|
+
jasmineGlobal = global;
|
28
|
+
jasmineRequire = exports;
|
26
29
|
} else {
|
27
|
-
window.
|
28
|
-
|
30
|
+
if (typeof window !== 'undefined' && typeof window.toString === 'function' && window.toString() === '[object GjsGlobal]') {
|
31
|
+
jasmineGlobal = window;
|
32
|
+
}
|
33
|
+
jasmineRequire = jasmineGlobal.jasmineRequire = jasmineGlobal.jasmineRequire || {};
|
29
34
|
}
|
30
|
-
}
|
31
35
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
36
|
+
function getJasmineRequire() {
|
37
|
+
return jasmineRequire;
|
38
|
+
}
|
39
|
+
|
40
|
+
getJasmineRequire().core = function(jRequire) {
|
41
|
+
var j$ = {};
|
42
|
+
|
43
|
+
jRequire.base(j$, jasmineGlobal);
|
44
|
+
j$.util = jRequire.util();
|
45
|
+
j$.errors = jRequire.errors();
|
46
|
+
j$.Any = jRequire.Any(j$);
|
47
|
+
j$.Anything = jRequire.Anything(j$);
|
48
|
+
j$.CallTracker = jRequire.CallTracker();
|
49
|
+
j$.MockDate = jRequire.MockDate();
|
50
|
+
j$.Clock = jRequire.Clock();
|
51
|
+
j$.DelayedFunctionScheduler = jRequire.DelayedFunctionScheduler();
|
52
|
+
j$.Env = jRequire.Env(j$);
|
53
|
+
j$.ExceptionFormatter = jRequire.ExceptionFormatter();
|
54
|
+
j$.Expectation = jRequire.Expectation();
|
55
|
+
j$.buildExpectationResult = jRequire.buildExpectationResult();
|
56
|
+
j$.JsApiReporter = jRequire.JsApiReporter();
|
57
|
+
j$.matchersUtil = jRequire.matchersUtil(j$);
|
58
|
+
j$.ObjectContaining = jRequire.ObjectContaining(j$);
|
59
|
+
j$.ArrayContaining = jRequire.ArrayContaining(j$);
|
60
|
+
j$.pp = jRequire.pp(j$);
|
61
|
+
j$.QueueRunner = jRequire.QueueRunner(j$);
|
62
|
+
j$.ReportDispatcher = jRequire.ReportDispatcher();
|
63
|
+
j$.Spec = jRequire.Spec(j$);
|
64
|
+
j$.SpyRegistry = jRequire.SpyRegistry(j$);
|
65
|
+
j$.SpyStrategy = jRequire.SpyStrategy();
|
66
|
+
j$.StringMatching = jRequire.StringMatching(j$);
|
67
|
+
j$.Suite = jRequire.Suite(j$);
|
68
|
+
j$.Timer = jRequire.Timer();
|
69
|
+
j$.TreeProcessor = jRequire.TreeProcessor();
|
70
|
+
j$.version = jRequire.version();
|
71
|
+
|
72
|
+
j$.matchers = jRequire.requireMatchers(jRequire, j$);
|
73
|
+
|
74
|
+
return j$;
|
75
|
+
};
|
76
|
+
|
77
|
+
return getJasmineRequire;
|
78
|
+
})(this);
|
62
79
|
|
63
80
|
getJasmineRequireObj().requireMatchers = function(jRequire, j$) {
|
64
81
|
var availableMatchers = [
|
@@ -90,108 +107,128 @@ getJasmineRequireObj().requireMatchers = function(jRequire, j$) {
|
|
90
107
|
return matchers;
|
91
108
|
};
|
92
109
|
|
93
|
-
getJasmineRequireObj().base = (
|
94
|
-
|
95
|
-
|
96
|
-
}
|
110
|
+
getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
111
|
+
j$.unimplementedMethod_ = function() {
|
112
|
+
throw new Error('unimplemented method');
|
113
|
+
};
|
97
114
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
};
|
115
|
+
j$.MAX_PRETTY_PRINT_DEPTH = 40;
|
116
|
+
j$.MAX_PRETTY_PRINT_ARRAY_LENGTH = 100;
|
117
|
+
j$.DEFAULT_TIMEOUT_INTERVAL = 5000;
|
102
118
|
|
103
|
-
|
104
|
-
|
105
|
-
|
119
|
+
j$.getGlobal = function() {
|
120
|
+
return jasmineGlobal;
|
121
|
+
};
|
106
122
|
|
107
|
-
|
108
|
-
|
109
|
-
|
123
|
+
j$.getEnv = function(options) {
|
124
|
+
var env = j$.currentEnv_ = j$.currentEnv_ || new j$.Env(options);
|
125
|
+
//jasmine. singletons in here (setTimeout blah blah).
|
126
|
+
return env;
|
127
|
+
};
|
110
128
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
return env;
|
115
|
-
};
|
129
|
+
j$.isArray_ = function(value) {
|
130
|
+
return j$.isA_('Array', value);
|
131
|
+
};
|
116
132
|
|
117
|
-
|
118
|
-
|
119
|
-
|
133
|
+
j$.isString_ = function(value) {
|
134
|
+
return j$.isA_('String', value);
|
135
|
+
};
|
120
136
|
|
121
|
-
|
122
|
-
|
123
|
-
|
137
|
+
j$.isNumber_ = function(value) {
|
138
|
+
return j$.isA_('Number', value);
|
139
|
+
};
|
124
140
|
|
125
|
-
|
126
|
-
|
127
|
-
|
141
|
+
j$.isA_ = function(typeName, value) {
|
142
|
+
return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
|
143
|
+
};
|
128
144
|
|
129
|
-
|
130
|
-
|
131
|
-
|
145
|
+
j$.isDomNode = function(obj) {
|
146
|
+
return obj.nodeType > 0;
|
147
|
+
};
|
132
148
|
|
133
|
-
|
134
|
-
|
135
|
-
|
149
|
+
j$.fnNameFor = function(func) {
|
150
|
+
return func.name || func.toString().match(/^\s*function\s*(\w*)\s*\(/)[1];
|
151
|
+
};
|
136
152
|
|
137
|
-
|
138
|
-
|
139
|
-
|
153
|
+
j$.any = function(clazz) {
|
154
|
+
return new j$.Any(clazz);
|
155
|
+
};
|
140
156
|
|
141
|
-
|
142
|
-
|
143
|
-
|
157
|
+
j$.anything = function() {
|
158
|
+
return new j$.Anything();
|
159
|
+
};
|
144
160
|
|
145
|
-
|
161
|
+
j$.objectContaining = function(sample) {
|
162
|
+
return new j$.ObjectContaining(sample);
|
163
|
+
};
|
146
164
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
165
|
+
j$.stringMatching = function(expected) {
|
166
|
+
return new j$.StringMatching(expected);
|
167
|
+
};
|
168
|
+
|
169
|
+
j$.arrayContaining = function(sample) {
|
170
|
+
return new j$.ArrayContaining(sample);
|
171
|
+
};
|
172
|
+
|
173
|
+
j$.createSpy = function(name, originalFn) {
|
174
|
+
|
175
|
+
var spyStrategy = new j$.SpyStrategy({
|
176
|
+
name: name,
|
177
|
+
fn: originalFn,
|
178
|
+
getSpy: function() { return spy; }
|
179
|
+
}),
|
180
|
+
callTracker = new j$.CallTracker(),
|
181
|
+
spy = function() {
|
182
|
+
var callData = {
|
183
|
+
object: this,
|
184
|
+
args: Array.prototype.slice.apply(arguments)
|
159
185
|
};
|
160
186
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
187
|
+
callTracker.track(callData);
|
188
|
+
var returnValue = spyStrategy.exec.apply(this, arguments);
|
189
|
+
callData.returnValue = returnValue;
|
190
|
+
|
191
|
+
return returnValue;
|
192
|
+
};
|
165
193
|
|
166
|
-
|
194
|
+
for (var prop in originalFn) {
|
195
|
+
if (prop === 'and' || prop === 'calls') {
|
196
|
+
throw new Error('Jasmine spies would overwrite the \'and\' and \'calls\' properties on the object being spied upon');
|
167
197
|
}
|
168
198
|
|
169
|
-
spy
|
170
|
-
|
199
|
+
spy[prop] = originalFn[prop];
|
200
|
+
}
|
171
201
|
|
172
|
-
|
173
|
-
|
202
|
+
spy.and = spyStrategy;
|
203
|
+
spy.calls = callTracker;
|
174
204
|
|
175
|
-
|
176
|
-
|
177
|
-
return false;
|
178
|
-
}
|
179
|
-
return putativeSpy.and instanceof j$.SpyStrategy &&
|
180
|
-
putativeSpy.calls instanceof j$.CallTracker;
|
181
|
-
};
|
205
|
+
return spy;
|
206
|
+
};
|
182
207
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
obj[methodNames[i]] = j$.createSpy(baseName + '.' + methodNames[i]);
|
190
|
-
}
|
191
|
-
return obj;
|
192
|
-
};
|
208
|
+
j$.isSpy = function(putativeSpy) {
|
209
|
+
if (!putativeSpy) {
|
210
|
+
return false;
|
211
|
+
}
|
212
|
+
return putativeSpy.and instanceof j$.SpyStrategy &&
|
213
|
+
putativeSpy.calls instanceof j$.CallTracker;
|
193
214
|
};
|
194
|
-
|
215
|
+
|
216
|
+
j$.createSpyObj = function(baseName, methodNames) {
|
217
|
+
if (j$.isArray_(baseName) && j$.util.isUndefined(methodNames)) {
|
218
|
+
methodNames = baseName;
|
219
|
+
baseName = 'unknown';
|
220
|
+
}
|
221
|
+
|
222
|
+
if (!j$.isArray_(methodNames) || methodNames.length === 0) {
|
223
|
+
throw 'createSpyObj requires a non-empty array of method names to create spies for';
|
224
|
+
}
|
225
|
+
var obj = {};
|
226
|
+
for (var i = 0; i < methodNames.length; i++) {
|
227
|
+
obj[methodNames[i]] = j$.createSpy(baseName + '.' + methodNames[i]);
|
228
|
+
}
|
229
|
+
return obj;
|
230
|
+
};
|
231
|
+
};
|
195
232
|
|
196
233
|
getJasmineRequireObj().util = function() {
|
197
234
|
|
@@ -228,13 +265,28 @@ getJasmineRequireObj().util = function() {
|
|
228
265
|
util.arrayContains = function(array, search) {
|
229
266
|
var i = array.length;
|
230
267
|
while (i--) {
|
231
|
-
if (array[i]
|
268
|
+
if (array[i] === search) {
|
232
269
|
return true;
|
233
270
|
}
|
234
271
|
}
|
235
272
|
return false;
|
236
273
|
};
|
237
274
|
|
275
|
+
util.clone = function(obj) {
|
276
|
+
if (Object.prototype.toString.apply(obj) === '[object Array]') {
|
277
|
+
return obj.slice();
|
278
|
+
}
|
279
|
+
|
280
|
+
var cloned = {};
|
281
|
+
for (var prop in obj) {
|
282
|
+
if (obj.hasOwnProperty(prop)) {
|
283
|
+
cloned[prop] = obj[prop];
|
284
|
+
}
|
285
|
+
}
|
286
|
+
|
287
|
+
return cloned;
|
288
|
+
};
|
289
|
+
|
238
290
|
return util;
|
239
291
|
};
|
240
292
|
|
@@ -244,17 +296,17 @@ getJasmineRequireObj().Spec = function(j$) {
|
|
244
296
|
this.resultCallback = attrs.resultCallback || function() {};
|
245
297
|
this.id = attrs.id;
|
246
298
|
this.description = attrs.description || '';
|
247
|
-
this.
|
248
|
-
this.
|
249
|
-
this.
|
299
|
+
this.queueableFn = attrs.queueableFn;
|
300
|
+
this.beforeAndAfterFns = attrs.beforeAndAfterFns || function() { return {befores: [], afters: []}; };
|
301
|
+
this.userContext = attrs.userContext || function() { return {}; };
|
250
302
|
this.onStart = attrs.onStart || function() {};
|
251
|
-
this.exceptionFormatter = attrs.exceptionFormatter || function() {};
|
252
303
|
this.getSpecName = attrs.getSpecName || function() { return ''; };
|
253
304
|
this.expectationResultFactory = attrs.expectationResultFactory || function() { };
|
254
305
|
this.queueRunnerFactory = attrs.queueRunnerFactory || function() {};
|
255
306
|
this.catchingExceptions = attrs.catchingExceptions || function() { return true; };
|
307
|
+
this.throwOnExpectationFailure = !!attrs.throwOnExpectationFailure;
|
256
308
|
|
257
|
-
if (!this.fn) {
|
309
|
+
if (!this.queueableFn.fn) {
|
258
310
|
this.pend();
|
259
311
|
}
|
260
312
|
|
@@ -263,16 +315,21 @@ getJasmineRequireObj().Spec = function(j$) {
|
|
263
315
|
description: this.description,
|
264
316
|
fullName: this.getFullName(),
|
265
317
|
failedExpectations: [],
|
266
|
-
passedExpectations: []
|
318
|
+
passedExpectations: [],
|
319
|
+
pendingReason: ''
|
267
320
|
};
|
268
321
|
}
|
269
322
|
|
270
|
-
Spec.prototype.addExpectationResult = function(passed, data) {
|
323
|
+
Spec.prototype.addExpectationResult = function(passed, data, isError) {
|
271
324
|
var expectationResult = this.expectationResultFactory(data);
|
272
325
|
if (passed) {
|
273
326
|
this.result.passedExpectations.push(expectationResult);
|
274
327
|
} else {
|
275
328
|
this.result.failedExpectations.push(expectationResult);
|
329
|
+
|
330
|
+
if (this.throwOnExpectationFailure && !isError) {
|
331
|
+
throw new j$.errors.ExpectationFailed();
|
332
|
+
}
|
276
333
|
}
|
277
334
|
};
|
278
335
|
|
@@ -280,42 +337,28 @@ getJasmineRequireObj().Spec = function(j$) {
|
|
280
337
|
return this.expectationFactory(actual, this);
|
281
338
|
};
|
282
339
|
|
283
|
-
Spec.prototype.execute = function(onComplete) {
|
340
|
+
Spec.prototype.execute = function(onComplete, enabled) {
|
284
341
|
var self = this;
|
285
342
|
|
286
343
|
this.onStart(this);
|
287
344
|
|
288
|
-
if (this.
|
289
|
-
complete();
|
345
|
+
if (!this.isExecutable() || this.markedPending || enabled === false) {
|
346
|
+
complete(enabled);
|
290
347
|
return;
|
291
348
|
}
|
292
349
|
|
293
|
-
var
|
350
|
+
var fns = this.beforeAndAfterFns();
|
351
|
+
var allFns = fns.befores.concat(this.queueableFn).concat(fns.afters);
|
294
352
|
|
295
353
|
this.queueRunnerFactory({
|
296
|
-
|
297
|
-
onException: onException,
|
354
|
+
queueableFns: allFns,
|
355
|
+
onException: function() { self.onException.apply(self, arguments); },
|
298
356
|
onComplete: complete,
|
299
|
-
|
357
|
+
userContext: this.userContext()
|
300
358
|
});
|
301
359
|
|
302
|
-
function
|
303
|
-
|
304
|
-
self.pend();
|
305
|
-
return;
|
306
|
-
}
|
307
|
-
|
308
|
-
self.addExpectationResult(false, {
|
309
|
-
matcherName: '',
|
310
|
-
passed: false,
|
311
|
-
expected: '',
|
312
|
-
actual: '',
|
313
|
-
error: e
|
314
|
-
});
|
315
|
-
}
|
316
|
-
|
317
|
-
function complete() {
|
318
|
-
self.result.status = self.status();
|
360
|
+
function complete(enabledAgain) {
|
361
|
+
self.result.status = self.status(enabledAgain);
|
319
362
|
self.resultCallback(self.result);
|
320
363
|
|
321
364
|
if (onComplete) {
|
@@ -324,16 +367,43 @@ getJasmineRequireObj().Spec = function(j$) {
|
|
324
367
|
}
|
325
368
|
};
|
326
369
|
|
370
|
+
Spec.prototype.onException = function onException(e) {
|
371
|
+
if (Spec.isPendingSpecException(e)) {
|
372
|
+
this.pend(extractCustomPendingMessage(e));
|
373
|
+
return;
|
374
|
+
}
|
375
|
+
|
376
|
+
if (e instanceof j$.errors.ExpectationFailed) {
|
377
|
+
return;
|
378
|
+
}
|
379
|
+
|
380
|
+
this.addExpectationResult(false, {
|
381
|
+
matcherName: '',
|
382
|
+
passed: false,
|
383
|
+
expected: '',
|
384
|
+
actual: '',
|
385
|
+
error: e
|
386
|
+
}, true);
|
387
|
+
};
|
388
|
+
|
327
389
|
Spec.prototype.disable = function() {
|
328
390
|
this.disabled = true;
|
329
391
|
};
|
330
392
|
|
331
|
-
Spec.prototype.pend = function() {
|
393
|
+
Spec.prototype.pend = function(message) {
|
332
394
|
this.markedPending = true;
|
395
|
+
if (message) {
|
396
|
+
this.result.pendingReason = message;
|
397
|
+
}
|
333
398
|
};
|
334
399
|
|
335
|
-
Spec.prototype.
|
336
|
-
|
400
|
+
Spec.prototype.getResult = function() {
|
401
|
+
this.result.status = this.status();
|
402
|
+
return this.result;
|
403
|
+
};
|
404
|
+
|
405
|
+
Spec.prototype.status = function(enabled) {
|
406
|
+
if (this.disabled || enabled === false) {
|
337
407
|
return 'disabled';
|
338
408
|
}
|
339
409
|
|
@@ -348,10 +418,22 @@ getJasmineRequireObj().Spec = function(j$) {
|
|
348
418
|
}
|
349
419
|
};
|
350
420
|
|
421
|
+
Spec.prototype.isExecutable = function() {
|
422
|
+
return !this.disabled;
|
423
|
+
};
|
424
|
+
|
351
425
|
Spec.prototype.getFullName = function() {
|
352
426
|
return this.getSpecName(this);
|
353
427
|
};
|
354
428
|
|
429
|
+
var extractCustomPendingMessage = function(e) {
|
430
|
+
var fullMessage = e.toString(),
|
431
|
+
boilerplateStart = fullMessage.indexOf(Spec.pendingSpecExceptionMessage),
|
432
|
+
boilerplateEnd = boilerplateStart + Spec.pendingSpecExceptionMessage.length;
|
433
|
+
|
434
|
+
return fullMessage.substr(boilerplateEnd);
|
435
|
+
};
|
436
|
+
|
355
437
|
Spec.pendingSpecExceptionMessage = '=> marked Pending';
|
356
438
|
|
357
439
|
Spec.isPendingSpecException = function(e) {
|
@@ -378,14 +460,23 @@ getJasmineRequireObj().Env = function(j$) {
|
|
378
460
|
|
379
461
|
var realSetTimeout = j$.getGlobal().setTimeout;
|
380
462
|
var realClearTimeout = j$.getGlobal().clearTimeout;
|
381
|
-
this.clock = new j$.Clock(global, new j$.DelayedFunctionScheduler(), new j$.MockDate(global));
|
463
|
+
this.clock = new j$.Clock(global, function () { return new j$.DelayedFunctionScheduler(); }, new j$.MockDate(global));
|
382
464
|
|
383
465
|
var runnableLookupTable = {};
|
384
|
-
|
385
|
-
var spies = [];
|
466
|
+
var runnableResources = {};
|
386
467
|
|
387
468
|
var currentSpec = null;
|
388
|
-
var
|
469
|
+
var currentlyExecutingSuites = [];
|
470
|
+
var currentDeclarationSuite = null;
|
471
|
+
var throwOnExpectationFailure = false;
|
472
|
+
|
473
|
+
var currentSuite = function() {
|
474
|
+
return currentlyExecutingSuites[currentlyExecutingSuites.length - 1];
|
475
|
+
};
|
476
|
+
|
477
|
+
var currentRunnable = function() {
|
478
|
+
return currentSpec || currentSuite();
|
479
|
+
};
|
389
480
|
|
390
481
|
var reporter = new j$.ReportDispatcher([
|
391
482
|
'jasmineStarted',
|
@@ -400,11 +491,21 @@ getJasmineRequireObj().Env = function(j$) {
|
|
400
491
|
return true;
|
401
492
|
};
|
402
493
|
|
403
|
-
var equalityTesters = [];
|
404
|
-
|
405
|
-
var customEqualityTesters = [];
|
406
494
|
this.addCustomEqualityTester = function(tester) {
|
407
|
-
|
495
|
+
if(!currentRunnable()) {
|
496
|
+
throw new Error('Custom Equalities must be added in a before function or a spec');
|
497
|
+
}
|
498
|
+
runnableResources[currentRunnable().id].customEqualityTesters.push(tester);
|
499
|
+
};
|
500
|
+
|
501
|
+
this.addMatchers = function(matchersToAdd) {
|
502
|
+
if(!currentRunnable()) {
|
503
|
+
throw new Error('Matchers must be added in a before function or a spec');
|
504
|
+
}
|
505
|
+
var customMatchers = runnableResources[currentRunnable().id].customMatchers;
|
506
|
+
for (var matcherName in matchersToAdd) {
|
507
|
+
customMatchers[matcherName] = matchersToAdd[matcherName];
|
508
|
+
}
|
408
509
|
};
|
409
510
|
|
410
511
|
j$.Expectation.addCoreMatchers(j$.matchers);
|
@@ -422,7 +523,8 @@ getJasmineRequireObj().Env = function(j$) {
|
|
422
523
|
var expectationFactory = function(actual, spec) {
|
423
524
|
return j$.Expectation.Factory({
|
424
525
|
util: j$.matchersUtil,
|
425
|
-
customEqualityTesters: customEqualityTesters,
|
526
|
+
customEqualityTesters: runnableResources[spec.id].customEqualityTesters,
|
527
|
+
customMatchers: runnableResources[spec.id].customMatchers,
|
426
528
|
actual: actual,
|
427
529
|
addExpectationResult: addExpectationResult
|
428
530
|
});
|
@@ -432,30 +534,38 @@ getJasmineRequireObj().Env = function(j$) {
|
|
432
534
|
}
|
433
535
|
};
|
434
536
|
|
435
|
-
var
|
436
|
-
|
437
|
-
|
537
|
+
var defaultResourcesForRunnable = function(id, parentRunnableId) {
|
538
|
+
var resources = {spies: [], customEqualityTesters: [], customMatchers: {}};
|
539
|
+
|
540
|
+
if(runnableResources[parentRunnableId]){
|
541
|
+
resources.customEqualityTesters = j$.util.clone(runnableResources[parentRunnableId].customEqualityTesters);
|
542
|
+
resources.customMatchers = j$.util.clone(runnableResources[parentRunnableId].customMatchers);
|
543
|
+
}
|
544
|
+
|
545
|
+
runnableResources[id] = resources;
|
438
546
|
};
|
439
547
|
|
440
|
-
var
|
441
|
-
|
442
|
-
|
443
|
-
while(suite) {
|
444
|
-
befores = befores.concat(suite.beforeFns);
|
445
|
-
suite = suite.parentSuite;
|
446
|
-
}
|
447
|
-
return befores.reverse();
|
448
|
-
};
|
548
|
+
var clearResourcesForRunnable = function(id) {
|
549
|
+
spyRegistry.clearSpies();
|
550
|
+
delete runnableResources[id];
|
449
551
|
};
|
450
552
|
|
451
|
-
var
|
553
|
+
var beforeAndAfterFns = function(suite) {
|
452
554
|
return function() {
|
453
|
-
var
|
555
|
+
var befores = [],
|
556
|
+
afters = [];
|
557
|
+
|
454
558
|
while(suite) {
|
559
|
+
befores = befores.concat(suite.beforeFns);
|
455
560
|
afters = afters.concat(suite.afterFns);
|
561
|
+
|
456
562
|
suite = suite.parentSuite;
|
457
563
|
}
|
458
|
-
|
564
|
+
|
565
|
+
return {
|
566
|
+
befores: befores.reverse(),
|
567
|
+
afters: afters
|
568
|
+
};
|
459
569
|
};
|
460
570
|
};
|
461
571
|
|
@@ -500,10 +610,19 @@ getJasmineRequireObj().Env = function(j$) {
|
|
500
610
|
return j$.Spec.isPendingSpecException(e) || catchExceptions;
|
501
611
|
};
|
502
612
|
|
613
|
+
this.throwOnExpectationFailure = function(value) {
|
614
|
+
throwOnExpectationFailure = !!value;
|
615
|
+
};
|
616
|
+
|
617
|
+
this.throwingExpectationFailures = function() {
|
618
|
+
return throwOnExpectationFailure;
|
619
|
+
};
|
620
|
+
|
503
621
|
var queueRunnerFactory = function(options) {
|
504
622
|
options.catchException = catchException;
|
505
623
|
options.clearStack = options.clearStack || clearStack;
|
506
|
-
options.
|
624
|
+
options.timeout = {setTimeout: realSetTimeout, clearTimeout: realClearTimeout};
|
625
|
+
options.fail = self.fail;
|
507
626
|
|
508
627
|
new j$.QueueRunner(options).execute();
|
509
628
|
};
|
@@ -512,66 +631,66 @@ getJasmineRequireObj().Env = function(j$) {
|
|
512
631
|
env: this,
|
513
632
|
id: getNextSuiteId(),
|
514
633
|
description: 'Jasmine__TopLevel__Suite',
|
515
|
-
queueRunner: queueRunnerFactory
|
516
|
-
resultCallback: function() {} // TODO - hook this up
|
634
|
+
queueRunner: queueRunnerFactory
|
517
635
|
});
|
518
636
|
runnableLookupTable[topSuite.id] = topSuite;
|
519
|
-
|
637
|
+
defaultResourcesForRunnable(topSuite.id);
|
638
|
+
currentDeclarationSuite = topSuite;
|
520
639
|
|
521
640
|
this.topSuite = function() {
|
522
641
|
return topSuite;
|
523
642
|
};
|
524
643
|
|
525
644
|
this.execute = function(runnablesToRun) {
|
526
|
-
runnablesToRun
|
645
|
+
if(!runnablesToRun) {
|
646
|
+
if (focusedRunnables.length) {
|
647
|
+
runnablesToRun = focusedRunnables;
|
648
|
+
} else {
|
649
|
+
runnablesToRun = [topSuite.id];
|
650
|
+
}
|
651
|
+
}
|
652
|
+
var processor = new j$.TreeProcessor({
|
653
|
+
tree: topSuite,
|
654
|
+
runnableIds: runnablesToRun,
|
655
|
+
queueRunnerFactory: queueRunnerFactory,
|
656
|
+
nodeStart: function(suite) {
|
657
|
+
currentlyExecutingSuites.push(suite);
|
658
|
+
defaultResourcesForRunnable(suite.id, suite.parentSuite.id);
|
659
|
+
reporter.suiteStarted(suite.result);
|
660
|
+
},
|
661
|
+
nodeComplete: function(suite, result) {
|
662
|
+
if (!suite.disabled) {
|
663
|
+
clearResourcesForRunnable(suite.id);
|
664
|
+
}
|
665
|
+
currentlyExecutingSuites.pop();
|
666
|
+
reporter.suiteDone(result);
|
667
|
+
}
|
668
|
+
});
|
527
669
|
|
528
|
-
|
529
|
-
|
530
|
-
var runnable = runnableLookupTable[runnablesToRun[i]];
|
531
|
-
allFns.push((function(runnable) { return function(done) { runnable.execute(done); }; })(runnable));
|
670
|
+
if(!processor.processTree().valid) {
|
671
|
+
throw new Error('Invalid order: would cause a beforeAll or afterAll to be run multiple times');
|
532
672
|
}
|
533
673
|
|
534
674
|
reporter.jasmineStarted({
|
535
675
|
totalSpecsDefined: totalSpecsDefined
|
536
676
|
});
|
537
677
|
|
538
|
-
|
678
|
+
processor.execute(reporter.jasmineDone);
|
539
679
|
};
|
540
680
|
|
541
681
|
this.addReporter = function(reporterToAdd) {
|
542
682
|
reporter.addReporter(reporterToAdd);
|
543
683
|
};
|
544
684
|
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
this.spyOn = function(obj, methodName) {
|
550
|
-
if (j$.util.isUndefined(obj)) {
|
551
|
-
throw new Error('spyOn could not find an object to spy upon for ' + methodName + '()');
|
552
|
-
}
|
553
|
-
|
554
|
-
if (j$.util.isUndefined(obj[methodName])) {
|
555
|
-
throw new Error(methodName + '() method does not exist');
|
556
|
-
}
|
557
|
-
|
558
|
-
if (obj[methodName] && j$.isSpy(obj[methodName])) {
|
559
|
-
//TODO?: should this return the current spy? Downside: may cause user confusion about spy state
|
560
|
-
throw new Error(methodName + ' has already been spied upon');
|
685
|
+
var spyRegistry = new j$.SpyRegistry({currentSpies: function() {
|
686
|
+
if(!currentRunnable()) {
|
687
|
+
throw new Error('Spies must be created in a before function or a spec');
|
561
688
|
}
|
689
|
+
return runnableResources[currentRunnable().id].spies;
|
690
|
+
}});
|
562
691
|
|
563
|
-
|
564
|
-
|
565
|
-
spies.push({
|
566
|
-
spy: spy,
|
567
|
-
baseObj: obj,
|
568
|
-
methodName: methodName,
|
569
|
-
originalValue: obj[methodName]
|
570
|
-
});
|
571
|
-
|
572
|
-
obj[methodName] = spy;
|
573
|
-
|
574
|
-
return spy;
|
692
|
+
this.spyOn = function() {
|
693
|
+
return spyRegistry.spyOn.apply(spyRegistry, arguments);
|
575
694
|
};
|
576
695
|
|
577
696
|
var suiteFactory = function(description) {
|
@@ -579,12 +698,10 @@ getJasmineRequireObj().Env = function(j$) {
|
|
579
698
|
env: self,
|
580
699
|
id: getNextSuiteId(),
|
581
700
|
description: description,
|
582
|
-
parentSuite:
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
reporter.suiteDone(attrs);
|
587
|
-
}
|
701
|
+
parentSuite: currentDeclarationSuite,
|
702
|
+
expectationFactory: expectationFactory,
|
703
|
+
expectationResultFactory: expectationResultFactory,
|
704
|
+
throwOnExpectationFailure: throwOnExpectationFailure
|
588
705
|
});
|
589
706
|
|
590
707
|
runnableLookupTable[suite.id] = suite;
|
@@ -593,10 +710,33 @@ getJasmineRequireObj().Env = function(j$) {
|
|
593
710
|
|
594
711
|
this.describe = function(description, specDefinitions) {
|
595
712
|
var suite = suiteFactory(description);
|
713
|
+
addSpecsToSuite(suite, specDefinitions);
|
714
|
+
return suite;
|
715
|
+
};
|
716
|
+
|
717
|
+
this.xdescribe = function(description, specDefinitions) {
|
718
|
+
var suite = this.describe(description, specDefinitions);
|
719
|
+
suite.disable();
|
720
|
+
return suite;
|
721
|
+
};
|
722
|
+
|
723
|
+
var focusedRunnables = [];
|
724
|
+
|
725
|
+
this.fdescribe = function(description, specDefinitions) {
|
726
|
+
var suite = suiteFactory(description);
|
727
|
+
suite.isFocused = true;
|
728
|
+
|
729
|
+
focusedRunnables.push(suite.id);
|
730
|
+
unfocusAncestor();
|
731
|
+
addSpecsToSuite(suite, specDefinitions);
|
732
|
+
|
733
|
+
return suite;
|
734
|
+
};
|
596
735
|
|
597
|
-
|
736
|
+
function addSpecsToSuite(suite, specDefinitions) {
|
737
|
+
var parentSuite = currentDeclarationSuite;
|
598
738
|
parentSuite.addChild(suite);
|
599
|
-
|
739
|
+
currentDeclarationSuite = suite;
|
600
740
|
|
601
741
|
var declarationError = null;
|
602
742
|
try {
|
@@ -606,31 +746,43 @@ getJasmineRequireObj().Env = function(j$) {
|
|
606
746
|
}
|
607
747
|
|
608
748
|
if (declarationError) {
|
609
|
-
|
749
|
+
self.it('encountered a declaration exception', function() {
|
610
750
|
throw declarationError;
|
611
751
|
});
|
612
752
|
}
|
613
753
|
|
614
|
-
|
754
|
+
currentDeclarationSuite = parentSuite;
|
755
|
+
}
|
615
756
|
|
616
|
-
|
617
|
-
|
757
|
+
function findFocusedAncestor(suite) {
|
758
|
+
while (suite) {
|
759
|
+
if (suite.isFocused) {
|
760
|
+
return suite.id;
|
761
|
+
}
|
762
|
+
suite = suite.parentSuite;
|
763
|
+
}
|
618
764
|
|
619
|
-
|
620
|
-
|
621
|
-
suite.disable();
|
622
|
-
return suite;
|
623
|
-
};
|
765
|
+
return null;
|
766
|
+
}
|
624
767
|
|
625
|
-
|
626
|
-
|
768
|
+
function unfocusAncestor() {
|
769
|
+
var focusedAncestor = findFocusedAncestor(currentDeclarationSuite);
|
770
|
+
if (focusedAncestor) {
|
771
|
+
for (var i = 0; i < focusedRunnables.length; i++) {
|
772
|
+
if (focusedRunnables[i] === focusedAncestor) {
|
773
|
+
focusedRunnables.splice(i, 1);
|
774
|
+
break;
|
775
|
+
}
|
776
|
+
}
|
777
|
+
}
|
778
|
+
}
|
627
779
|
|
780
|
+
var specFactory = function(description, fn, suite, timeout) {
|
781
|
+
totalSpecsDefined++;
|
628
782
|
var spec = new j$.Spec({
|
629
783
|
id: getNextSpecId(),
|
630
|
-
|
631
|
-
afterFns: afterFns(suite),
|
784
|
+
beforeAndAfterFns: beforeAndAfterFns(suite),
|
632
785
|
expectationFactory: expectationFactory,
|
633
|
-
exceptionFormatter: exceptionFormatter,
|
634
786
|
resultCallback: specResultCallback,
|
635
787
|
getSpecName: function(spec) {
|
636
788
|
return getSpecName(spec, suite);
|
@@ -639,7 +791,12 @@ getJasmineRequireObj().Env = function(j$) {
|
|
639
791
|
description: description,
|
640
792
|
expectationResultFactory: expectationResultFactory,
|
641
793
|
queueRunnerFactory: queueRunnerFactory,
|
642
|
-
|
794
|
+
userContext: function() { return suite.clonedSharedUserContext(); },
|
795
|
+
queueableFn: {
|
796
|
+
fn: fn,
|
797
|
+
timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
|
798
|
+
},
|
799
|
+
throwOnExpectationFailure: throwOnExpectationFailure
|
643
800
|
});
|
644
801
|
|
645
802
|
runnableLookupTable[spec.id] = spec;
|
@@ -650,57 +807,98 @@ getJasmineRequireObj().Env = function(j$) {
|
|
650
807
|
|
651
808
|
return spec;
|
652
809
|
|
653
|
-
function removeAllSpies() {
|
654
|
-
for (var i = 0; i < spies.length; i++) {
|
655
|
-
var spyEntry = spies[i];
|
656
|
-
spyEntry.baseObj[spyEntry.methodName] = spyEntry.originalValue;
|
657
|
-
}
|
658
|
-
spies = [];
|
659
|
-
}
|
660
|
-
|
661
810
|
function specResultCallback(result) {
|
662
|
-
|
663
|
-
j$.Expectation.resetMatchers();
|
664
|
-
customEqualityTesters = [];
|
811
|
+
clearResourcesForRunnable(spec.id);
|
665
812
|
currentSpec = null;
|
666
813
|
reporter.specDone(result);
|
667
814
|
}
|
668
|
-
};
|
669
815
|
|
670
|
-
|
671
|
-
|
816
|
+
function specStarted(spec) {
|
817
|
+
currentSpec = spec;
|
818
|
+
defaultResourcesForRunnable(spec.id, suite.id);
|
819
|
+
reporter.specStarted(spec.result);
|
820
|
+
}
|
672
821
|
};
|
673
822
|
|
674
|
-
this.it = function(description, fn) {
|
675
|
-
var spec = specFactory(description, fn,
|
676
|
-
|
823
|
+
this.it = function(description, fn, timeout) {
|
824
|
+
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
825
|
+
currentDeclarationSuite.addChild(spec);
|
677
826
|
return spec;
|
678
827
|
};
|
679
828
|
|
680
|
-
this.xit = function(
|
681
|
-
var spec = this.it(
|
829
|
+
this.xit = function() {
|
830
|
+
var spec = this.it.apply(this, arguments);
|
682
831
|
spec.pend();
|
683
832
|
return spec;
|
684
833
|
};
|
685
834
|
|
835
|
+
this.fit = function(){
|
836
|
+
var spec = this.it.apply(this, arguments);
|
837
|
+
|
838
|
+
focusedRunnables.push(spec.id);
|
839
|
+
unfocusAncestor();
|
840
|
+
return spec;
|
841
|
+
};
|
842
|
+
|
686
843
|
this.expect = function(actual) {
|
687
|
-
if (!
|
844
|
+
if (!currentRunnable()) {
|
688
845
|
throw new Error('\'expect\' was used when there was no current spec, this could be because an asynchronous test timed out');
|
689
846
|
}
|
690
847
|
|
691
|
-
return
|
848
|
+
return currentRunnable().expect(actual);
|
692
849
|
};
|
693
850
|
|
694
|
-
this.beforeEach = function(beforeEachFunction) {
|
695
|
-
|
851
|
+
this.beforeEach = function(beforeEachFunction, timeout) {
|
852
|
+
currentDeclarationSuite.beforeEach({
|
853
|
+
fn: beforeEachFunction,
|
854
|
+
timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
|
855
|
+
});
|
856
|
+
};
|
857
|
+
|
858
|
+
this.beforeAll = function(beforeAllFunction, timeout) {
|
859
|
+
currentDeclarationSuite.beforeAll({
|
860
|
+
fn: beforeAllFunction,
|
861
|
+
timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
|
862
|
+
});
|
863
|
+
};
|
864
|
+
|
865
|
+
this.afterEach = function(afterEachFunction, timeout) {
|
866
|
+
currentDeclarationSuite.afterEach({
|
867
|
+
fn: afterEachFunction,
|
868
|
+
timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
|
869
|
+
});
|
870
|
+
};
|
871
|
+
|
872
|
+
this.afterAll = function(afterAllFunction, timeout) {
|
873
|
+
currentDeclarationSuite.afterAll({
|
874
|
+
fn: afterAllFunction,
|
875
|
+
timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
|
876
|
+
});
|
696
877
|
};
|
697
878
|
|
698
|
-
this.
|
699
|
-
|
879
|
+
this.pending = function(message) {
|
880
|
+
var fullMessage = j$.Spec.pendingSpecExceptionMessage;
|
881
|
+
if(message) {
|
882
|
+
fullMessage += message;
|
883
|
+
}
|
884
|
+
throw fullMessage;
|
700
885
|
};
|
701
886
|
|
702
|
-
this.
|
703
|
-
|
887
|
+
this.fail = function(error) {
|
888
|
+
var message = 'Failed';
|
889
|
+
if (error) {
|
890
|
+
message += ': ';
|
891
|
+
message += error.message || error;
|
892
|
+
}
|
893
|
+
|
894
|
+
currentRunnable().addExpectationResult(false, {
|
895
|
+
matcherName: '',
|
896
|
+
passed: false,
|
897
|
+
expected: '',
|
898
|
+
actual: '',
|
899
|
+
message: message,
|
900
|
+
error: error && error.message ? error : null
|
901
|
+
});
|
704
902
|
};
|
705
903
|
}
|
706
904
|
|
@@ -739,26 +937,31 @@ getJasmineRequireObj().JsApiReporter = function() {
|
|
739
937
|
return status;
|
740
938
|
};
|
741
939
|
|
742
|
-
var suites =
|
940
|
+
var suites = [],
|
941
|
+
suites_hash = {};
|
743
942
|
|
744
943
|
this.suiteStarted = function(result) {
|
745
|
-
|
944
|
+
suites_hash[result.id] = result;
|
746
945
|
};
|
747
946
|
|
748
947
|
this.suiteDone = function(result) {
|
749
948
|
storeSuite(result);
|
750
949
|
};
|
751
950
|
|
951
|
+
this.suiteResults = function(index, length) {
|
952
|
+
return suites.slice(index, index + length);
|
953
|
+
};
|
954
|
+
|
752
955
|
function storeSuite(result) {
|
753
|
-
suites
|
956
|
+
suites.push(result);
|
957
|
+
suites_hash[result.id] = result;
|
754
958
|
}
|
755
959
|
|
756
960
|
this.suites = function() {
|
757
|
-
return
|
961
|
+
return suites_hash;
|
758
962
|
};
|
759
963
|
|
760
964
|
var specs = [];
|
761
|
-
this.specStarted = function(result) { };
|
762
965
|
|
763
966
|
this.specDone = function(result) {
|
764
967
|
specs.push(result);
|
@@ -781,59 +984,22 @@ getJasmineRequireObj().JsApiReporter = function() {
|
|
781
984
|
return JsApiReporter;
|
782
985
|
};
|
783
986
|
|
784
|
-
getJasmineRequireObj().
|
987
|
+
getJasmineRequireObj().CallTracker = function() {
|
785
988
|
|
786
|
-
function
|
787
|
-
|
788
|
-
}
|
989
|
+
function CallTracker() {
|
990
|
+
var calls = [];
|
789
991
|
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
}
|
992
|
+
this.track = function(context) {
|
993
|
+
calls.push(context);
|
994
|
+
};
|
794
995
|
|
795
|
-
|
796
|
-
return
|
797
|
-
}
|
996
|
+
this.any = function() {
|
997
|
+
return !!calls.length;
|
998
|
+
};
|
798
999
|
|
799
|
-
|
800
|
-
return
|
801
|
-
}
|
802
|
-
|
803
|
-
if (this.expectedObject == Object) {
|
804
|
-
return typeof other == 'object';
|
805
|
-
}
|
806
|
-
|
807
|
-
if (this.expectedObject == Boolean) {
|
808
|
-
return typeof other == 'boolean';
|
809
|
-
}
|
810
|
-
|
811
|
-
return other instanceof this.expectedObject;
|
812
|
-
};
|
813
|
-
|
814
|
-
Any.prototype.jasmineToString = function() {
|
815
|
-
return '<jasmine.any(' + this.expectedObject + ')>';
|
816
|
-
};
|
817
|
-
|
818
|
-
return Any;
|
819
|
-
};
|
820
|
-
|
821
|
-
getJasmineRequireObj().CallTracker = function() {
|
822
|
-
|
823
|
-
function CallTracker() {
|
824
|
-
var calls = [];
|
825
|
-
|
826
|
-
this.track = function(context) {
|
827
|
-
calls.push(context);
|
828
|
-
};
|
829
|
-
|
830
|
-
this.any = function() {
|
831
|
-
return !!calls.length;
|
832
|
-
};
|
833
|
-
|
834
|
-
this.count = function() {
|
835
|
-
return calls.length;
|
836
|
-
};
|
1000
|
+
this.count = function() {
|
1001
|
+
return calls.length;
|
1002
|
+
};
|
837
1003
|
|
838
1004
|
this.argsFor = function(index) {
|
839
1005
|
var call = calls[index];
|
@@ -870,7 +1036,7 @@ getJasmineRequireObj().CallTracker = function() {
|
|
870
1036
|
};
|
871
1037
|
|
872
1038
|
getJasmineRequireObj().Clock = function() {
|
873
|
-
function Clock(global,
|
1039
|
+
function Clock(global, delayedFunctionSchedulerFactory, mockDate) {
|
874
1040
|
var self = this,
|
875
1041
|
realTimingFunctions = {
|
876
1042
|
setTimeout: global.setTimeout,
|
@@ -885,19 +1051,24 @@ getJasmineRequireObj().Clock = function() {
|
|
885
1051
|
clearInterval: clearInterval
|
886
1052
|
},
|
887
1053
|
installed = false,
|
1054
|
+
delayedFunctionScheduler,
|
888
1055
|
timer;
|
889
1056
|
|
890
1057
|
|
891
1058
|
self.install = function() {
|
1059
|
+
if(!originalTimingFunctionsIntact()) {
|
1060
|
+
throw new Error('Jasmine Clock was unable to install over custom global timer functions. Is the clock already installed?');
|
1061
|
+
}
|
892
1062
|
replace(global, fakeTimingFunctions);
|
893
1063
|
timer = fakeTimingFunctions;
|
1064
|
+
delayedFunctionScheduler = delayedFunctionSchedulerFactory();
|
894
1065
|
installed = true;
|
895
1066
|
|
896
1067
|
return self;
|
897
1068
|
};
|
898
1069
|
|
899
1070
|
self.uninstall = function() {
|
900
|
-
delayedFunctionScheduler
|
1071
|
+
delayedFunctionScheduler = null;
|
901
1072
|
mockDate.uninstall();
|
902
1073
|
replace(global, realTimingFunctions);
|
903
1074
|
|
@@ -905,6 +1076,15 @@ getJasmineRequireObj().Clock = function() {
|
|
905
1076
|
installed = false;
|
906
1077
|
};
|
907
1078
|
|
1079
|
+
self.withMock = function(closure) {
|
1080
|
+
this.install();
|
1081
|
+
try {
|
1082
|
+
closure();
|
1083
|
+
} finally {
|
1084
|
+
this.uninstall();
|
1085
|
+
}
|
1086
|
+
};
|
1087
|
+
|
908
1088
|
self.mockDate = function(initialDate) {
|
909
1089
|
mockDate.install(initialDate);
|
910
1090
|
};
|
@@ -948,6 +1128,13 @@ getJasmineRequireObj().Clock = function() {
|
|
948
1128
|
|
949
1129
|
return self;
|
950
1130
|
|
1131
|
+
function originalTimingFunctionsIntact() {
|
1132
|
+
return global.setTimeout === realTimingFunctions.setTimeout &&
|
1133
|
+
global.clearTimeout === realTimingFunctions.clearTimeout &&
|
1134
|
+
global.setInterval === realTimingFunctions.setInterval &&
|
1135
|
+
global.clearInterval === realTimingFunctions.clearInterval;
|
1136
|
+
}
|
1137
|
+
|
951
1138
|
function legacyIE() {
|
952
1139
|
//if these methods are polyfilled, apply will be present
|
953
1140
|
return !(realTimingFunctions.setTimeout || realTimingFunctions.setInterval).apply;
|
@@ -1057,13 +1244,6 @@ getJasmineRequireObj().DelayedFunctionScheduler = function() {
|
|
1057
1244
|
}
|
1058
1245
|
};
|
1059
1246
|
|
1060
|
-
self.reset = function() {
|
1061
|
-
currentTime = 0;
|
1062
|
-
scheduledLookup = [];
|
1063
|
-
scheduledFunctions = {};
|
1064
|
-
delayedFnCount = 0;
|
1065
|
-
};
|
1066
|
-
|
1067
1247
|
return self;
|
1068
1248
|
|
1069
1249
|
function indexOfFirstToPass(array, testFn) {
|
@@ -1099,6 +1279,12 @@ getJasmineRequireObj().DelayedFunctionScheduler = function() {
|
|
1099
1279
|
scheduledFn.runAtMillis + scheduledFn.millis);
|
1100
1280
|
}
|
1101
1281
|
|
1282
|
+
function forEachFunction(funcsToRun, callback) {
|
1283
|
+
for (var i = 0; i < funcsToRun.length; ++i) {
|
1284
|
+
callback(funcsToRun[i]);
|
1285
|
+
}
|
1286
|
+
}
|
1287
|
+
|
1102
1288
|
function runScheduledFunctions(endTime) {
|
1103
1289
|
if (scheduledLookup.length === 0 || scheduledLookup[0] > endTime) {
|
1104
1290
|
return;
|
@@ -1110,14 +1296,15 @@ getJasmineRequireObj().DelayedFunctionScheduler = function() {
|
|
1110
1296
|
var funcsToRun = scheduledFunctions[currentTime];
|
1111
1297
|
delete scheduledFunctions[currentTime];
|
1112
1298
|
|
1113
|
-
|
1114
|
-
var funcToRun = funcsToRun[i];
|
1115
|
-
funcToRun.funcToCall.apply(null, funcToRun.params || []);
|
1116
|
-
|
1299
|
+
forEachFunction(funcsToRun, function(funcToRun) {
|
1117
1300
|
if (funcToRun.recurring) {
|
1118
1301
|
reschedule(funcToRun);
|
1119
1302
|
}
|
1120
|
-
}
|
1303
|
+
});
|
1304
|
+
|
1305
|
+
forEachFunction(funcsToRun, function(funcToRun) {
|
1306
|
+
funcToRun.funcToCall.apply(null, funcToRun.params || []);
|
1307
|
+
});
|
1121
1308
|
} while (scheduledLookup.length > 0 &&
|
1122
1309
|
// checking first if we're out of time prevents setTimeout(0)
|
1123
1310
|
// scheduled in a funcToRun from forcing an extra iteration
|
@@ -1161,8 +1348,6 @@ getJasmineRequireObj().ExceptionFormatter = function() {
|
|
1161
1348
|
|
1162
1349
|
getJasmineRequireObj().Expectation = function() {
|
1163
1350
|
|
1164
|
-
var matchers = {};
|
1165
|
-
|
1166
1351
|
function Expectation(options) {
|
1167
1352
|
this.util = options.util || { buildFailureMessage: function() {} };
|
1168
1353
|
this.customEqualityTesters = options.customEqualityTesters || [];
|
@@ -1170,8 +1355,9 @@ getJasmineRequireObj().Expectation = function() {
|
|
1170
1355
|
this.addExpectationResult = options.addExpectationResult || function(){};
|
1171
1356
|
this.isNot = options.isNot;
|
1172
1357
|
|
1173
|
-
|
1174
|
-
|
1358
|
+
var customMatchers = options.customMatchers || {};
|
1359
|
+
for (var matcherName in customMatchers) {
|
1360
|
+
this[matcherName] = Expectation.prototype.wrapCompare(matcherName, customMatchers[matcherName]);
|
1175
1361
|
}
|
1176
1362
|
}
|
1177
1363
|
|
@@ -1238,19 +1424,6 @@ getJasmineRequireObj().Expectation = function() {
|
|
1238
1424
|
}
|
1239
1425
|
};
|
1240
1426
|
|
1241
|
-
Expectation.addMatchers = function(matchersToAdd) {
|
1242
|
-
for (var name in matchersToAdd) {
|
1243
|
-
var matcher = matchersToAdd[name];
|
1244
|
-
matchers[name] = Expectation.prototype.wrapCompare(name, matcher);
|
1245
|
-
}
|
1246
|
-
};
|
1247
|
-
|
1248
|
-
Expectation.resetMatchers = function() {
|
1249
|
-
for (var name in matchers) {
|
1250
|
-
delete matchers[name];
|
1251
|
-
}
|
1252
|
-
};
|
1253
|
-
|
1254
1427
|
Expectation.Factory = function(options) {
|
1255
1428
|
options = options || {};
|
1256
1429
|
|
@@ -1273,15 +1446,20 @@ getJasmineRequireObj().buildExpectationResult = function() {
|
|
1273
1446
|
var messageFormatter = options.messageFormatter || function() {},
|
1274
1447
|
stackFormatter = options.stackFormatter || function() {};
|
1275
1448
|
|
1276
|
-
|
1449
|
+
var result = {
|
1277
1450
|
matcherName: options.matcherName,
|
1278
|
-
expected: options.expected,
|
1279
|
-
actual: options.actual,
|
1280
1451
|
message: message(),
|
1281
1452
|
stack: stack(),
|
1282
1453
|
passed: options.passed
|
1283
1454
|
};
|
1284
1455
|
|
1456
|
+
if(!result.passed) {
|
1457
|
+
result.expected = options.expected;
|
1458
|
+
result.actual = options.actual;
|
1459
|
+
}
|
1460
|
+
|
1461
|
+
return result;
|
1462
|
+
|
1285
1463
|
function message() {
|
1286
1464
|
if (options.passed) {
|
1287
1465
|
return 'Passed.';
|
@@ -1369,13 +1547,14 @@ getJasmineRequireObj().MockDate = function() {
|
|
1369
1547
|
case 6:
|
1370
1548
|
return new GlobalDate(arguments[0], arguments[1], arguments[2], arguments[3],
|
1371
1549
|
arguments[4], arguments[5]);
|
1372
|
-
|
1550
|
+
default:
|
1373
1551
|
return new GlobalDate(arguments[0], arguments[1], arguments[2], arguments[3],
|
1374
1552
|
arguments[4], arguments[5], arguments[6]);
|
1375
1553
|
}
|
1376
1554
|
}
|
1377
1555
|
|
1378
1556
|
function createDateProperties() {
|
1557
|
+
FakeDate.prototype = GlobalDate.prototype;
|
1379
1558
|
|
1380
1559
|
FakeDate.now = function() {
|
1381
1560
|
if (GlobalDate.now) {
|
@@ -1395,41 +1574,6 @@ getJasmineRequireObj().MockDate = function() {
|
|
1395
1574
|
return MockDate;
|
1396
1575
|
};
|
1397
1576
|
|
1398
|
-
getJasmineRequireObj().ObjectContaining = function(j$) {
|
1399
|
-
|
1400
|
-
function ObjectContaining(sample) {
|
1401
|
-
this.sample = sample;
|
1402
|
-
}
|
1403
|
-
|
1404
|
-
ObjectContaining.prototype.jasmineMatches = function(other, mismatchKeys, mismatchValues) {
|
1405
|
-
if (typeof(this.sample) !== 'object') { throw new Error('You must provide an object to objectContaining, not \''+this.sample+'\'.'); }
|
1406
|
-
|
1407
|
-
mismatchKeys = mismatchKeys || [];
|
1408
|
-
mismatchValues = mismatchValues || [];
|
1409
|
-
|
1410
|
-
var hasKey = function(obj, keyName) {
|
1411
|
-
return obj !== null && !j$.util.isUndefined(obj[keyName]);
|
1412
|
-
};
|
1413
|
-
|
1414
|
-
for (var property in this.sample) {
|
1415
|
-
if (!hasKey(other, property) && hasKey(this.sample, property)) {
|
1416
|
-
mismatchKeys.push('expected has key \'' + property + '\', but missing from actual.');
|
1417
|
-
}
|
1418
|
-
else if (!j$.matchersUtil.equals(other[property], this.sample[property])) {
|
1419
|
-
mismatchValues.push('\'' + property + '\' was \'' + (other[property] ? j$.util.htmlEscape(other[property].toString()) : other[property]) + '\' in actual, but was \'' + (this.sample[property] ? j$.util.htmlEscape(this.sample[property].toString()) : this.sample[property]) + '\' in expected.');
|
1420
|
-
}
|
1421
|
-
}
|
1422
|
-
|
1423
|
-
return (mismatchKeys.length === 0 && mismatchValues.length === 0);
|
1424
|
-
};
|
1425
|
-
|
1426
|
-
ObjectContaining.prototype.jasmineToString = function() {
|
1427
|
-
return '<jasmine.objectContaining(' + j$.pp(this.sample) + ')>';
|
1428
|
-
};
|
1429
|
-
|
1430
|
-
return ObjectContaining;
|
1431
|
-
};
|
1432
|
-
|
1433
1577
|
getJasmineRequireObj().pp = function(j$) {
|
1434
1578
|
|
1435
1579
|
function PrettyPrinter() {
|
@@ -1525,17 +1669,36 @@ getJasmineRequireObj().pp = function(j$) {
|
|
1525
1669
|
if(array.length > length){
|
1526
1670
|
this.append(', ...');
|
1527
1671
|
}
|
1672
|
+
|
1673
|
+
var self = this;
|
1674
|
+
var first = array.length === 0;
|
1675
|
+
this.iterateObject(array, function(property, isGetter) {
|
1676
|
+
if (property.match(/^\d+$/)) {
|
1677
|
+
return;
|
1678
|
+
}
|
1679
|
+
|
1680
|
+
if (first) {
|
1681
|
+
first = false;
|
1682
|
+
} else {
|
1683
|
+
self.append(', ');
|
1684
|
+
}
|
1685
|
+
|
1686
|
+
self.formatProperty(array, property, isGetter);
|
1687
|
+
});
|
1688
|
+
|
1528
1689
|
this.append(' ]');
|
1529
1690
|
};
|
1530
1691
|
|
1531
1692
|
StringPrettyPrinter.prototype.emitObject = function(obj) {
|
1693
|
+
var constructorName = obj.constructor ? j$.fnNameFor(obj.constructor) : 'null';
|
1694
|
+
this.append(constructorName);
|
1695
|
+
|
1532
1696
|
if (this.ppNestLevel_ > j$.MAX_PRETTY_PRINT_DEPTH) {
|
1533
|
-
this.append('Object');
|
1534
1697
|
return;
|
1535
1698
|
}
|
1536
1699
|
|
1537
1700
|
var self = this;
|
1538
|
-
this.append('{ ');
|
1701
|
+
this.append('({ ');
|
1539
1702
|
var first = true;
|
1540
1703
|
|
1541
1704
|
this.iterateObject(obj, function(property, isGetter) {
|
@@ -1545,16 +1708,20 @@ getJasmineRequireObj().pp = function(j$) {
|
|
1545
1708
|
self.append(', ');
|
1546
1709
|
}
|
1547
1710
|
|
1548
|
-
self.
|
1549
|
-
|
1711
|
+
self.formatProperty(obj, property, isGetter);
|
1712
|
+
});
|
1713
|
+
|
1714
|
+
this.append(' })');
|
1715
|
+
};
|
1716
|
+
|
1717
|
+
StringPrettyPrinter.prototype.formatProperty = function(obj, property, isGetter) {
|
1718
|
+
this.append(property);
|
1719
|
+
this.append(': ');
|
1550
1720
|
if (isGetter) {
|
1551
|
-
|
1721
|
+
this.append('<getter>');
|
1552
1722
|
} else {
|
1553
|
-
|
1723
|
+
this.format(obj[property]);
|
1554
1724
|
}
|
1555
|
-
});
|
1556
|
-
|
1557
|
-
this.append(' }');
|
1558
1725
|
};
|
1559
1726
|
|
1560
1727
|
StringPrettyPrinter.prototype.append = function(value) {
|
@@ -1581,31 +1748,33 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|
1581
1748
|
}
|
1582
1749
|
|
1583
1750
|
function QueueRunner(attrs) {
|
1584
|
-
this.
|
1751
|
+
this.queueableFns = attrs.queueableFns || [];
|
1585
1752
|
this.onComplete = attrs.onComplete || function() {};
|
1586
1753
|
this.clearStack = attrs.clearStack || function(fn) {fn();};
|
1587
1754
|
this.onException = attrs.onException || function() {};
|
1588
1755
|
this.catchException = attrs.catchException || function() { return true; };
|
1589
|
-
this.
|
1590
|
-
this.
|
1591
|
-
this.
|
1756
|
+
this.userContext = attrs.userContext || {};
|
1757
|
+
this.timeout = attrs.timeout || {setTimeout: setTimeout, clearTimeout: clearTimeout};
|
1758
|
+
this.fail = attrs.fail || function() {};
|
1592
1759
|
}
|
1593
1760
|
|
1594
1761
|
QueueRunner.prototype.execute = function() {
|
1595
|
-
this.run(this.
|
1762
|
+
this.run(this.queueableFns, 0);
|
1596
1763
|
};
|
1597
1764
|
|
1598
|
-
QueueRunner.prototype.run = function(
|
1599
|
-
var length =
|
1600
|
-
|
1601
|
-
|
1765
|
+
QueueRunner.prototype.run = function(queueableFns, recursiveIndex) {
|
1766
|
+
var length = queueableFns.length,
|
1767
|
+
self = this,
|
1768
|
+
iterativeIndex;
|
1769
|
+
|
1602
1770
|
|
1603
1771
|
for(iterativeIndex = recursiveIndex; iterativeIndex < length; iterativeIndex++) {
|
1604
|
-
var
|
1605
|
-
if (fn.length > 0) {
|
1606
|
-
|
1772
|
+
var queueableFn = queueableFns[iterativeIndex];
|
1773
|
+
if (queueableFn.fn.length > 0) {
|
1774
|
+
attemptAsync(queueableFn);
|
1775
|
+
return;
|
1607
1776
|
} else {
|
1608
|
-
attemptSync(
|
1777
|
+
attemptSync(queueableFn);
|
1609
1778
|
}
|
1610
1779
|
}
|
1611
1780
|
|
@@ -1615,41 +1784,51 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|
1615
1784
|
this.clearStack(this.onComplete);
|
1616
1785
|
}
|
1617
1786
|
|
1618
|
-
function attemptSync(
|
1787
|
+
function attemptSync(queueableFn) {
|
1619
1788
|
try {
|
1620
|
-
fn.call(self.userContext);
|
1789
|
+
queueableFn.fn.call(self.userContext);
|
1621
1790
|
} catch (e) {
|
1622
|
-
handleException(e);
|
1791
|
+
handleException(e, queueableFn);
|
1623
1792
|
}
|
1624
1793
|
}
|
1625
1794
|
|
1626
|
-
function attemptAsync(
|
1795
|
+
function attemptAsync(queueableFn) {
|
1627
1796
|
var clearTimeout = function () {
|
1628
|
-
Function.prototype.apply.apply(self.
|
1797
|
+
Function.prototype.apply.apply(self.timeout.clearTimeout, [j$.getGlobal(), [timeoutId]]);
|
1629
1798
|
},
|
1630
1799
|
next = once(function () {
|
1631
1800
|
clearTimeout(timeoutId);
|
1632
|
-
self.run(
|
1801
|
+
self.run(queueableFns, iterativeIndex + 1);
|
1633
1802
|
}),
|
1634
1803
|
timeoutId;
|
1635
1804
|
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
1805
|
+
next.fail = function() {
|
1806
|
+
self.fail.apply(null, arguments);
|
1807
|
+
next();
|
1808
|
+
};
|
1809
|
+
|
1810
|
+
if (queueableFn.timeout) {
|
1811
|
+
timeoutId = Function.prototype.apply.apply(self.timeout.setTimeout, [j$.getGlobal(), [function() {
|
1812
|
+
var error = new Error('Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.');
|
1813
|
+
onException(error, queueableFn);
|
1639
1814
|
next();
|
1640
|
-
},
|
1815
|
+
}, queueableFn.timeout()]]);
|
1641
1816
|
}
|
1642
1817
|
|
1643
1818
|
try {
|
1644
|
-
fn.call(self.userContext, next);
|
1819
|
+
queueableFn.fn.call(self.userContext, next);
|
1645
1820
|
} catch (e) {
|
1646
|
-
handleException(e);
|
1821
|
+
handleException(e, queueableFn);
|
1647
1822
|
next();
|
1648
1823
|
}
|
1649
1824
|
}
|
1650
1825
|
|
1651
|
-
function
|
1826
|
+
function onException(e, queueableFn) {
|
1652
1827
|
self.onException(e);
|
1828
|
+
}
|
1829
|
+
|
1830
|
+
function handleException(e, queueableFn) {
|
1831
|
+
onException(e, queueableFn);
|
1653
1832
|
if (!self.catchException(e)) {
|
1654
1833
|
//TODO: set a var when we catch an exception and
|
1655
1834
|
//use a finally block to close the loop in a nice way..
|
@@ -1697,174 +1876,670 @@ getJasmineRequireObj().ReportDispatcher = function() {
|
|
1697
1876
|
};
|
1698
1877
|
|
1699
1878
|
|
1700
|
-
getJasmineRequireObj().
|
1879
|
+
getJasmineRequireObj().SpyRegistry = function(j$) {
|
1880
|
+
|
1881
|
+
function SpyRegistry(options) {
|
1882
|
+
options = options || {};
|
1883
|
+
var currentSpies = options.currentSpies || function() { return []; };
|
1884
|
+
|
1885
|
+
this.spyOn = function(obj, methodName) {
|
1886
|
+
if (j$.util.isUndefined(obj)) {
|
1887
|
+
throw new Error('spyOn could not find an object to spy upon for ' + methodName + '()');
|
1888
|
+
}
|
1889
|
+
|
1890
|
+
if (j$.util.isUndefined(methodName)) {
|
1891
|
+
throw new Error('No method name supplied');
|
1892
|
+
}
|
1893
|
+
|
1894
|
+
if (j$.util.isUndefined(obj[methodName])) {
|
1895
|
+
throw new Error(methodName + '() method does not exist');
|
1896
|
+
}
|
1897
|
+
|
1898
|
+
if (obj[methodName] && j$.isSpy(obj[methodName])) {
|
1899
|
+
//TODO?: should this return the current spy? Downside: may cause user confusion about spy state
|
1900
|
+
throw new Error(methodName + ' has already been spied upon');
|
1901
|
+
}
|
1902
|
+
|
1903
|
+
var spy = j$.createSpy(methodName, obj[methodName]);
|
1904
|
+
|
1905
|
+
currentSpies().push({
|
1906
|
+
spy: spy,
|
1907
|
+
baseObj: obj,
|
1908
|
+
methodName: methodName,
|
1909
|
+
originalValue: obj[methodName]
|
1910
|
+
});
|
1911
|
+
|
1912
|
+
obj[methodName] = spy;
|
1913
|
+
|
1914
|
+
return spy;
|
1915
|
+
};
|
1916
|
+
|
1917
|
+
this.clearSpies = function() {
|
1918
|
+
var spies = currentSpies();
|
1919
|
+
for (var i = 0; i < spies.length; i++) {
|
1920
|
+
var spyEntry = spies[i];
|
1921
|
+
spyEntry.baseObj[spyEntry.methodName] = spyEntry.originalValue;
|
1922
|
+
}
|
1923
|
+
};
|
1924
|
+
}
|
1925
|
+
|
1926
|
+
return SpyRegistry;
|
1927
|
+
};
|
1928
|
+
|
1929
|
+
getJasmineRequireObj().SpyStrategy = function() {
|
1930
|
+
|
1931
|
+
function SpyStrategy(options) {
|
1932
|
+
options = options || {};
|
1933
|
+
|
1934
|
+
var identity = options.name || 'unknown',
|
1935
|
+
originalFn = options.fn || function() {},
|
1936
|
+
getSpy = options.getSpy || function() {},
|
1937
|
+
plan = function() {};
|
1938
|
+
|
1939
|
+
this.identity = function() {
|
1940
|
+
return identity;
|
1941
|
+
};
|
1942
|
+
|
1943
|
+
this.exec = function() {
|
1944
|
+
return plan.apply(this, arguments);
|
1945
|
+
};
|
1946
|
+
|
1947
|
+
this.callThrough = function() {
|
1948
|
+
plan = originalFn;
|
1949
|
+
return getSpy();
|
1950
|
+
};
|
1951
|
+
|
1952
|
+
this.returnValue = function(value) {
|
1953
|
+
plan = function() {
|
1954
|
+
return value;
|
1955
|
+
};
|
1956
|
+
return getSpy();
|
1957
|
+
};
|
1958
|
+
|
1959
|
+
this.returnValues = function() {
|
1960
|
+
var values = Array.prototype.slice.call(arguments);
|
1961
|
+
plan = function () {
|
1962
|
+
return values.shift();
|
1963
|
+
};
|
1964
|
+
return getSpy();
|
1965
|
+
};
|
1966
|
+
|
1967
|
+
this.throwError = function(something) {
|
1968
|
+
var error = (something instanceof Error) ? something : new Error(something);
|
1969
|
+
plan = function() {
|
1970
|
+
throw error;
|
1971
|
+
};
|
1972
|
+
return getSpy();
|
1973
|
+
};
|
1974
|
+
|
1975
|
+
this.callFake = function(fn) {
|
1976
|
+
plan = fn;
|
1977
|
+
return getSpy();
|
1978
|
+
};
|
1979
|
+
|
1980
|
+
this.stub = function(fn) {
|
1981
|
+
plan = function() {};
|
1982
|
+
return getSpy();
|
1983
|
+
};
|
1984
|
+
}
|
1985
|
+
|
1986
|
+
return SpyStrategy;
|
1987
|
+
};
|
1988
|
+
|
1989
|
+
getJasmineRequireObj().Suite = function(j$) {
|
1990
|
+
function Suite(attrs) {
|
1991
|
+
this.env = attrs.env;
|
1992
|
+
this.id = attrs.id;
|
1993
|
+
this.parentSuite = attrs.parentSuite;
|
1994
|
+
this.description = attrs.description;
|
1995
|
+
this.expectationFactory = attrs.expectationFactory;
|
1996
|
+
this.expectationResultFactory = attrs.expectationResultFactory;
|
1997
|
+
this.throwOnExpectationFailure = !!attrs.throwOnExpectationFailure;
|
1998
|
+
|
1999
|
+
this.beforeFns = [];
|
2000
|
+
this.afterFns = [];
|
2001
|
+
this.beforeAllFns = [];
|
2002
|
+
this.afterAllFns = [];
|
2003
|
+
this.disabled = false;
|
2004
|
+
|
2005
|
+
this.children = [];
|
2006
|
+
|
2007
|
+
this.result = {
|
2008
|
+
id: this.id,
|
2009
|
+
description: this.description,
|
2010
|
+
fullName: this.getFullName(),
|
2011
|
+
failedExpectations: []
|
2012
|
+
};
|
2013
|
+
}
|
2014
|
+
|
2015
|
+
Suite.prototype.expect = function(actual) {
|
2016
|
+
return this.expectationFactory(actual, this);
|
2017
|
+
};
|
2018
|
+
|
2019
|
+
Suite.prototype.getFullName = function() {
|
2020
|
+
var fullName = this.description;
|
2021
|
+
for (var parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) {
|
2022
|
+
if (parentSuite.parentSuite) {
|
2023
|
+
fullName = parentSuite.description + ' ' + fullName;
|
2024
|
+
}
|
2025
|
+
}
|
2026
|
+
return fullName;
|
2027
|
+
};
|
2028
|
+
|
2029
|
+
Suite.prototype.disable = function() {
|
2030
|
+
this.disabled = true;
|
2031
|
+
};
|
2032
|
+
|
2033
|
+
Suite.prototype.beforeEach = function(fn) {
|
2034
|
+
this.beforeFns.unshift(fn);
|
2035
|
+
};
|
2036
|
+
|
2037
|
+
Suite.prototype.beforeAll = function(fn) {
|
2038
|
+
this.beforeAllFns.push(fn);
|
2039
|
+
};
|
2040
|
+
|
2041
|
+
Suite.prototype.afterEach = function(fn) {
|
2042
|
+
this.afterFns.unshift(fn);
|
2043
|
+
};
|
2044
|
+
|
2045
|
+
Suite.prototype.afterAll = function(fn) {
|
2046
|
+
this.afterAllFns.push(fn);
|
2047
|
+
};
|
2048
|
+
|
2049
|
+
Suite.prototype.addChild = function(child) {
|
2050
|
+
this.children.push(child);
|
2051
|
+
};
|
2052
|
+
|
2053
|
+
Suite.prototype.status = function() {
|
2054
|
+
if (this.disabled) {
|
2055
|
+
return 'disabled';
|
2056
|
+
}
|
2057
|
+
|
2058
|
+
if (this.result.failedExpectations.length > 0) {
|
2059
|
+
return 'failed';
|
2060
|
+
} else {
|
2061
|
+
return 'finished';
|
2062
|
+
}
|
2063
|
+
};
|
2064
|
+
|
2065
|
+
Suite.prototype.isExecutable = function() {
|
2066
|
+
return !this.disabled;
|
2067
|
+
};
|
2068
|
+
|
2069
|
+
Suite.prototype.canBeReentered = function() {
|
2070
|
+
return this.beforeAllFns.length === 0 && this.afterAllFns.length === 0;
|
2071
|
+
};
|
2072
|
+
|
2073
|
+
Suite.prototype.getResult = function() {
|
2074
|
+
this.result.status = this.status();
|
2075
|
+
return this.result;
|
2076
|
+
};
|
2077
|
+
|
2078
|
+
Suite.prototype.sharedUserContext = function() {
|
2079
|
+
if (!this.sharedContext) {
|
2080
|
+
this.sharedContext = this.parentSuite ? clone(this.parentSuite.sharedUserContext()) : {};
|
2081
|
+
}
|
2082
|
+
|
2083
|
+
return this.sharedContext;
|
2084
|
+
};
|
2085
|
+
|
2086
|
+
Suite.prototype.clonedSharedUserContext = function() {
|
2087
|
+
return clone(this.sharedUserContext());
|
2088
|
+
};
|
2089
|
+
|
2090
|
+
Suite.prototype.onException = function() {
|
2091
|
+
if (arguments[0] instanceof j$.errors.ExpectationFailed) {
|
2092
|
+
return;
|
2093
|
+
}
|
2094
|
+
|
2095
|
+
if(isAfterAll(this.children)) {
|
2096
|
+
var data = {
|
2097
|
+
matcherName: '',
|
2098
|
+
passed: false,
|
2099
|
+
expected: '',
|
2100
|
+
actual: '',
|
2101
|
+
error: arguments[0]
|
2102
|
+
};
|
2103
|
+
this.result.failedExpectations.push(this.expectationResultFactory(data));
|
2104
|
+
} else {
|
2105
|
+
for (var i = 0; i < this.children.length; i++) {
|
2106
|
+
var child = this.children[i];
|
2107
|
+
child.onException.apply(child, arguments);
|
2108
|
+
}
|
2109
|
+
}
|
2110
|
+
};
|
2111
|
+
|
2112
|
+
Suite.prototype.addExpectationResult = function () {
|
2113
|
+
if(isAfterAll(this.children) && isFailure(arguments)){
|
2114
|
+
var data = arguments[1];
|
2115
|
+
this.result.failedExpectations.push(this.expectationResultFactory(data));
|
2116
|
+
if(this.throwOnExpectationFailure) {
|
2117
|
+
throw new j$.errors.ExpectationFailed();
|
2118
|
+
}
|
2119
|
+
} else {
|
2120
|
+
for (var i = 0; i < this.children.length; i++) {
|
2121
|
+
var child = this.children[i];
|
2122
|
+
try {
|
2123
|
+
child.addExpectationResult.apply(child, arguments);
|
2124
|
+
} catch(e) {
|
2125
|
+
// keep going
|
2126
|
+
}
|
2127
|
+
}
|
2128
|
+
}
|
2129
|
+
};
|
2130
|
+
|
2131
|
+
function isAfterAll(children) {
|
2132
|
+
return children && children[0].result.status;
|
2133
|
+
}
|
2134
|
+
|
2135
|
+
function isFailure(args) {
|
2136
|
+
return !args[0];
|
2137
|
+
}
|
2138
|
+
|
2139
|
+
function clone(obj) {
|
2140
|
+
var clonedObj = {};
|
2141
|
+
for (var prop in obj) {
|
2142
|
+
if (obj.hasOwnProperty(prop)) {
|
2143
|
+
clonedObj[prop] = obj[prop];
|
2144
|
+
}
|
2145
|
+
}
|
2146
|
+
|
2147
|
+
return clonedObj;
|
2148
|
+
}
|
2149
|
+
|
2150
|
+
return Suite;
|
2151
|
+
};
|
2152
|
+
|
2153
|
+
if (typeof window == void 0 && typeof exports == 'object') {
|
2154
|
+
exports.Suite = jasmineRequire.Suite;
|
2155
|
+
}
|
2156
|
+
|
2157
|
+
getJasmineRequireObj().Timer = function() {
|
2158
|
+
var defaultNow = (function(Date) {
|
2159
|
+
return function() { return new Date().getTime(); };
|
2160
|
+
})(Date);
|
2161
|
+
|
2162
|
+
function Timer(options) {
|
2163
|
+
options = options || {};
|
2164
|
+
|
2165
|
+
var now = options.now || defaultNow,
|
2166
|
+
startTime;
|
2167
|
+
|
2168
|
+
this.start = function() {
|
2169
|
+
startTime = now();
|
2170
|
+
};
|
2171
|
+
|
2172
|
+
this.elapsed = function() {
|
2173
|
+
return now() - startTime;
|
2174
|
+
};
|
2175
|
+
}
|
2176
|
+
|
2177
|
+
return Timer;
|
2178
|
+
};
|
2179
|
+
|
2180
|
+
getJasmineRequireObj().TreeProcessor = function() {
|
2181
|
+
function TreeProcessor(attrs) {
|
2182
|
+
var tree = attrs.tree,
|
2183
|
+
runnableIds = attrs.runnableIds,
|
2184
|
+
queueRunnerFactory = attrs.queueRunnerFactory,
|
2185
|
+
nodeStart = attrs.nodeStart || function() {},
|
2186
|
+
nodeComplete = attrs.nodeComplete || function() {},
|
2187
|
+
stats = { valid: true },
|
2188
|
+
processed = false,
|
2189
|
+
defaultMin = Infinity,
|
2190
|
+
defaultMax = 1 - Infinity;
|
2191
|
+
|
2192
|
+
this.processTree = function() {
|
2193
|
+
processNode(tree, false);
|
2194
|
+
processed = true;
|
2195
|
+
return stats;
|
2196
|
+
};
|
2197
|
+
|
2198
|
+
this.execute = function(done) {
|
2199
|
+
if (!processed) {
|
2200
|
+
this.processTree();
|
2201
|
+
}
|
2202
|
+
|
2203
|
+
if (!stats.valid) {
|
2204
|
+
throw 'invalid order';
|
2205
|
+
}
|
2206
|
+
|
2207
|
+
var childFns = wrapChildren(tree, 0);
|
2208
|
+
|
2209
|
+
queueRunnerFactory({
|
2210
|
+
queueableFns: childFns,
|
2211
|
+
userContext: tree.sharedUserContext(),
|
2212
|
+
onException: function() {
|
2213
|
+
tree.onException.apply(tree, arguments);
|
2214
|
+
},
|
2215
|
+
onComplete: done
|
2216
|
+
});
|
2217
|
+
};
|
2218
|
+
|
2219
|
+
function runnableIndex(id) {
|
2220
|
+
for (var i = 0; i < runnableIds.length; i++) {
|
2221
|
+
if (runnableIds[i] === id) {
|
2222
|
+
return i;
|
2223
|
+
}
|
2224
|
+
}
|
2225
|
+
}
|
2226
|
+
|
2227
|
+
function processNode(node, parentEnabled) {
|
2228
|
+
var executableIndex = runnableIndex(node.id);
|
2229
|
+
|
2230
|
+
if (executableIndex !== undefined) {
|
2231
|
+
parentEnabled = true;
|
2232
|
+
}
|
2233
|
+
|
2234
|
+
parentEnabled = parentEnabled && node.isExecutable();
|
2235
|
+
|
2236
|
+
if (!node.children) {
|
2237
|
+
stats[node.id] = {
|
2238
|
+
executable: parentEnabled && node.isExecutable(),
|
2239
|
+
segments: [{
|
2240
|
+
index: 0,
|
2241
|
+
owner: node,
|
2242
|
+
nodes: [node],
|
2243
|
+
min: startingMin(executableIndex),
|
2244
|
+
max: startingMax(executableIndex)
|
2245
|
+
}]
|
2246
|
+
};
|
2247
|
+
} else {
|
2248
|
+
var hasExecutableChild = false;
|
2249
|
+
|
2250
|
+
for (var i = 0; i < node.children.length; i++) {
|
2251
|
+
var child = node.children[i];
|
2252
|
+
|
2253
|
+
processNode(child, parentEnabled);
|
2254
|
+
|
2255
|
+
if (!stats.valid) {
|
2256
|
+
return;
|
2257
|
+
}
|
2258
|
+
|
2259
|
+
var childStats = stats[child.id];
|
2260
|
+
|
2261
|
+
hasExecutableChild = hasExecutableChild || childStats.executable;
|
2262
|
+
}
|
2263
|
+
|
2264
|
+
stats[node.id] = {
|
2265
|
+
executable: hasExecutableChild
|
2266
|
+
};
|
2267
|
+
|
2268
|
+
segmentChildren(node, stats[node.id], executableIndex);
|
2269
|
+
|
2270
|
+
if (!node.canBeReentered() && stats[node.id].segments.length > 1) {
|
2271
|
+
stats = { valid: false };
|
2272
|
+
}
|
2273
|
+
}
|
2274
|
+
}
|
2275
|
+
|
2276
|
+
function startingMin(executableIndex) {
|
2277
|
+
return executableIndex === undefined ? defaultMin : executableIndex;
|
2278
|
+
}
|
2279
|
+
|
2280
|
+
function startingMax(executableIndex) {
|
2281
|
+
return executableIndex === undefined ? defaultMax : executableIndex;
|
2282
|
+
}
|
2283
|
+
|
2284
|
+
function segmentChildren(node, nodeStats, executableIndex) {
|
2285
|
+
var currentSegment = { index: 0, owner: node, nodes: [], min: startingMin(executableIndex), max: startingMax(executableIndex) },
|
2286
|
+
result = [currentSegment],
|
2287
|
+
lastMax = defaultMax,
|
2288
|
+
orderedChildSegments = orderChildSegments(node.children);
|
2289
|
+
|
2290
|
+
function isSegmentBoundary(minIndex) {
|
2291
|
+
return lastMax !== defaultMax && minIndex !== defaultMin && lastMax < minIndex - 1;
|
2292
|
+
}
|
2293
|
+
|
2294
|
+
for (var i = 0; i < orderedChildSegments.length; i++) {
|
2295
|
+
var childSegment = orderedChildSegments[i],
|
2296
|
+
maxIndex = childSegment.max,
|
2297
|
+
minIndex = childSegment.min;
|
2298
|
+
|
2299
|
+
if (isSegmentBoundary(minIndex)) {
|
2300
|
+
currentSegment = {index: result.length, owner: node, nodes: [], min: defaultMin, max: defaultMax};
|
2301
|
+
result.push(currentSegment);
|
2302
|
+
}
|
2303
|
+
|
2304
|
+
currentSegment.nodes.push(childSegment);
|
2305
|
+
currentSegment.min = Math.min(currentSegment.min, minIndex);
|
2306
|
+
currentSegment.max = Math.max(currentSegment.max, maxIndex);
|
2307
|
+
lastMax = maxIndex;
|
2308
|
+
}
|
2309
|
+
|
2310
|
+
nodeStats.segments = result;
|
2311
|
+
}
|
2312
|
+
|
2313
|
+
function orderChildSegments(children) {
|
2314
|
+
var specifiedOrder = [],
|
2315
|
+
unspecifiedOrder = [];
|
2316
|
+
|
2317
|
+
for (var i = 0; i < children.length; i++) {
|
2318
|
+
var child = children[i],
|
2319
|
+
segments = stats[child.id].segments;
|
2320
|
+
|
2321
|
+
for (var j = 0; j < segments.length; j++) {
|
2322
|
+
var seg = segments[j];
|
2323
|
+
|
2324
|
+
if (seg.min === defaultMin) {
|
2325
|
+
unspecifiedOrder.push(seg);
|
2326
|
+
} else {
|
2327
|
+
specifiedOrder.push(seg);
|
2328
|
+
}
|
2329
|
+
}
|
2330
|
+
}
|
2331
|
+
|
2332
|
+
specifiedOrder.sort(function(a, b) {
|
2333
|
+
return a.min - b.min;
|
2334
|
+
});
|
2335
|
+
|
2336
|
+
return specifiedOrder.concat(unspecifiedOrder);
|
2337
|
+
}
|
2338
|
+
|
2339
|
+
function executeNode(node, segmentNumber) {
|
2340
|
+
if (node.children) {
|
2341
|
+
return {
|
2342
|
+
fn: function(done) {
|
2343
|
+
nodeStart(node);
|
2344
|
+
|
2345
|
+
queueRunnerFactory({
|
2346
|
+
onComplete: function() {
|
2347
|
+
nodeComplete(node, node.getResult());
|
2348
|
+
done();
|
2349
|
+
},
|
2350
|
+
queueableFns: wrapChildren(node, segmentNumber),
|
2351
|
+
userContext: node.sharedUserContext(),
|
2352
|
+
onException: function() {
|
2353
|
+
node.onException.apply(node, arguments);
|
2354
|
+
}
|
2355
|
+
});
|
2356
|
+
}
|
2357
|
+
};
|
2358
|
+
} else {
|
2359
|
+
return {
|
2360
|
+
fn: function(done) { node.execute(done, stats[node.id].executable); }
|
2361
|
+
};
|
2362
|
+
}
|
2363
|
+
}
|
2364
|
+
|
2365
|
+
function wrapChildren(node, segmentNumber) {
|
2366
|
+
var result = [],
|
2367
|
+
segmentChildren = stats[node.id].segments[segmentNumber].nodes;
|
2368
|
+
|
2369
|
+
for (var i = 0; i < segmentChildren.length; i++) {
|
2370
|
+
result.push(executeNode(segmentChildren[i].owner, segmentChildren[i].index));
|
2371
|
+
}
|
2372
|
+
|
2373
|
+
if (!stats[node.id].executable) {
|
2374
|
+
return result;
|
2375
|
+
}
|
2376
|
+
|
2377
|
+
return node.beforeAllFns.concat(result).concat(node.afterAllFns);
|
2378
|
+
}
|
2379
|
+
}
|
2380
|
+
|
2381
|
+
return TreeProcessor;
|
2382
|
+
};
|
2383
|
+
|
2384
|
+
getJasmineRequireObj().Any = function(j$) {
|
2385
|
+
|
2386
|
+
function Any(expectedObject) {
|
2387
|
+
this.expectedObject = expectedObject;
|
2388
|
+
}
|
2389
|
+
|
2390
|
+
Any.prototype.asymmetricMatch = function(other) {
|
2391
|
+
if (this.expectedObject == String) {
|
2392
|
+
return typeof other == 'string' || other instanceof String;
|
2393
|
+
}
|
2394
|
+
|
2395
|
+
if (this.expectedObject == Number) {
|
2396
|
+
return typeof other == 'number' || other instanceof Number;
|
2397
|
+
}
|
2398
|
+
|
2399
|
+
if (this.expectedObject == Function) {
|
2400
|
+
return typeof other == 'function' || other instanceof Function;
|
2401
|
+
}
|
1701
2402
|
|
1702
|
-
|
1703
|
-
|
2403
|
+
if (this.expectedObject == Object) {
|
2404
|
+
return typeof other == 'object';
|
2405
|
+
}
|
1704
2406
|
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1708
|
-
plan = function() {};
|
2407
|
+
if (this.expectedObject == Boolean) {
|
2408
|
+
return typeof other == 'boolean';
|
2409
|
+
}
|
1709
2410
|
|
1710
|
-
|
1711
|
-
|
1712
|
-
};
|
2411
|
+
return other instanceof this.expectedObject;
|
2412
|
+
};
|
1713
2413
|
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
2414
|
+
Any.prototype.jasmineToString = function() {
|
2415
|
+
return '<jasmine.any(' + j$.fnNameFor(this.expectedObject) + ')>';
|
2416
|
+
};
|
1717
2417
|
|
1718
|
-
|
1719
|
-
|
1720
|
-
return getSpy();
|
1721
|
-
};
|
2418
|
+
return Any;
|
2419
|
+
};
|
1722
2420
|
|
1723
|
-
|
1724
|
-
plan = function() {
|
1725
|
-
return value;
|
1726
|
-
};
|
1727
|
-
return getSpy();
|
1728
|
-
};
|
2421
|
+
getJasmineRequireObj().Anything = function(j$) {
|
1729
2422
|
|
1730
|
-
|
1731
|
-
var error = (something instanceof Error) ? something : new Error(something);
|
1732
|
-
plan = function() {
|
1733
|
-
throw error;
|
1734
|
-
};
|
1735
|
-
return getSpy();
|
1736
|
-
};
|
2423
|
+
function Anything() {}
|
1737
2424
|
|
1738
|
-
|
1739
|
-
|
1740
|
-
|
1741
|
-
};
|
2425
|
+
Anything.prototype.asymmetricMatch = function(other) {
|
2426
|
+
return !j$.util.isUndefined(other) && other !== null;
|
2427
|
+
};
|
1742
2428
|
|
1743
|
-
|
1744
|
-
|
1745
|
-
|
1746
|
-
};
|
1747
|
-
}
|
2429
|
+
Anything.prototype.jasmineToString = function() {
|
2430
|
+
return '<jasmine.anything>';
|
2431
|
+
};
|
1748
2432
|
|
1749
|
-
return
|
2433
|
+
return Anything;
|
1750
2434
|
};
|
1751
2435
|
|
1752
|
-
getJasmineRequireObj().
|
1753
|
-
function
|
1754
|
-
this.
|
1755
|
-
this.id = attrs.id;
|
1756
|
-
this.parentSuite = attrs.parentSuite;
|
1757
|
-
this.description = attrs.description;
|
1758
|
-
this.onStart = attrs.onStart || function() {};
|
1759
|
-
this.resultCallback = attrs.resultCallback || function() {};
|
1760
|
-
this.clearStack = attrs.clearStack || function(fn) {fn();};
|
1761
|
-
|
1762
|
-
this.beforeFns = [];
|
1763
|
-
this.afterFns = [];
|
1764
|
-
this.queueRunner = attrs.queueRunner || function() {};
|
1765
|
-
this.disabled = false;
|
1766
|
-
|
1767
|
-
this.children = [];
|
1768
|
-
|
1769
|
-
this.result = {
|
1770
|
-
id: this.id,
|
1771
|
-
status: this.disabled ? 'disabled' : '',
|
1772
|
-
description: this.description,
|
1773
|
-
fullName: this.getFullName()
|
1774
|
-
};
|
2436
|
+
getJasmineRequireObj().ArrayContaining = function(j$) {
|
2437
|
+
function ArrayContaining(sample) {
|
2438
|
+
this.sample = sample;
|
1775
2439
|
}
|
1776
2440
|
|
1777
|
-
|
1778
|
-
var
|
1779
|
-
|
1780
|
-
|
1781
|
-
|
2441
|
+
ArrayContaining.prototype.asymmetricMatch = function(other) {
|
2442
|
+
var className = Object.prototype.toString.call(this.sample);
|
2443
|
+
if (className !== '[object Array]') { throw new Error('You must provide an array to arrayContaining, not \'' + this.sample + '\'.'); }
|
2444
|
+
|
2445
|
+
for (var i = 0; i < this.sample.length; i++) {
|
2446
|
+
var item = this.sample[i];
|
2447
|
+
if (!j$.matchersUtil.contains(other, item)) {
|
2448
|
+
return false;
|
1782
2449
|
}
|
1783
2450
|
}
|
1784
|
-
return fullName;
|
1785
|
-
};
|
1786
2451
|
|
1787
|
-
|
1788
|
-
this.disabled = true;
|
1789
|
-
this.result.status = 'disabled';
|
2452
|
+
return true;
|
1790
2453
|
};
|
1791
2454
|
|
1792
|
-
|
1793
|
-
|
2455
|
+
ArrayContaining.prototype.jasmineToString = function () {
|
2456
|
+
return '<jasmine.arrayContaining(' + jasmine.pp(this.sample) +')>';
|
1794
2457
|
};
|
1795
2458
|
|
1796
|
-
|
1797
|
-
|
1798
|
-
};
|
2459
|
+
return ArrayContaining;
|
2460
|
+
};
|
1799
2461
|
|
1800
|
-
|
1801
|
-
this.children.push(child);
|
1802
|
-
};
|
2462
|
+
getJasmineRequireObj().ObjectContaining = function(j$) {
|
1803
2463
|
|
1804
|
-
|
1805
|
-
|
2464
|
+
function ObjectContaining(sample) {
|
2465
|
+
this.sample = sample;
|
2466
|
+
}
|
1806
2467
|
|
1807
|
-
|
2468
|
+
function getPrototype(obj) {
|
2469
|
+
if (Object.getPrototypeOf) {
|
2470
|
+
return Object.getPrototypeOf(obj);
|
2471
|
+
}
|
1808
2472
|
|
1809
|
-
if (
|
1810
|
-
|
1811
|
-
return;
|
2473
|
+
if (obj.constructor.prototype == obj) {
|
2474
|
+
return null;
|
1812
2475
|
}
|
1813
2476
|
|
1814
|
-
|
2477
|
+
return obj.constructor.prototype;
|
2478
|
+
}
|
1815
2479
|
|
1816
|
-
|
1817
|
-
|
2480
|
+
function hasProperty(obj, property) {
|
2481
|
+
if (!obj) {
|
2482
|
+
return false;
|
1818
2483
|
}
|
1819
2484
|
|
1820
|
-
|
1821
|
-
|
1822
|
-
|
1823
|
-
});
|
2485
|
+
if (Object.prototype.hasOwnProperty.call(obj, property)) {
|
2486
|
+
return true;
|
2487
|
+
}
|
1824
2488
|
|
1825
|
-
|
1826
|
-
|
2489
|
+
return hasProperty(getPrototype(obj), property);
|
2490
|
+
}
|
1827
2491
|
|
1828
|
-
|
1829
|
-
|
2492
|
+
ObjectContaining.prototype.asymmetricMatch = function(other) {
|
2493
|
+
if (typeof(this.sample) !== 'object') { throw new Error('You must provide an object to objectContaining, not \''+this.sample+'\'.'); }
|
2494
|
+
|
2495
|
+
for (var property in this.sample) {
|
2496
|
+
if (!hasProperty(other, property) ||
|
2497
|
+
!j$.matchersUtil.equals(this.sample[property], other[property])) {
|
2498
|
+
return false;
|
1830
2499
|
}
|
1831
2500
|
}
|
1832
2501
|
|
1833
|
-
|
1834
|
-
return function(done) { child.execute(done); };
|
1835
|
-
}
|
2502
|
+
return true;
|
1836
2503
|
};
|
1837
2504
|
|
1838
|
-
|
1839
|
-
|
2505
|
+
ObjectContaining.prototype.jasmineToString = function() {
|
2506
|
+
return '<jasmine.objectContaining(' + j$.pp(this.sample) + ')>';
|
2507
|
+
};
|
1840
2508
|
|
1841
|
-
|
1842
|
-
|
1843
|
-
}
|
2509
|
+
return ObjectContaining;
|
2510
|
+
};
|
1844
2511
|
|
1845
|
-
getJasmineRequireObj().
|
1846
|
-
var defaultNow = (function(Date) {
|
1847
|
-
return function() { return new Date().getTime(); };
|
1848
|
-
})(Date);
|
2512
|
+
getJasmineRequireObj().StringMatching = function(j$) {
|
1849
2513
|
|
1850
|
-
function
|
1851
|
-
|
2514
|
+
function StringMatching(expected) {
|
2515
|
+
if (!j$.isString_(expected) && !j$.isA_('RegExp', expected)) {
|
2516
|
+
throw new Error('Expected is not a String or a RegExp');
|
2517
|
+
}
|
1852
2518
|
|
1853
|
-
|
1854
|
-
|
2519
|
+
this.regexp = new RegExp(expected);
|
2520
|
+
}
|
1855
2521
|
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
2522
|
+
StringMatching.prototype.asymmetricMatch = function(other) {
|
2523
|
+
return this.regexp.test(other);
|
2524
|
+
};
|
1859
2525
|
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
1863
|
-
}
|
2526
|
+
StringMatching.prototype.jasmineToString = function() {
|
2527
|
+
return '<jasmine.stringMatching(' + this.regexp + ')>';
|
2528
|
+
};
|
1864
2529
|
|
1865
|
-
return
|
2530
|
+
return StringMatching;
|
1866
2531
|
};
|
1867
2532
|
|
2533
|
+
getJasmineRequireObj().errors = function() {
|
2534
|
+
function ExpectationFailed() {}
|
2535
|
+
|
2536
|
+
ExpectationFailed.prototype = new Error();
|
2537
|
+
ExpectationFailed.prototype.constructor = ExpectationFailed;
|
2538
|
+
|
2539
|
+
return {
|
2540
|
+
ExpectationFailed: ExpectationFailed
|
2541
|
+
};
|
2542
|
+
};
|
1868
2543
|
getJasmineRequireObj().matchersUtil = function(j$) {
|
1869
2544
|
// TODO: what to do about jasmine.pp not being inject? move to JSON.stringify? gut PrettyPrinter?
|
1870
2545
|
|
@@ -1878,7 +2553,9 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
|
1878
2553
|
contains: function(haystack, needle, customTesters) {
|
1879
2554
|
customTesters = customTesters || [];
|
1880
2555
|
|
1881
|
-
if (Object.prototype.toString.apply(haystack) === '[object Array]')
|
2556
|
+
if ((Object.prototype.toString.apply(haystack) === '[object Array]') ||
|
2557
|
+
(!!haystack && !haystack.indexOf))
|
2558
|
+
{
|
1882
2559
|
for (var i = 0; i < haystack.length; i++) {
|
1883
2560
|
if (eq(haystack[i], needle, [], [], customTesters)) {
|
1884
2561
|
return true;
|
@@ -1886,6 +2563,7 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
|
1886
2563
|
}
|
1887
2564
|
return false;
|
1888
2565
|
}
|
2566
|
+
|
1889
2567
|
return !!haystack && haystack.indexOf(needle) >= 0;
|
1890
2568
|
},
|
1891
2569
|
|
@@ -1915,11 +2593,37 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
|
1915
2593
|
}
|
1916
2594
|
};
|
1917
2595
|
|
2596
|
+
function isAsymmetric(obj) {
|
2597
|
+
return obj && j$.isA_('Function', obj.asymmetricMatch);
|
2598
|
+
}
|
2599
|
+
|
2600
|
+
function asymmetricMatch(a, b) {
|
2601
|
+
var asymmetricA = isAsymmetric(a),
|
2602
|
+
asymmetricB = isAsymmetric(b);
|
2603
|
+
|
2604
|
+
if (asymmetricA && asymmetricB) {
|
2605
|
+
return undefined;
|
2606
|
+
}
|
2607
|
+
|
2608
|
+
if (asymmetricA) {
|
2609
|
+
return a.asymmetricMatch(b);
|
2610
|
+
}
|
2611
|
+
|
2612
|
+
if (asymmetricB) {
|
2613
|
+
return b.asymmetricMatch(a);
|
2614
|
+
}
|
2615
|
+
}
|
2616
|
+
|
1918
2617
|
// Equality function lovingly adapted from isEqual in
|
1919
2618
|
// [Underscore](http://underscorejs.org)
|
1920
2619
|
function eq(a, b, aStack, bStack, customTesters) {
|
1921
2620
|
var result = true;
|
1922
2621
|
|
2622
|
+
var asymmetricResult = asymmetricMatch(a, b);
|
2623
|
+
if (!j$.util.isUndefined(asymmetricResult)) {
|
2624
|
+
return asymmetricResult;
|
2625
|
+
}
|
2626
|
+
|
1923
2627
|
for (var i = 0; i < customTesters.length; i++) {
|
1924
2628
|
var customTesterResult = customTesters[i](a, b);
|
1925
2629
|
if (!j$.util.isUndefined(customTesterResult)) {
|
@@ -1927,27 +2631,6 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
|
1927
2631
|
}
|
1928
2632
|
}
|
1929
2633
|
|
1930
|
-
if (a instanceof j$.Any) {
|
1931
|
-
result = a.jasmineMatches(b);
|
1932
|
-
if (result) {
|
1933
|
-
return true;
|
1934
|
-
}
|
1935
|
-
}
|
1936
|
-
|
1937
|
-
if (b instanceof j$.Any) {
|
1938
|
-
result = b.jasmineMatches(a);
|
1939
|
-
if (result) {
|
1940
|
-
return true;
|
1941
|
-
}
|
1942
|
-
}
|
1943
|
-
|
1944
|
-
if (b instanceof j$.ObjectContaining) {
|
1945
|
-
result = b.jasmineMatches(a);
|
1946
|
-
if (result) {
|
1947
|
-
return true;
|
1948
|
-
}
|
1949
|
-
}
|
1950
|
-
|
1951
2634
|
if (a instanceof Error && b instanceof Error) {
|
1952
2635
|
return a.message == b.message;
|
1953
2636
|
}
|
@@ -1983,6 +2666,29 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
|
1983
2666
|
a.ignoreCase == b.ignoreCase;
|
1984
2667
|
}
|
1985
2668
|
if (typeof a != 'object' || typeof b != 'object') { return false; }
|
2669
|
+
|
2670
|
+
var aIsDomNode = j$.isDomNode(a);
|
2671
|
+
var bIsDomNode = j$.isDomNode(b);
|
2672
|
+
if (aIsDomNode && bIsDomNode) {
|
2673
|
+
// At first try to use DOM3 method isEqualNode
|
2674
|
+
if (a.isEqualNode) {
|
2675
|
+
return a.isEqualNode(b);
|
2676
|
+
}
|
2677
|
+
// IE8 doesn't support isEqualNode, try to use outerHTML && innerText
|
2678
|
+
var aIsElement = a instanceof Element;
|
2679
|
+
var bIsElement = b instanceof Element;
|
2680
|
+
if (aIsElement && bIsElement) {
|
2681
|
+
return a.outerHTML == b.outerHTML;
|
2682
|
+
}
|
2683
|
+
if (aIsElement || bIsElement) {
|
2684
|
+
return false;
|
2685
|
+
}
|
2686
|
+
return a.innerText == b.innerText && a.textContent == b.textContent;
|
2687
|
+
}
|
2688
|
+
if (aIsDomNode || bIsDomNode) {
|
2689
|
+
return false;
|
2690
|
+
}
|
2691
|
+
|
1986
2692
|
// Assume equality for cyclic structures. The algorithm for detecting cyclic
|
1987
2693
|
// structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
|
1988
2694
|
var length = aStack.length;
|
@@ -1996,23 +2702,20 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
|
1996
2702
|
bStack.push(b);
|
1997
2703
|
var size = 0;
|
1998
2704
|
// Recursively compare objects and arrays.
|
1999
|
-
if
|
2000
|
-
|
2001
|
-
|
2002
|
-
|
2003
|
-
|
2004
|
-
|
2005
|
-
while (size--) {
|
2006
|
-
if (!(result = eq(a[size], b[size], aStack, bStack, customTesters))) { break; }
|
2007
|
-
}
|
2008
|
-
}
|
2009
|
-
} else {
|
2705
|
+
// Compare array lengths to determine if a deep comparison is necessary.
|
2706
|
+
if (className == '[object Array]' && a.length !== b.length) {
|
2707
|
+
result = false;
|
2708
|
+
}
|
2709
|
+
|
2710
|
+
if (result) {
|
2010
2711
|
// Objects with different constructors are not equivalent, but `Object`s
|
2011
|
-
// from different frames are.
|
2012
|
-
|
2013
|
-
|
2014
|
-
|
2015
|
-
|
2712
|
+
// or `Array`s from different frames are.
|
2713
|
+
if (className !== '[object Array]') {
|
2714
|
+
var aCtor = a.constructor, bCtor = b.constructor;
|
2715
|
+
if (aCtor !== bCtor && !(isFunction(aCtor) && aCtor instanceof aCtor &&
|
2716
|
+
isFunction(bCtor) && bCtor instanceof bCtor)) {
|
2717
|
+
return false;
|
2718
|
+
}
|
2016
2719
|
}
|
2017
2720
|
// Deep compare objects.
|
2018
2721
|
for (var key in a) {
|
@@ -2038,7 +2741,7 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
|
2038
2741
|
return result;
|
2039
2742
|
|
2040
2743
|
function has(obj, key) {
|
2041
|
-
return
|
2744
|
+
return Object.prototype.hasOwnProperty.call(obj, key);
|
2042
2745
|
}
|
2043
2746
|
|
2044
2747
|
function isFunction(obj) {
|
@@ -2307,11 +3010,15 @@ getJasmineRequireObj().toHaveBeenCalledWith = function(j$) {
|
|
2307
3010
|
return toHaveBeenCalledWith;
|
2308
3011
|
};
|
2309
3012
|
|
2310
|
-
getJasmineRequireObj().toMatch = function() {
|
3013
|
+
getJasmineRequireObj().toMatch = function(j$) {
|
2311
3014
|
|
2312
3015
|
function toMatch() {
|
2313
3016
|
return {
|
2314
3017
|
compare: function(actual, expected) {
|
3018
|
+
if (!j$.isString_(expected) && !j$.isA_('RegExp', expected)) {
|
3019
|
+
throw new Error('Expected is not a String or a RegExp');
|
3020
|
+
}
|
3021
|
+
|
2315
3022
|
var regexp = new RegExp(expected);
|
2316
3023
|
|
2317
3024
|
return {
|
@@ -2378,18 +3085,13 @@ getJasmineRequireObj().toThrowError = function(j$) {
|
|
2378
3085
|
var threw = false,
|
2379
3086
|
pass = {pass: true},
|
2380
3087
|
fail = {pass: false},
|
2381
|
-
thrown
|
2382
|
-
errorType,
|
2383
|
-
message,
|
2384
|
-
regexp,
|
2385
|
-
name,
|
2386
|
-
constructorName;
|
3088
|
+
thrown;
|
2387
3089
|
|
2388
3090
|
if (typeof actual != 'function') {
|
2389
3091
|
throw new Error('Actual is not a Function');
|
2390
3092
|
}
|
2391
3093
|
|
2392
|
-
|
3094
|
+
var errorMatcher = getMatcher.apply(null, arguments);
|
2393
3095
|
|
2394
3096
|
try {
|
2395
3097
|
actual();
|
@@ -2408,121 +3110,104 @@ getJasmineRequireObj().toThrowError = function(j$) {
|
|
2408
3110
|
return fail;
|
2409
3111
|
}
|
2410
3112
|
|
2411
|
-
if (
|
2412
|
-
pass.message = 'Expected function not to throw an Error, but it threw ' + fnNameFor(thrown) + '.';
|
3113
|
+
if (errorMatcher.hasNoSpecifics()) {
|
3114
|
+
pass.message = 'Expected function not to throw an Error, but it threw ' + j$.fnNameFor(thrown) + '.';
|
2413
3115
|
return pass;
|
2414
3116
|
}
|
2415
3117
|
|
2416
|
-
if (
|
2417
|
-
|
2418
|
-
|
3118
|
+
if (errorMatcher.matches(thrown)) {
|
3119
|
+
pass.message = function() {
|
3120
|
+
return 'Expected function not to throw ' + errorMatcher.errorTypeDescription + errorMatcher.messageDescription() + '.';
|
3121
|
+
};
|
3122
|
+
return pass;
|
3123
|
+
} else {
|
3124
|
+
fail.message = function() {
|
3125
|
+
return 'Expected function to throw ' + errorMatcher.errorTypeDescription + errorMatcher.messageDescription() +
|
3126
|
+
', but it threw ' + errorMatcher.thrownDescription(thrown) + '.';
|
3127
|
+
};
|
3128
|
+
return fail;
|
2419
3129
|
}
|
3130
|
+
}
|
3131
|
+
};
|
2420
3132
|
|
2421
|
-
|
2422
|
-
|
2423
|
-
|
2424
|
-
return pass;
|
2425
|
-
} else {
|
2426
|
-
fail.message = function() { return 'Expected function to throw ' + name + ' with message ' + j$.pp(message) +
|
2427
|
-
', but it threw ' + constructorName + ' with message ' + j$.pp(thrown.message) + '.'; };
|
2428
|
-
return fail;
|
2429
|
-
}
|
2430
|
-
}
|
3133
|
+
function getMatcher() {
|
3134
|
+
var expected = null,
|
3135
|
+
errorType = null;
|
2431
3136
|
|
2432
|
-
|
2433
|
-
|
2434
|
-
|
2435
|
-
|
2436
|
-
|
2437
|
-
fail.message = function() { return 'Expected function to throw ' + name + ' with message matching ' + j$.pp(regexp) +
|
2438
|
-
', but it threw ' + constructorName + ' with message ' + j$.pp(thrown.message) + '.'; };
|
2439
|
-
return fail;
|
2440
|
-
}
|
3137
|
+
if (arguments.length == 2) {
|
3138
|
+
expected = arguments[1];
|
3139
|
+
if (isAnErrorType(expected)) {
|
3140
|
+
errorType = expected;
|
3141
|
+
expected = null;
|
2441
3142
|
}
|
2442
|
-
|
2443
|
-
|
2444
|
-
|
2445
|
-
|
2446
|
-
|
2447
|
-
} else {
|
2448
|
-
fail.message = 'Expected function to throw ' + name + ', but it threw ' + constructorName + '.';
|
2449
|
-
return fail;
|
2450
|
-
}
|
3143
|
+
} else if (arguments.length > 2) {
|
3144
|
+
errorType = arguments[1];
|
3145
|
+
expected = arguments[2];
|
3146
|
+
if (!isAnErrorType(errorType)) {
|
3147
|
+
throw new Error('Expected error type is not an Error.');
|
2451
3148
|
}
|
3149
|
+
}
|
2452
3150
|
|
2453
|
-
|
2454
|
-
|
2455
|
-
|
2456
|
-
|
2457
|
-
|
2458
|
-
fail.message = function() { return 'Expected function to throw an exception with message ' + j$.pp(message) +
|
2459
|
-
', but it threw an exception with message ' + j$.pp(thrown.message) + '.'; };
|
2460
|
-
return fail;
|
2461
|
-
}
|
3151
|
+
if (expected && !isStringOrRegExp(expected)) {
|
3152
|
+
if (errorType) {
|
3153
|
+
throw new Error('Expected error message is not a string or RegExp.');
|
3154
|
+
} else {
|
3155
|
+
throw new Error('Expected is not an Error, string, or RegExp.');
|
2462
3156
|
}
|
3157
|
+
}
|
2463
3158
|
|
2464
|
-
|
2465
|
-
|
2466
|
-
|
2467
|
-
|
2468
|
-
|
2469
|
-
fail.message = function() { return 'Expected function to throw an exception with a message matching ' + j$.pp(regexp) +
|
2470
|
-
', but it threw an exception with message ' + j$.pp(thrown.message) + '.'; };
|
2471
|
-
return fail;
|
2472
|
-
}
|
3159
|
+
function messageMatch(message) {
|
3160
|
+
if (typeof expected == 'string') {
|
3161
|
+
return expected == message;
|
3162
|
+
} else {
|
3163
|
+
return expected.test(message);
|
2473
3164
|
}
|
3165
|
+
}
|
2474
3166
|
|
2475
|
-
|
2476
|
-
|
2477
|
-
|
3167
|
+
return {
|
3168
|
+
errorTypeDescription: errorType ? j$.fnNameFor(errorType) : 'an exception',
|
3169
|
+
thrownDescription: function(thrown) {
|
3170
|
+
var thrownName = errorType ? j$.fnNameFor(thrown.constructor) : 'an exception',
|
3171
|
+
thrownMessage = '';
|
2478
3172
|
|
2479
|
-
|
2480
|
-
|
2481
|
-
return;
|
3173
|
+
if (expected) {
|
3174
|
+
thrownMessage = ' with message ' + j$.pp(thrown.message);
|
2482
3175
|
}
|
2483
3176
|
|
2484
|
-
|
2485
|
-
|
2486
|
-
|
2487
|
-
|
2488
|
-
|
2489
|
-
|
2490
|
-
|
2491
|
-
} else if (checkForAnErrorType(expected)) {
|
2492
|
-
errorType = expected;
|
2493
|
-
}
|
2494
|
-
|
2495
|
-
if (!(errorType || message || regexp)) {
|
2496
|
-
throw new Error('Expected is not an Error, string, or RegExp.');
|
2497
|
-
}
|
3177
|
+
return thrownName + thrownMessage;
|
3178
|
+
},
|
3179
|
+
messageDescription: function() {
|
3180
|
+
if (expected === null) {
|
3181
|
+
return '';
|
3182
|
+
} else if (expected instanceof RegExp) {
|
3183
|
+
return ' with a message matching ' + j$.pp(expected);
|
2498
3184
|
} else {
|
2499
|
-
|
2500
|
-
errorType = arguments[1];
|
2501
|
-
} else {
|
2502
|
-
throw new Error('Expected error type is not an Error.');
|
2503
|
-
}
|
2504
|
-
|
2505
|
-
if (arguments[2] instanceof RegExp) {
|
2506
|
-
regexp = arguments[2];
|
2507
|
-
} else if (typeof arguments[2] == 'string') {
|
2508
|
-
message = arguments[2];
|
2509
|
-
} else {
|
2510
|
-
throw new Error('Expected error message is not a string or RegExp.');
|
2511
|
-
}
|
3185
|
+
return ' with message ' + j$.pp(expected);
|
2512
3186
|
}
|
3187
|
+
},
|
3188
|
+
hasNoSpecifics: function() {
|
3189
|
+
return expected === null && errorType === null;
|
3190
|
+
},
|
3191
|
+
matches: function(error) {
|
3192
|
+
return (errorType === null || error instanceof errorType) &&
|
3193
|
+
(expected === null || messageMatch(error.message));
|
2513
3194
|
}
|
3195
|
+
};
|
3196
|
+
}
|
2514
3197
|
|
2515
|
-
|
2516
|
-
|
2517
|
-
|
2518
|
-
}
|
3198
|
+
function isStringOrRegExp(potential) {
|
3199
|
+
return potential instanceof RegExp || (typeof potential == 'string');
|
3200
|
+
}
|
2519
3201
|
|
2520
|
-
|
2521
|
-
|
2522
|
-
|
2523
|
-
}
|
3202
|
+
function isAnErrorType(type) {
|
3203
|
+
if (typeof type !== 'function') {
|
3204
|
+
return false;
|
2524
3205
|
}
|
2525
|
-
|
3206
|
+
|
3207
|
+
var Surrogate = function() {};
|
3208
|
+
Surrogate.prototype = type.prototype;
|
3209
|
+
return (new Surrogate()) instanceof Error;
|
3210
|
+
}
|
2526
3211
|
}
|
2527
3212
|
|
2528
3213
|
return toThrowError;
|
@@ -2538,20 +3223,36 @@ getJasmineRequireObj().interface = function(jasmine, env) {
|
|
2538
3223
|
return env.xdescribe(description, specDefinitions);
|
2539
3224
|
},
|
2540
3225
|
|
2541
|
-
|
2542
|
-
return env.
|
3226
|
+
fdescribe: function(description, specDefinitions) {
|
3227
|
+
return env.fdescribe(description, specDefinitions);
|
3228
|
+
},
|
3229
|
+
|
3230
|
+
it: function() {
|
3231
|
+
return env.it.apply(env, arguments);
|
2543
3232
|
},
|
2544
3233
|
|
2545
|
-
xit: function(
|
2546
|
-
return env.xit(
|
3234
|
+
xit: function() {
|
3235
|
+
return env.xit.apply(env, arguments);
|
2547
3236
|
},
|
2548
3237
|
|
2549
|
-
|
2550
|
-
return env.
|
3238
|
+
fit: function() {
|
3239
|
+
return env.fit.apply(env, arguments);
|
2551
3240
|
},
|
2552
3241
|
|
2553
|
-
|
2554
|
-
return env.
|
3242
|
+
beforeEach: function() {
|
3243
|
+
return env.beforeEach.apply(env, arguments);
|
3244
|
+
},
|
3245
|
+
|
3246
|
+
afterEach: function() {
|
3247
|
+
return env.afterEach.apply(env, arguments);
|
3248
|
+
},
|
3249
|
+
|
3250
|
+
beforeAll: function() {
|
3251
|
+
return env.beforeAll.apply(env, arguments);
|
3252
|
+
},
|
3253
|
+
|
3254
|
+
afterAll: function() {
|
3255
|
+
return env.afterAll.apply(env, arguments);
|
2555
3256
|
},
|
2556
3257
|
|
2557
3258
|
expect: function(actual) {
|
@@ -2559,7 +3260,11 @@ getJasmineRequireObj().interface = function(jasmine, env) {
|
|
2559
3260
|
},
|
2560
3261
|
|
2561
3262
|
pending: function() {
|
2562
|
-
return env.pending();
|
3263
|
+
return env.pending.apply(env, arguments);
|
3264
|
+
},
|
3265
|
+
|
3266
|
+
fail: function() {
|
3267
|
+
return env.fail.apply(env, arguments);
|
2563
3268
|
},
|
2564
3269
|
|
2565
3270
|
spyOn: function(obj, methodName) {
|
@@ -2589,5 +3294,5 @@ getJasmineRequireObj().interface = function(jasmine, env) {
|
|
2589
3294
|
};
|
2590
3295
|
|
2591
3296
|
getJasmineRequireObj().version = function() {
|
2592
|
-
return '2.
|
3297
|
+
return '2.3.4';
|
2593
3298
|
};
|