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

View File

@@ -14,9 +14,13 @@
### Hard
* 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
* 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
* Remove Queue from Suite in favor of queuerunner refactoring
* Remover Runner in favor of a top-level Suite
@@ -24,5 +28,12 @@
* get feature parity back on HTMLReporter
### Easy
* Refactor `queuerunner` into a new object
* xdescribe / xit make skipped specs instead of empty blocks
* Refactor `queuerunner` into a new object
* 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?

View File

@@ -48,9 +48,9 @@
};
if (typeof window == "undefined" && typeof exports == "object") {
jasmine.util.extend(exports, jasmineInterface);
extend(exports, jasmineInterface);
} else {
jasmine.util.extend(window, jasmineInterface);
extend(window, jasmineInterface);
}
var htmlReporter = new jasmine.HtmlReporter(null, jasmine, env);
@@ -71,4 +71,9 @@
env.execute();
};
function extend(destination, source) {
for (var property in source) destination[property] = source[property];
return destination;
}
}());

View File

@@ -282,6 +282,7 @@ jasmine.HtmlReporter.ReporterView = function(dom, jasmine, catchExceptions) {
this.specComplete = function(result) {
this.completeSpecCount++;
//TODO: this needs to work in order to get blanks for skipped specs.
// if (isUndefined(this.views.specs[result.id])) {
// this.views.specs[result.id] = new this.jasmine.HtmlReporter.SpecView(result, dom);
// }

View File

@@ -445,11 +445,6 @@ jasmine.util.argsToArray = function(args) {
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.
jasmine.buildExpectationResult = function(params) {
return {

View File

@@ -124,15 +124,15 @@ describe("ConsoleReporter", function() {
});
it("prints the proper output under a failure scenario.", function() {
var base1 = jasmine.util.extend({}, failingSpec),
failingSpec1 = jasmine.util.extend(base1, {
var base1 = extend({}, failingSpec),
failingSpec1 = extend(base1, {
fullName: 'The oven heats up',
failedExpectations: [
{trace:{stack:"stack trace one\n second line"}},
{trace:{stack:"stack trace two"}}
]}),
base2 = jasmine.util.extend({}, failingSpec),
failingSpec2 = jasmine.util.extend(base2, {
base2 = extend({}, failingSpec),
failingSpec2 = extend(base2, {
fullName: "The washing machine washes clothes",
failedExpectations: [
{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;
}
});

View File

@@ -1,26 +1,4 @@
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() {
it("should return true if the argument is an array", function() {
expect(jasmine.isArray_([])).toBe(true);

View File

@@ -1,5 +1,2 @@
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;

View File

@@ -58,10 +58,4 @@ jasmine.util.argsToArray = function(args) {
var arrayOfArgs = [];
for (var i = 0; i < args.length; i++) arrayOfArgs.push(args[i]);
return arrayOfArgs;
};
jasmine.util.extend = function(destination, source) {
for (var property in source) destination[property] = source[property];
return destination;
};
};