Remove jasmine.util.extend

This commit is contained in:
Davis W. Frank
2012-12-08 11:48:11 -08:00
parent 4ad43267ab
commit 668dd784ef
8 changed files with 32 additions and 46 deletions
+14 -3
View File
@@ -14,9 +14,13 @@
### Hard ### Hard
* Finish killing Globals * Finish killing Globals
* Guidlines: everything that isn't a CTOR should be closed inside `Env`, and everything that is a CTOR needs to be `new`ed inside the `Env` * Guidelines: everything that isn't a CTOR should be closed inside `Env`, and everything that is a CTOR needs to be `new`ed inside the `Env`
* Spies * Spies
* jasmine.util should be util closure inside of env or something * jasmine.util should be util closure inside of env or something
* argsToArray is used for Spies and matching
* inherit is for how matchers are added/mixed in, reporters, and pretty printers
* formatException is used only inside Env/spec
* htmlEscape is for messages in matchers - should this be HTML at all? Is that Reporter responsibility?
* Suites need to be unit-tested * Suites need to be unit-tested
* Remove Queue from Suite in favor of queuerunner refactoring * Remove Queue from Suite in favor of queuerunner refactoring
* Remover Runner in favor of a top-level Suite * Remover Runner in favor of a top-level Suite
@@ -24,5 +28,12 @@
* get feature parity back on HTMLReporter * get feature parity back on HTMLReporter
### Easy ### Easy
* Refactor `queuerunner` into a new object * Refactor `queuerunner` into a new object
* xdescribe / xit make skipped specs instead of empty blocks * xdescribe / xit make skipped specs instead of empty blocks
## Other Topics
* Build - can we, should we redo the build and release process AGAIN in order to make it less arcane
* Docs
* JsDoc is a pain to host and RubyMine is pretty good at navigating. I say we kill it officially
* Docco has gone over well. Should we annotate all the sources and then have Pages be more complex, having tutorials and annotated source like Backbone? Are we small enough?
+7 -2
View File
@@ -48,9 +48,9 @@
}; };
if (typeof window == "undefined" && typeof exports == "object") { if (typeof window == "undefined" && typeof exports == "object") {
jasmine.util.extend(exports, jasmineInterface); extend(exports, jasmineInterface);
} else { } else {
jasmine.util.extend(window, jasmineInterface); extend(window, jasmineInterface);
} }
var htmlReporter = new jasmine.HtmlReporter(null, jasmine, env); var htmlReporter = new jasmine.HtmlReporter(null, jasmine, env);
@@ -71,4 +71,9 @@
env.execute(); env.execute();
}; };
function extend(destination, source) {
for (var property in source) destination[property] = source[property];
return destination;
}
}()); }());
+1
View File
@@ -282,6 +282,7 @@ jasmine.HtmlReporter.ReporterView = function(dom, jasmine, catchExceptions) {
this.specComplete = function(result) { this.specComplete = function(result) {
this.completeSpecCount++; this.completeSpecCount++;
//TODO: this needs to work in order to get blanks for skipped specs.
// if (isUndefined(this.views.specs[result.id])) { // if (isUndefined(this.views.specs[result.id])) {
// this.views.specs[result.id] = new this.jasmine.HtmlReporter.SpecView(result, dom); // this.views.specs[result.id] = new this.jasmine.HtmlReporter.SpecView(result, dom);
// } // }
-5
View File
@@ -445,11 +445,6 @@ jasmine.util.argsToArray = function(args) {
return arrayOfArgs; return arrayOfArgs;
}; };
jasmine.util.extend = function(destination, source) {
for (var property in source) destination[property] = source[property];
return destination;
};
//TODO: expectation result may make more sense as a presentation of an expectation. //TODO: expectation result may make more sense as a presentation of an expectation.
jasmine.buildExpectationResult = function(params) { jasmine.buildExpectationResult = function(params) {
return { return {
+9 -4
View File
@@ -124,15 +124,15 @@ describe("ConsoleReporter", function() {
}); });
it("prints the proper output under a failure scenario.", function() { it("prints the proper output under a failure scenario.", function() {
var base1 = jasmine.util.extend({}, failingSpec), var base1 = extend({}, failingSpec),
failingSpec1 = jasmine.util.extend(base1, { failingSpec1 = extend(base1, {
fullName: 'The oven heats up', fullName: 'The oven heats up',
failedExpectations: [ failedExpectations: [
{trace:{stack:"stack trace one\n second line"}}, {trace:{stack:"stack trace one\n second line"}},
{trace:{stack:"stack trace two"}} {trace:{stack:"stack trace two"}}
]}), ]}),
base2 = jasmine.util.extend({}, failingSpec), base2 = extend({}, failingSpec),
failingSpec2 = jasmine.util.extend(base2, { failingSpec2 = extend(base2, {
fullName: "The washing machine washes clothes", fullName: "The washing machine washes clothes",
failedExpectations: [ failedExpectations: [
{trace:{stack:"stack trace one"}} {trace:{stack:"stack trace one"}}
@@ -284,4 +284,9 @@ describe("ConsoleReporter", function() {
}); });
}); });
}); });
function extend(destination, source) {
for (var property in source) destination[property] = source[property];
return destination;
}
}); });
-22
View File
@@ -1,26 +1,4 @@
describe("jasmine.util", function() { describe("jasmine.util", function() {
describe("extend", function () {
it("should add properies to a destination object ", function() {
var destination = {baz: 'baz'};
jasmine.util.extend(destination, {
foo: 'foo', bar: 'bar'
});
expect(destination).toEqual({foo: 'foo', bar: 'bar', baz: 'baz'});
});
it("should replace properies that already exist on a destination object", function() {
var destination = {foo: 'foo'};
jasmine.util.extend(destination, {
foo: 'bar'
});
expect(destination).toEqual({foo: 'bar'});
jasmine.util.extend(destination, {
foo: null
});
expect(destination).toEqual({foo: null});
});
});
describe("isArray_", function() { describe("isArray_", function() {
it("should return true if the argument is an array", function() { it("should return true if the argument is an array", function() {
expect(jasmine.isArray_([])).toBe(true); expect(jasmine.isArray_([])).toBe(true);
-3
View File
@@ -1,5 +1,2 @@
var originalJasmine = jasmine; var originalJasmine = jasmine;
//copy clock methods back into window,
//so second jasmine load doesn't use jasmine clock methods.
jasmine.util.extend(window, jasmine.Clock.real);
jasmine = null; jasmine = null;
-6
View File
@@ -59,9 +59,3 @@ jasmine.util.argsToArray = function(args) {
for (var i = 0; i < args.length; i++) arrayOfArgs.push(args[i]); for (var i = 0; i < args.length; i++) arrayOfArgs.push(args[i]);
return arrayOfArgs; return arrayOfArgs;
}; };
jasmine.util.extend = function(destination, source) {
for (var property in source) destination[property] = source[property];
return destination;
};