improved handling of text fields when formater fails to prevent clobering of field

This commit is contained in:
Misko Hevery
2010-05-10 20:24:20 -07:00
parent f5027cc375
commit 5dda723185
6 changed files with 203 additions and 99 deletions

View File

@@ -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);