Don't forget to buildDistribution
- Also fix jshint errors [#59947350] #440
This commit is contained in:
@@ -52,6 +52,7 @@ getJasmineRequireObj = (function (jasmineGlobal) {
|
||||
j$.JsApiReporter = jRequire.JsApiReporter();
|
||||
j$.matchersUtil = jRequire.matchersUtil(j$);
|
||||
j$.ObjectContaining = jRequire.ObjectContaining(j$);
|
||||
j$.ArrayContaining = jRequire.ArrayContaining(j$);
|
||||
j$.pp = jRequire.pp(j$);
|
||||
j$.QueueRunner = jRequire.QueueRunner(j$);
|
||||
j$.ReportDispatcher = jRequire.ReportDispatcher();
|
||||
@@ -160,6 +161,10 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
return new j$.StringMatching(expected);
|
||||
};
|
||||
|
||||
j$.arrayContaining = function(sample) {
|
||||
return new j$.ArrayContaining(sample);
|
||||
};
|
||||
|
||||
j$.createSpy = function(name, originalFn) {
|
||||
|
||||
var spyStrategy = new j$.SpyStrategy({
|
||||
@@ -2178,6 +2183,32 @@ getJasmineRequireObj().Anything = function(j$) {
|
||||
return Anything;
|
||||
};
|
||||
|
||||
getJasmineRequireObj().ArrayContaining = function(j$) {
|
||||
function ArrayContaining(sample) {
|
||||
this.sample = sample;
|
||||
}
|
||||
|
||||
ArrayContaining.prototype.asymmetricMatch = function(other) {
|
||||
var className = Object.prototype.toString.call(this.sample);
|
||||
if (className !== '[object Array]') { throw new Error('You must provide an array to arrayContaining, not \'' + this.sample + '\'.'); }
|
||||
|
||||
for (var i = 0; i < this.sample.length; i++) {
|
||||
var item = this.sample[i];
|
||||
if (!j$.matchersUtil.contains(other, item)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
ArrayContaining.prototype.jasmineToString = function () {
|
||||
return '<jasmine.arrayContaining(' + jasmine.pp(this.sample) +')>';
|
||||
};
|
||||
|
||||
return ArrayContaining;
|
||||
};
|
||||
|
||||
getJasmineRequireObj().ObjectContaining = function(j$) {
|
||||
|
||||
function ObjectContaining(sample) {
|
||||
|
||||
@@ -5,7 +5,7 @@ getJasmineRequireObj().ArrayContaining = function(j$) {
|
||||
|
||||
ArrayContaining.prototype.asymmetricMatch = function(other) {
|
||||
var className = Object.prototype.toString.call(this.sample);
|
||||
if (className !== "[object Array]") { throw new Error("You must provide an array to arrayContaining, not '" + this.sample + "'."); }
|
||||
if (className !== '[object Array]') { throw new Error('You must provide an array to arrayContaining, not \'' + this.sample + '\'.'); }
|
||||
|
||||
for (var i = 0; i < this.sample.length; i++) {
|
||||
var item = this.sample[i];
|
||||
@@ -18,7 +18,7 @@ getJasmineRequireObj().ArrayContaining = function(j$) {
|
||||
};
|
||||
|
||||
ArrayContaining.prototype.jasmineToString = function () {
|
||||
return "<jasmine.arrayContaining(" + jasmine.pp(this.sample) +")>";
|
||||
return '<jasmine.arrayContaining(' + jasmine.pp(this.sample) +')>';
|
||||
};
|
||||
|
||||
return ArrayContaining;
|
||||
|
||||
Reference in New Issue
Block a user