diff options
| author | Misko Hevery | 2010-05-10 20:24:20 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-05-10 20:24:20 -0700 |
| commit | 5dda723185a9037b7e92828d32430c21838ee216 (patch) | |
| tree | 15e12ff20e020bb524d704bc7e0d2f8d1f6f1b40 /lib | |
| parent | f5027cc375cf29d8a78679297d9f6bdca9567eb7 (diff) | |
| download | angular.js-5dda723185a9037b7e92828d32430c21838ee216.tar.bz2 | |
improved handling of text fields when formater fails to prevent clobering of field
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/jasmine-jstd-adapter/JasmineAdapter.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/jasmine-jstd-adapter/JasmineAdapter.js b/lib/jasmine-jstd-adapter/JasmineAdapter.js index ba54251a..0fdc4612 100644 --- a/lib/jasmine-jstd-adapter/JasmineAdapter.js +++ b/lib/jasmine-jstd-adapter/JasmineAdapter.js @@ -9,7 +9,7 @@ function bind(_this, _function){ return function(){ return _function.call(_this); - } + }; } var currentFrame = frame(null, null); @@ -49,14 +49,22 @@ })(jasmine.Env.prototype.describe); + var id = 0; jasmine.Env.prototype.it = (function(it){ return function(desc, itFn){ var self = this; var spec = it.apply(this, arguments); var currentSpec = this.currentSpec; + if (!currentSpec.$id) { + currentSpec.$id = id++; + } var frame = this.jstdFrame = currentFrame; - this.jstdFrame.testCase.prototype['test that it ' + desc] = function(){ + var name = 'test that it ' + desc; + if (this.jstdFrame.testCase.prototype[name]) + throw "Spec with name '" + desc + "' already exists."; + this.jstdFrame.testCase.prototype[name] = function(){ + jasmine.getEnv().currentSpec = currentSpec; frame.runBefore.apply(currentSpec); try { itFn.apply(currentSpec); |
