jasmine 0.4.6 → 0.10.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -89,7 +89,38 @@ jasmine.getEnv = function() {
|
|
89
89
|
* @returns {Boolean}
|
90
90
|
*/
|
91
91
|
jasmine.isArray_ = function(value) {
|
92
|
-
return
|
92
|
+
return jasmine.isA_("Array", value);
|
93
|
+
};
|
94
|
+
|
95
|
+
/**
|
96
|
+
* @ignore
|
97
|
+
* @private
|
98
|
+
* @param value
|
99
|
+
* @returns {Boolean}
|
100
|
+
*/
|
101
|
+
jasmine.isString_ = function(value) {
|
102
|
+
return jasmine.isA_("String", value);
|
103
|
+
};
|
104
|
+
|
105
|
+
/**
|
106
|
+
* @ignore
|
107
|
+
* @private
|
108
|
+
* @param value
|
109
|
+
* @returns {Boolean}
|
110
|
+
*/
|
111
|
+
jasmine.isNumber_ = function(value) {
|
112
|
+
return jasmine.isA_("Number", value);
|
113
|
+
};
|
114
|
+
|
115
|
+
/**
|
116
|
+
* @ignore
|
117
|
+
* @private
|
118
|
+
* @param {String} typeName
|
119
|
+
* @param value
|
120
|
+
* @returns {Boolean}
|
121
|
+
*/
|
122
|
+
jasmine.isA_ = function(typeName, value) {
|
123
|
+
return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
|
93
124
|
};
|
94
125
|
|
95
126
|
/**
|
@@ -794,6 +825,12 @@ jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) {
|
|
794
825
|
mismatchKeys = mismatchKeys || [];
|
795
826
|
mismatchValues = mismatchValues || [];
|
796
827
|
|
828
|
+
for (var i = 0; i < this.equalityTesters_.length; i++) {
|
829
|
+
var equalityTester = this.equalityTesters_[i];
|
830
|
+
var result = equalityTester(a, b, this, mismatchKeys, mismatchValues);
|
831
|
+
if (result !== jasmine.undefined) return result;
|
832
|
+
}
|
833
|
+
|
797
834
|
if (a === b) return true;
|
798
835
|
|
799
836
|
if (a === jasmine.undefined || a === null || b === jasmine.undefined || b === null) {
|
@@ -816,14 +853,16 @@ jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) {
|
|
816
853
|
return b.matches(a);
|
817
854
|
}
|
818
855
|
|
819
|
-
if (
|
820
|
-
return
|
856
|
+
if (jasmine.isString_(a) && jasmine.isString_(b)) {
|
857
|
+
return (a == b);
|
821
858
|
}
|
822
859
|
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
860
|
+
if (jasmine.isNumber_(a) && jasmine.isNumber_(b)) {
|
861
|
+
return (a == b);
|
862
|
+
}
|
863
|
+
|
864
|
+
if (typeof a === "object" && typeof b === "object") {
|
865
|
+
return this.compareObjects_(a, b, mismatchKeys, mismatchValues);
|
827
866
|
}
|
828
867
|
|
829
868
|
//Straight check
|
@@ -1001,21 +1040,28 @@ jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){
|
|
1001
1040
|
* @param actual
|
1002
1041
|
* @param {jasmine.Spec} spec
|
1003
1042
|
*/
|
1004
|
-
jasmine.Matchers = function(env, actual, spec) {
|
1043
|
+
jasmine.Matchers = function(env, actual, spec, opt_isNot) {
|
1005
1044
|
this.env = env;
|
1006
1045
|
this.actual = actual;
|
1007
1046
|
this.spec = spec;
|
1047
|
+
this.isNot = opt_isNot || false;
|
1008
1048
|
this.reportWasCalled_ = false;
|
1009
1049
|
};
|
1010
1050
|
|
1051
|
+
// todo: @deprecated as of Jasmine 0.11, remove soon [xw]
|
1011
1052
|
jasmine.Matchers.pp = function(str) {
|
1012
|
-
|
1053
|
+
throw new Error("jasmine.Matchers.pp() is no longer supported, please use jasmine.pp() instead!");
|
1054
|
+
this.report();
|
1013
1055
|
};
|
1014
1056
|
|
1015
|
-
/** @deprecated */
|
1057
|
+
/** @deprecated Deprecated as of Jasmine 0.10. Rewrite your custom matchers to return true or false. */
|
1016
1058
|
jasmine.Matchers.prototype.report = function(result, failing_message, details) {
|
1017
|
-
//
|
1018
|
-
|
1059
|
+
// todo: report a deprecation warning [xw]
|
1060
|
+
|
1061
|
+
if (this.isNot) {
|
1062
|
+
throw new Error("As of jasmine 0.11, custom matchers must be implemented differently -- please see jasmine docs");
|
1063
|
+
}
|
1064
|
+
|
1019
1065
|
this.reportWasCalled_ = true;
|
1020
1066
|
var expectationResult = new jasmine.ExpectationResult({
|
1021
1067
|
passed: result,
|
@@ -1038,15 +1084,23 @@ jasmine.Matchers.matcherFn_ = function(matcherName, matcherFunction) {
|
|
1038
1084
|
return function() {
|
1039
1085
|
var matcherArgs = jasmine.util.argsToArray(arguments);
|
1040
1086
|
var result = matcherFunction.apply(this, arguments);
|
1087
|
+
|
1088
|
+
if (this.isNot) {
|
1089
|
+
result = !result;
|
1090
|
+
}
|
1091
|
+
|
1041
1092
|
if (this.reportWasCalled_) return result;
|
1042
1093
|
|
1043
1094
|
var message;
|
1044
1095
|
if (!result) {
|
1045
1096
|
if (this.message) {
|
1046
1097
|
message = this.message.apply(this, arguments);
|
1098
|
+
if (jasmine.isArray_(message)) {
|
1099
|
+
message = message[this.isNot ? 1 : 0];
|
1100
|
+
}
|
1047
1101
|
} else {
|
1048
1102
|
var englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) { return ' ' + s.toLowerCase(); });
|
1049
|
-
message = "Expected " + jasmine.pp(this.actual) + " " + englishyPredicate;
|
1103
|
+
message = "Expected " + jasmine.pp(this.actual) + (this.isNot ? " not " : " ") + englishyPredicate;
|
1050
1104
|
if (matcherArgs.length > 0) {
|
1051
1105
|
for (var i = 0; i < matcherArgs.length; i++) {
|
1052
1106
|
if (i > 0) message += ",";
|
@@ -1167,7 +1221,7 @@ jasmine.Matchers.prototype.wasCalled = function() {
|
|
1167
1221
|
}
|
1168
1222
|
|
1169
1223
|
if (!jasmine.isSpy(this.actual)) {
|
1170
|
-
throw new Error('Expected a spy, but got ' + jasmine.
|
1224
|
+
throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
|
1171
1225
|
}
|
1172
1226
|
|
1173
1227
|
this.message = function() {
|
@@ -1186,7 +1240,7 @@ jasmine.Matchers.prototype.wasNotCalled = function() {
|
|
1186
1240
|
}
|
1187
1241
|
|
1188
1242
|
if (!jasmine.isSpy(this.actual)) {
|
1189
|
-
throw new Error('Expected a spy, but got ' + jasmine.
|
1243
|
+
throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
|
1190
1244
|
}
|
1191
1245
|
|
1192
1246
|
this.message = function() {
|
@@ -1205,7 +1259,7 @@ jasmine.Matchers.prototype.wasNotCalled = function() {
|
|
1205
1259
|
jasmine.Matchers.prototype.wasCalledWith = function() {
|
1206
1260
|
var expectedArgs = jasmine.util.argsToArray(arguments);
|
1207
1261
|
if (!jasmine.isSpy(this.actual)) {
|
1208
|
-
throw new Error('Expected a spy, but got ' + jasmine.
|
1262
|
+
throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
|
1209
1263
|
}
|
1210
1264
|
this.message = function() {
|
1211
1265
|
if (this.actual.callCount == 0) {
|
@@ -1221,7 +1275,7 @@ jasmine.Matchers.prototype.wasCalledWith = function() {
|
|
1221
1275
|
jasmine.Matchers.prototype.wasNotCalledWith = function() {
|
1222
1276
|
var expectedArgs = jasmine.util.argsToArray(arguments);
|
1223
1277
|
if (!jasmine.isSpy(this.actual)) {
|
1224
|
-
throw new Error('Expected a spy, but got ' + jasmine.
|
1278
|
+
throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
|
1225
1279
|
}
|
1226
1280
|
|
1227
1281
|
this.message = function() {
|
@@ -1818,7 +1872,9 @@ jasmine.Spec.prototype.addMatcherResult = function(result) {
|
|
1818
1872
|
};
|
1819
1873
|
|
1820
1874
|
jasmine.Spec.prototype.expect = function(actual) {
|
1821
|
-
|
1875
|
+
var positive = new (this.getMatchersClass_())(this.env, actual, this);
|
1876
|
+
positive.not = new (this.getMatchersClass_())(this.env, actual, this, true);
|
1877
|
+
return positive;
|
1822
1878
|
};
|
1823
1879
|
|
1824
1880
|
jasmine.Spec.prototype.waits = function(timeout) {
|
@@ -1867,8 +1923,7 @@ jasmine.Spec.prototype.finish = function(onComplete) {
|
|
1867
1923
|
}
|
1868
1924
|
};
|
1869
1925
|
|
1870
|
-
jasmine.Spec.prototype.after = function(doAfter
|
1871
|
-
|
1926
|
+
jasmine.Spec.prototype.after = function(doAfter) {
|
1872
1927
|
if (this.queue.isRunning()) {
|
1873
1928
|
this.queue.add(new jasmine.Block(this.env, doAfter, this));
|
1874
1929
|
} else {
|
@@ -1896,23 +1951,25 @@ jasmine.Spec.prototype.execute = function(onComplete) {
|
|
1896
1951
|
|
1897
1952
|
jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() {
|
1898
1953
|
var runner = this.env.currentRunner();
|
1954
|
+
var i;
|
1955
|
+
|
1899
1956
|
for (var suite = this.suite; suite; suite = suite.parentSuite) {
|
1900
|
-
for (
|
1957
|
+
for (i = 0; i < suite.before_.length; i++) {
|
1901
1958
|
this.queue.addBefore(new jasmine.Block(this.env, suite.before_[i], this));
|
1902
1959
|
}
|
1903
1960
|
}
|
1904
|
-
for (
|
1961
|
+
for (i = 0; i < runner.before_.length; i++) {
|
1905
1962
|
this.queue.addBefore(new jasmine.Block(this.env, runner.before_[i], this));
|
1906
1963
|
}
|
1907
1964
|
for (i = 0; i < this.afterCallbacks.length; i++) {
|
1908
1965
|
this.queue.add(new jasmine.Block(this.env, this.afterCallbacks[i], this));
|
1909
1966
|
}
|
1910
1967
|
for (suite = this.suite; suite; suite = suite.parentSuite) {
|
1911
|
-
for (
|
1968
|
+
for (i = 0; i < suite.after_.length; i++) {
|
1912
1969
|
this.queue.add(new jasmine.Block(this.env, suite.after_[i], this));
|
1913
1970
|
}
|
1914
1971
|
}
|
1915
|
-
for (
|
1972
|
+
for (i = 0; i < runner.after_.length; i++) {
|
1916
1973
|
this.queue.add(new jasmine.Block(this.env, runner.after_[i], this));
|
1917
1974
|
}
|
1918
1975
|
};
|
@@ -2256,6 +2313,6 @@ window.clearInterval = function(timeoutKey) {
|
|
2256
2313
|
jasmine.version_= {
|
2257
2314
|
"major": 0,
|
2258
2315
|
"minor": 10,
|
2259
|
-
"build":
|
2260
|
-
"revision":
|
2316
|
+
"build": 2,
|
2317
|
+
"revision": 1268969696
|
2261
2318
|
};
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jasmine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rajan Agaskar
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2010-03-
|
13
|
+
date: 2010-03-18 00:00:00 -07:00
|
14
14
|
default_executable: jasmine
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -96,7 +96,7 @@ files:
|
|
96
96
|
- jasmine/contrib/ruby/run.html
|
97
97
|
- jasmine/lib/TrivialReporter.js
|
98
98
|
- jasmine/lib/consolex.js
|
99
|
-
- jasmine/lib/jasmine-0.10.
|
99
|
+
- jasmine/lib/jasmine-0.10.2.js
|
100
100
|
- jasmine/lib/jasmine.css
|
101
101
|
- jasmine/lib/json2.js
|
102
102
|
- lib/jasmine.rb
|