jasminerice 0.0.9 → 0.0.10
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.
- data/Gemfile.lock +1 -1
- data/README.md +15 -1
- data/app/assets/javascripts/jasminerice.js.coffee +7 -5
- data/app/controllers/jasminerice/spec_controller.rb +1 -0
- data/app/views/jasminerice/spec/index.html.haml +1 -1
- data/config/routes.rb +4 -2
- data/jasminerice.gemspec +1 -1
- data/lib/generators/jasminerice/install_generator.rb +15 -0
- data/lib/generators/jasminerice/templates/baz.html.haml +2 -0
- data/lib/generators/jasminerice/templates/foo_spec.js.coffee +14 -0
- data/lib/generators/jasminerice/templates/spec.css +4 -0
- data/lib/generators/jasminerice/templates/spec.js.coffee +8 -0
- data/lib/jasminerice.rb +2 -0
- data/vendor/assets/javascripts/jasmine-html.js +428 -1
- data/vendor/assets/javascripts/jasmine-jquery-1.4.2.js +548 -0
- data/vendor/assets/javascripts/jasmine.js +6 -5
- data/vendor/assets/stylesheets/jasmine.css +81 -165
- metadata +10 -5
- data/vendor/assets/javascripts/jasmine-jquery-1.3.1.js +0 -290
@@ -1019,7 +1019,7 @@ jasmine.Block = function(env, func, spec) {
|
|
1019
1019
|
this.spec = spec;
|
1020
1020
|
};
|
1021
1021
|
|
1022
|
-
jasmine.Block.prototype.execute = function(onComplete) {
|
1022
|
+
jasmine.Block.prototype.execute = function(onComplete) {
|
1023
1023
|
try {
|
1024
1024
|
this.func.apply(this.spec);
|
1025
1025
|
} catch (e) {
|
@@ -1059,7 +1059,7 @@ jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) {
|
|
1059
1059
|
type: isSuite ? 'suite' : 'spec',
|
1060
1060
|
children: []
|
1061
1061
|
};
|
1062
|
-
|
1062
|
+
|
1063
1063
|
if (isSuite) {
|
1064
1064
|
var children = suiteOrSpec.children();
|
1065
1065
|
for (var i = 0; i < children.length; i++) {
|
@@ -1887,7 +1887,7 @@ jasmine.PrettyPrinter.prototype.format = function(value) {
|
|
1887
1887
|
jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) {
|
1888
1888
|
for (var property in obj) {
|
1889
1889
|
if (property == '__Jasmine_been_here_before__') continue;
|
1890
|
-
fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) !== jasmine.undefined &&
|
1890
|
+
fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) !== jasmine.undefined &&
|
1891
1891
|
obj.__lookupGetter__(property) !== null) : false);
|
1892
1892
|
}
|
1893
1893
|
};
|
@@ -1990,7 +1990,7 @@ jasmine.Queue.prototype.next_ = function() {
|
|
1990
1990
|
|
1991
1991
|
while (goAgain) {
|
1992
1992
|
goAgain = false;
|
1993
|
-
|
1993
|
+
|
1994
1994
|
if (self.index < self.blocks.length && !this.abort) {
|
1995
1995
|
var calledSynchronously = true;
|
1996
1996
|
var completedSynchronously = false;
|
@@ -2028,7 +2028,7 @@ jasmine.Queue.prototype.next_ = function() {
|
|
2028
2028
|
if (completedSynchronously) {
|
2029
2029
|
onComplete();
|
2030
2030
|
}
|
2031
|
-
|
2031
|
+
|
2032
2032
|
} else {
|
2033
2033
|
self.running = false;
|
2034
2034
|
if (self.onComplete) {
|
@@ -2527,3 +2527,4 @@ jasmine.version_= {
|
|
2527
2527
|
"build": 0,
|
2528
2528
|
"revision": 1337005947
|
2529
2529
|
};
|
2530
|
+
|
@@ -1,166 +1,82 @@
|
|
1
|
-
body {
|
2
|
-
|
3
|
-
}
|
1
|
+
body { background-color: #eeeeee; padding: 0; margin: 5px; overflow-y: scroll; }
|
2
|
+
|
3
|
+
#HTMLReporter { font-size: 11px; font-family: Monaco, "Lucida Console", monospace; line-height: 14px; color: #333333; }
|
4
|
+
#HTMLReporter a { text-decoration: none; }
|
5
|
+
#HTMLReporter a:hover { text-decoration: underline; }
|
6
|
+
#HTMLReporter p, #HTMLReporter h1, #HTMLReporter h2, #HTMLReporter h3, #HTMLReporter h4, #HTMLReporter h5, #HTMLReporter h6 { margin: 0; line-height: 14px; }
|
7
|
+
#HTMLReporter .banner, #HTMLReporter .symbolSummary, #HTMLReporter .summary, #HTMLReporter .resultMessage, #HTMLReporter .specDetail .description, #HTMLReporter .alert .bar, #HTMLReporter .stackTrace { padding-left: 9px; padding-right: 9px; }
|
8
|
+
#HTMLReporter #jasmine_content { position: fixed; right: 100%; }
|
9
|
+
#HTMLReporter .version { color: #aaaaaa; }
|
10
|
+
#HTMLReporter .banner { margin-top: 14px; }
|
11
|
+
#HTMLReporter .duration { color: #aaaaaa; float: right; }
|
12
|
+
#HTMLReporter .symbolSummary { overflow: hidden; *zoom: 1; margin: 14px 0; }
|
13
|
+
#HTMLReporter .symbolSummary li { display: block; float: left; height: 7px; width: 14px; margin-bottom: 7px; font-size: 16px; }
|
14
|
+
#HTMLReporter .symbolSummary li.passed { font-size: 14px; }
|
15
|
+
#HTMLReporter .symbolSummary li.passed:before { color: #5e7d00; content: "\02022"; }
|
16
|
+
#HTMLReporter .symbolSummary li.failed { line-height: 9px; }
|
17
|
+
#HTMLReporter .symbolSummary li.failed:before { color: #b03911; content: "x"; font-weight: bold; margin-left: -1px; }
|
18
|
+
#HTMLReporter .symbolSummary li.skipped { font-size: 14px; }
|
19
|
+
#HTMLReporter .symbolSummary li.skipped:before { color: #bababa; content: "\02022"; }
|
20
|
+
#HTMLReporter .symbolSummary li.pending { line-height: 11px; }
|
21
|
+
#HTMLReporter .symbolSummary li.pending:before { color: #aaaaaa; content: "-"; }
|
22
|
+
#HTMLReporter .bar { line-height: 28px; font-size: 14px; display: block; color: #eee; }
|
23
|
+
#HTMLReporter .runningAlert { background-color: #666666; }
|
24
|
+
#HTMLReporter .skippedAlert { background-color: #aaaaaa; }
|
25
|
+
#HTMLReporter .skippedAlert:first-child { background-color: #333333; }
|
26
|
+
#HTMLReporter .skippedAlert:hover { text-decoration: none; color: white; text-decoration: underline; }
|
27
|
+
#HTMLReporter .passingAlert { background-color: #a6b779; }
|
28
|
+
#HTMLReporter .passingAlert:first-child { background-color: #5e7d00; }
|
29
|
+
#HTMLReporter .failingAlert { background-color: #cf867e; }
|
30
|
+
#HTMLReporter .failingAlert:first-child { background-color: #b03911; }
|
31
|
+
#HTMLReporter .results { margin-top: 14px; }
|
32
|
+
#HTMLReporter #details { display: none; }
|
33
|
+
#HTMLReporter .resultsMenu, #HTMLReporter .resultsMenu a { background-color: #fff; color: #333333; }
|
34
|
+
#HTMLReporter.showDetails .summaryMenuItem { font-weight: normal; text-decoration: inherit; }
|
35
|
+
#HTMLReporter.showDetails .summaryMenuItem:hover { text-decoration: underline; }
|
36
|
+
#HTMLReporter.showDetails .detailsMenuItem { font-weight: bold; text-decoration: underline; }
|
37
|
+
#HTMLReporter.showDetails .summary { display: none; }
|
38
|
+
#HTMLReporter.showDetails #details { display: block; }
|
39
|
+
#HTMLReporter .summaryMenuItem { font-weight: bold; text-decoration: underline; }
|
40
|
+
#HTMLReporter .summary { margin-top: 14px; }
|
41
|
+
#HTMLReporter .summary .suite .suite, #HTMLReporter .summary .specSummary { margin-left: 14px; }
|
42
|
+
#HTMLReporter .summary .specSummary.passed a { color: #5e7d00; }
|
43
|
+
#HTMLReporter .summary .specSummary.failed a { color: #b03911; }
|
44
|
+
#HTMLReporter .description + .suite { margin-top: 0; }
|
45
|
+
#HTMLReporter .suite { margin-top: 14px; }
|
46
|
+
#HTMLReporter .suite a { color: #333333; }
|
47
|
+
#HTMLReporter #details .specDetail { margin-bottom: 28px; }
|
48
|
+
#HTMLReporter #details .specDetail .description { display: block; color: white; background-color: #b03911; }
|
49
|
+
#HTMLReporter .resultMessage { padding-top: 14px; color: #333333; }
|
50
|
+
#HTMLReporter .resultMessage span.result { display: block; }
|
51
|
+
#HTMLReporter .stackTrace { margin: 5px 0 0 0; max-height: 224px; overflow: auto; line-height: 18px; color: #666666; border: 1px solid #ddd; background: white; white-space: pre; }
|
52
|
+
|
53
|
+
#TrivialReporter { padding: 8px 13px; position: absolute; top: 0; bottom: 0; left: 0; right: 0; overflow-y: scroll; background-color: white; font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif; /*.resultMessage {*/ /*white-space: pre;*/ /*}*/ }
|
54
|
+
#TrivialReporter a:visited, #TrivialReporter a { color: #303; }
|
55
|
+
#TrivialReporter a:hover, #TrivialReporter a:active { color: blue; }
|
56
|
+
#TrivialReporter .run_spec { float: right; padding-right: 5px; font-size: .8em; text-decoration: none; }
|
57
|
+
#TrivialReporter .banner { color: #303; background-color: #fef; padding: 5px; }
|
58
|
+
#TrivialReporter .logo { float: left; font-size: 1.1em; padding-left: 5px; }
|
59
|
+
#TrivialReporter .logo .version { font-size: .6em; padding-left: 1em; }
|
60
|
+
#TrivialReporter .runner.running { background-color: yellow; }
|
61
|
+
#TrivialReporter .options { text-align: right; font-size: .8em; }
|
62
|
+
#TrivialReporter .suite { border: 1px outset gray; margin: 5px 0; padding-left: 1em; }
|
63
|
+
#TrivialReporter .suite .suite { margin: 5px; }
|
64
|
+
#TrivialReporter .suite.passed { background-color: #dfd; }
|
65
|
+
#TrivialReporter .suite.failed { background-color: #fdd; }
|
66
|
+
#TrivialReporter .spec { margin: 5px; padding-left: 1em; clear: both; }
|
67
|
+
#TrivialReporter .spec.failed, #TrivialReporter .spec.passed, #TrivialReporter .spec.skipped { padding-bottom: 5px; border: 1px solid gray; }
|
68
|
+
#TrivialReporter .spec.failed { background-color: #fbb; border-color: red; }
|
69
|
+
#TrivialReporter .spec.passed { background-color: #bfb; border-color: green; }
|
70
|
+
#TrivialReporter .spec.skipped { background-color: #bbb; }
|
71
|
+
#TrivialReporter .messages { border-left: 1px dashed gray; padding-left: 1em; padding-right: 1em; }
|
72
|
+
#TrivialReporter .passed { background-color: #cfc; display: none; }
|
73
|
+
#TrivialReporter .failed { background-color: #fbb; }
|
74
|
+
#TrivialReporter .skipped { color: #777; background-color: #eee; display: none; }
|
75
|
+
#TrivialReporter .resultMessage span.result { display: block; line-height: 2em; color: black; }
|
76
|
+
#TrivialReporter .resultMessage .mismatch { color: black; }
|
77
|
+
#TrivialReporter .stackTrace { white-space: pre; font-size: .8em; margin-left: 10px; max-height: 5em; overflow: auto; border: 1px inset red; padding: 1em; background: #eef; }
|
78
|
+
#TrivialReporter .finished-at { padding-left: 1em; font-size: .6em; }
|
79
|
+
#TrivialReporter.show-passed .passed, #TrivialReporter.show-skipped .skipped { display: block; }
|
80
|
+
#TrivialReporter #jasmine_content { position: fixed; right: 100%; }
|
81
|
+
#TrivialReporter .runner { border: 1px solid gray; display: block; margin: 5px 0; padding: 2px 0 2px 10px; }
|
4
82
|
|
5
|
-
|
6
|
-
.jasmine_reporter a:visited, .jasmine_reporter a {
|
7
|
-
color: #303;
|
8
|
-
}
|
9
|
-
|
10
|
-
.jasmine_reporter a:hover, .jasmine_reporter a:active {
|
11
|
-
color: blue;
|
12
|
-
}
|
13
|
-
|
14
|
-
.run_spec {
|
15
|
-
float:right;
|
16
|
-
padding-right: 5px;
|
17
|
-
font-size: .8em;
|
18
|
-
text-decoration: none;
|
19
|
-
}
|
20
|
-
|
21
|
-
.jasmine_reporter {
|
22
|
-
margin: 0 5px;
|
23
|
-
}
|
24
|
-
|
25
|
-
.banner {
|
26
|
-
color: #303;
|
27
|
-
background-color: #fef;
|
28
|
-
padding: 5px;
|
29
|
-
}
|
30
|
-
|
31
|
-
.logo {
|
32
|
-
float: left;
|
33
|
-
font-size: 1.1em;
|
34
|
-
padding-left: 5px;
|
35
|
-
}
|
36
|
-
|
37
|
-
.logo .version {
|
38
|
-
font-size: .6em;
|
39
|
-
padding-left: 1em;
|
40
|
-
}
|
41
|
-
|
42
|
-
.runner.running {
|
43
|
-
background-color: yellow;
|
44
|
-
}
|
45
|
-
|
46
|
-
|
47
|
-
.options {
|
48
|
-
text-align: right;
|
49
|
-
font-size: .8em;
|
50
|
-
}
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
.suite {
|
56
|
-
border: 1px outset gray;
|
57
|
-
margin: 5px 0;
|
58
|
-
padding-left: 1em;
|
59
|
-
}
|
60
|
-
|
61
|
-
.suite .suite {
|
62
|
-
margin: 5px;
|
63
|
-
}
|
64
|
-
|
65
|
-
.suite.passed {
|
66
|
-
background-color: #dfd;
|
67
|
-
}
|
68
|
-
|
69
|
-
.suite.failed {
|
70
|
-
background-color: #fdd;
|
71
|
-
}
|
72
|
-
|
73
|
-
.spec {
|
74
|
-
margin: 5px;
|
75
|
-
padding-left: 1em;
|
76
|
-
clear: both;
|
77
|
-
}
|
78
|
-
|
79
|
-
.spec.failed, .spec.passed, .spec.skipped {
|
80
|
-
padding-bottom: 5px;
|
81
|
-
border: 1px solid gray;
|
82
|
-
}
|
83
|
-
|
84
|
-
.spec.failed {
|
85
|
-
background-color: #fbb;
|
86
|
-
border-color: red;
|
87
|
-
}
|
88
|
-
|
89
|
-
.spec.passed {
|
90
|
-
background-color: #bfb;
|
91
|
-
border-color: green;
|
92
|
-
}
|
93
|
-
|
94
|
-
.spec.skipped {
|
95
|
-
background-color: #bbb;
|
96
|
-
}
|
97
|
-
|
98
|
-
.messages {
|
99
|
-
border-left: 1px dashed gray;
|
100
|
-
padding-left: 1em;
|
101
|
-
padding-right: 1em;
|
102
|
-
}
|
103
|
-
|
104
|
-
.passed {
|
105
|
-
background-color: #cfc;
|
106
|
-
display: none;
|
107
|
-
}
|
108
|
-
|
109
|
-
.failed {
|
110
|
-
background-color: #fbb;
|
111
|
-
}
|
112
|
-
|
113
|
-
.skipped {
|
114
|
-
color: #777;
|
115
|
-
background-color: #eee;
|
116
|
-
display: none;
|
117
|
-
}
|
118
|
-
|
119
|
-
|
120
|
-
/*.resultMessage {*/
|
121
|
-
/*white-space: pre;*/
|
122
|
-
/*}*/
|
123
|
-
|
124
|
-
.resultMessage span.result {
|
125
|
-
display: block;
|
126
|
-
line-height: 2em;
|
127
|
-
color: black;
|
128
|
-
}
|
129
|
-
|
130
|
-
.resultMessage .mismatch {
|
131
|
-
color: black;
|
132
|
-
}
|
133
|
-
|
134
|
-
.stackTrace {
|
135
|
-
white-space: pre;
|
136
|
-
font-size: .8em;
|
137
|
-
margin-left: 10px;
|
138
|
-
max-height: 5em;
|
139
|
-
overflow: auto;
|
140
|
-
border: 1px inset red;
|
141
|
-
padding: 1em;
|
142
|
-
background: #eef;
|
143
|
-
}
|
144
|
-
|
145
|
-
.finished-at {
|
146
|
-
padding-left: 1em;
|
147
|
-
font-size: .6em;
|
148
|
-
}
|
149
|
-
|
150
|
-
.show-passed .passed,
|
151
|
-
.show-skipped .skipped {
|
152
|
-
display: block;
|
153
|
-
}
|
154
|
-
|
155
|
-
|
156
|
-
#jasmine_content {
|
157
|
-
position:fixed;
|
158
|
-
right: 100%;
|
159
|
-
}
|
160
|
-
|
161
|
-
.runner {
|
162
|
-
border: 1px solid gray;
|
163
|
-
display: block;
|
164
|
-
margin: 5px 0;
|
165
|
-
padding: 2px 0 2px 10px;
|
166
|
-
}
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: jasminerice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.10
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Brad Phelan
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-10-15 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: haml
|
@@ -60,12 +60,17 @@ files:
|
|
60
60
|
- config/initializers/jasminerice.rb
|
61
61
|
- config/routes.rb
|
62
62
|
- jasminerice.gemspec
|
63
|
+
- lib/generators/jasminerice/install_generator.rb
|
64
|
+
- lib/generators/jasminerice/templates/baz.html.haml
|
65
|
+
- lib/generators/jasminerice/templates/foo_spec.js.coffee
|
66
|
+
- lib/generators/jasminerice/templates/spec.css
|
67
|
+
- lib/generators/jasminerice/templates/spec.js.coffee
|
63
68
|
- lib/jasminerice.rb
|
64
69
|
- lib/jasminerice/engine.rb
|
65
70
|
- lib/tasks/jasminerice_tasks.rake
|
66
71
|
- vendor/assets/images/jasmine_favicon.png
|
67
72
|
- vendor/assets/javascripts/jasmine-html.js
|
68
|
-
- vendor/assets/javascripts/jasmine-jquery-1.
|
73
|
+
- vendor/assets/javascripts/jasmine-jquery-1.4.2.js
|
69
74
|
- vendor/assets/javascripts/jasmine.js
|
70
75
|
- vendor/assets/stylesheets/jasmine.css
|
71
76
|
homepage:
|
@@ -81,7 +86,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
81
86
|
requirements:
|
82
87
|
- - ">="
|
83
88
|
- !ruby/object:Gem::Version
|
84
|
-
hash:
|
89
|
+
hash: 4158560264355441697
|
85
90
|
segments:
|
86
91
|
- 0
|
87
92
|
version: "0"
|
@@ -90,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
95
|
requirements:
|
91
96
|
- - ">="
|
92
97
|
- !ruby/object:Gem::Version
|
93
|
-
hash:
|
98
|
+
hash: 4158560264355441697
|
94
99
|
segments:
|
95
100
|
- 0
|
96
101
|
version: "0"
|
@@ -1,290 +0,0 @@
|
|
1
|
-
var readFixtures = function() {
|
2
|
-
return jasmine.getFixtures().proxyCallTo_('read', arguments);
|
3
|
-
};
|
4
|
-
|
5
|
-
var preloadFixtures = function() {
|
6
|
-
jasmine.getFixtures().proxyCallTo_('preload', arguments);
|
7
|
-
};
|
8
|
-
|
9
|
-
var loadFixtures = function() {
|
10
|
-
jasmine.getFixtures().proxyCallTo_('load', arguments);
|
11
|
-
};
|
12
|
-
|
13
|
-
var setFixtures = function(html) {
|
14
|
-
jasmine.getFixtures().set(html);
|
15
|
-
};
|
16
|
-
|
17
|
-
var sandbox = function(attributes) {
|
18
|
-
return jasmine.getFixtures().sandbox(attributes);
|
19
|
-
};
|
20
|
-
|
21
|
-
var spyOnEvent = function(selector, eventName) {
|
22
|
-
jasmine.JQuery.events.spyOn(selector, eventName);
|
23
|
-
}
|
24
|
-
|
25
|
-
jasmine.getFixtures = function() {
|
26
|
-
return jasmine.currentFixtures_ = jasmine.currentFixtures_ || new jasmine.Fixtures();
|
27
|
-
};
|
28
|
-
|
29
|
-
jasmine.Fixtures = function() {
|
30
|
-
this.containerId = 'jasmine-fixtures';
|
31
|
-
this.fixturesCache_ = {};
|
32
|
-
// Changed in jasminerice to support the normal path
|
33
|
-
//this.fixturesPath = 'spec/javascripts/fixtures';
|
34
|
-
this.fixturesPath = 'jasmine/fixtures';
|
35
|
-
};
|
36
|
-
|
37
|
-
jasmine.Fixtures.prototype.set = function(html) {
|
38
|
-
this.cleanUp();
|
39
|
-
this.createContainer_(html);
|
40
|
-
};
|
41
|
-
|
42
|
-
jasmine.Fixtures.prototype.preload = function() {
|
43
|
-
this.read.apply(this, arguments);
|
44
|
-
};
|
45
|
-
|
46
|
-
jasmine.Fixtures.prototype.load = function() {
|
47
|
-
this.cleanUp();
|
48
|
-
this.createContainer_(this.read.apply(this, arguments));
|
49
|
-
};
|
50
|
-
|
51
|
-
jasmine.Fixtures.prototype.read = function() {
|
52
|
-
var htmlChunks = [];
|
53
|
-
|
54
|
-
var fixtureUrls = arguments;
|
55
|
-
for(var urlCount = fixtureUrls.length, urlIndex = 0; urlIndex < urlCount; urlIndex++) {
|
56
|
-
htmlChunks.push(this.getFixtureHtml_(fixtureUrls[urlIndex]));
|
57
|
-
}
|
58
|
-
|
59
|
-
return htmlChunks.join('');
|
60
|
-
};
|
61
|
-
|
62
|
-
jasmine.Fixtures.prototype.clearCache = function() {
|
63
|
-
this.fixturesCache_ = {};
|
64
|
-
};
|
65
|
-
|
66
|
-
jasmine.Fixtures.prototype.cleanUp = function() {
|
67
|
-
jQuery('#' + this.containerId).remove();
|
68
|
-
};
|
69
|
-
|
70
|
-
jasmine.Fixtures.prototype.sandbox = function(attributes) {
|
71
|
-
var attributesToSet = attributes || {};
|
72
|
-
return jQuery('<div id="sandbox" />').attr(attributesToSet);
|
73
|
-
};
|
74
|
-
|
75
|
-
jasmine.Fixtures.prototype.createContainer_ = function(html) {
|
76
|
-
var container;
|
77
|
-
if(html instanceof jQuery) {
|
78
|
-
container = jQuery('<div id="' + this.containerId + '" />');
|
79
|
-
container.html(html);
|
80
|
-
} else {
|
81
|
-
container = '<div id="' + this.containerId + '">' + html + '</div>'
|
82
|
-
}
|
83
|
-
jQuery('body').append(container);
|
84
|
-
};
|
85
|
-
|
86
|
-
jasmine.Fixtures.prototype.getFixtureHtml_ = function(url) {
|
87
|
-
if (typeof this.fixturesCache_[url] == 'undefined') {
|
88
|
-
this.loadFixtureIntoCache_(url);
|
89
|
-
}
|
90
|
-
return this.fixturesCache_[url];
|
91
|
-
};
|
92
|
-
|
93
|
-
jasmine.Fixtures.prototype.loadFixtureIntoCache_ = function(relativeUrl) {
|
94
|
-
var self = this;
|
95
|
-
var url = this.fixturesPath.match('/$') ? this.fixturesPath + relativeUrl : this.fixturesPath + '/' + relativeUrl;
|
96
|
-
jQuery.ajax({
|
97
|
-
async: false, // must be synchronous to guarantee that no tests are run before fixture is loaded
|
98
|
-
cache: false,
|
99
|
-
dataType: 'html',
|
100
|
-
url: url,
|
101
|
-
success: function(data) {
|
102
|
-
self.fixturesCache_[relativeUrl] = data;
|
103
|
-
},
|
104
|
-
error: function(jqXHR, status, errorThrown) {
|
105
|
-
throw Error('Fixture could not be loaded: ' + url + ' (status: ' + status + ', message: ' + errorThrown.message + ')');
|
106
|
-
}
|
107
|
-
});
|
108
|
-
};
|
109
|
-
|
110
|
-
jasmine.Fixtures.prototype.proxyCallTo_ = function(methodName, passedArguments) {
|
111
|
-
return this[methodName].apply(this, passedArguments);
|
112
|
-
};
|
113
|
-
|
114
|
-
|
115
|
-
jasmine.JQuery = function() {};
|
116
|
-
|
117
|
-
jasmine.JQuery.browserTagCaseIndependentHtml = function(html) {
|
118
|
-
return jQuery('<div/>').append(html).html();
|
119
|
-
};
|
120
|
-
|
121
|
-
jasmine.JQuery.elementToString = function(element) {
|
122
|
-
return jQuery('<div />').append(element.clone()).html();
|
123
|
-
};
|
124
|
-
|
125
|
-
jasmine.JQuery.matchersClass = {};
|
126
|
-
|
127
|
-
(function(namespace) {
|
128
|
-
var data = {
|
129
|
-
spiedEvents: {},
|
130
|
-
handlers: []
|
131
|
-
};
|
132
|
-
|
133
|
-
namespace.events = {
|
134
|
-
spyOn: function(selector, eventName) {
|
135
|
-
var handler = function(e) {
|
136
|
-
data.spiedEvents[[selector, eventName]] = e;
|
137
|
-
};
|
138
|
-
jQuery(selector).bind(eventName, handler);
|
139
|
-
data.handlers.push(handler);
|
140
|
-
},
|
141
|
-
|
142
|
-
wasTriggered: function(selector, eventName) {
|
143
|
-
return !!(data.spiedEvents[[selector, eventName]]);
|
144
|
-
},
|
145
|
-
|
146
|
-
cleanUp: function() {
|
147
|
-
data.spiedEvents = {};
|
148
|
-
data.handlers = [];
|
149
|
-
}
|
150
|
-
}
|
151
|
-
})(jasmine.JQuery);
|
152
|
-
|
153
|
-
(function(){
|
154
|
-
var jQueryMatchers = {
|
155
|
-
toHaveClass: function(className) {
|
156
|
-
return this.actual.hasClass(className);
|
157
|
-
},
|
158
|
-
|
159
|
-
toBeVisible: function() {
|
160
|
-
return this.actual.is(':visible');
|
161
|
-
},
|
162
|
-
|
163
|
-
toBeHidden: function() {
|
164
|
-
return this.actual.is(':hidden');
|
165
|
-
},
|
166
|
-
|
167
|
-
toBeSelected: function() {
|
168
|
-
return this.actual.is(':selected');
|
169
|
-
},
|
170
|
-
|
171
|
-
toBeChecked: function() {
|
172
|
-
return this.actual.is(':checked');
|
173
|
-
},
|
174
|
-
|
175
|
-
toBeEmpty: function() {
|
176
|
-
return this.actual.is(':empty');
|
177
|
-
},
|
178
|
-
|
179
|
-
toExist: function() {
|
180
|
-
return this.actual.size() > 0;
|
181
|
-
},
|
182
|
-
|
183
|
-
toHaveAttr: function(attributeName, expectedAttributeValue) {
|
184
|
-
return hasProperty(this.actual.attr(attributeName), expectedAttributeValue);
|
185
|
-
},
|
186
|
-
|
187
|
-
toHaveId: function(id) {
|
188
|
-
return this.actual.attr('id') == id;
|
189
|
-
},
|
190
|
-
|
191
|
-
toHaveHtml: function(html) {
|
192
|
-
return this.actual.html() == jasmine.JQuery.browserTagCaseIndependentHtml(html);
|
193
|
-
},
|
194
|
-
|
195
|
-
toHaveText: function(text) {
|
196
|
-
if (text && jQuery.isFunction(text.test)) {
|
197
|
-
return text.test(this.actual.text());
|
198
|
-
} else {
|
199
|
-
return this.actual.text() == text;
|
200
|
-
}
|
201
|
-
},
|
202
|
-
|
203
|
-
toHaveValue: function(value) {
|
204
|
-
return this.actual.val() == value;
|
205
|
-
},
|
206
|
-
|
207
|
-
toHaveData: function(key, expectedValue) {
|
208
|
-
return hasProperty(this.actual.data(key), expectedValue);
|
209
|
-
},
|
210
|
-
|
211
|
-
toBe: function(selector) {
|
212
|
-
return this.actual.is(selector);
|
213
|
-
},
|
214
|
-
|
215
|
-
toContain: function(selector) {
|
216
|
-
return this.actual.find(selector).size() > 0;
|
217
|
-
},
|
218
|
-
|
219
|
-
toBeDisabled: function(selector){
|
220
|
-
return this.actual.is(':disabled');
|
221
|
-
},
|
222
|
-
|
223
|
-
// tests the existence of a specific event binding
|
224
|
-
toHandle: function(eventName) {
|
225
|
-
var events = this.actual.data("events");
|
226
|
-
return events && events[eventName].length > 0;
|
227
|
-
},
|
228
|
-
|
229
|
-
// tests the existence of a specific event binding + handler
|
230
|
-
toHandleWith: function(eventName, eventHandler) {
|
231
|
-
var stack = this.actual.data("events")[eventName];
|
232
|
-
var i;
|
233
|
-
for (i = 0; i < stack.length; i++) {
|
234
|
-
if (stack[i].handler == eventHandler) {
|
235
|
-
return true;
|
236
|
-
}
|
237
|
-
}
|
238
|
-
return false;
|
239
|
-
}
|
240
|
-
};
|
241
|
-
|
242
|
-
var hasProperty = function(actualValue, expectedValue) {
|
243
|
-
if (expectedValue === undefined) {
|
244
|
-
return actualValue !== undefined;
|
245
|
-
}
|
246
|
-
return actualValue == expectedValue;
|
247
|
-
};
|
248
|
-
|
249
|
-
var bindMatcher = function(methodName) {
|
250
|
-
var builtInMatcher = jasmine.Matchers.prototype[methodName];
|
251
|
-
|
252
|
-
jasmine.JQuery.matchersClass[methodName] = function() {
|
253
|
-
if (this.actual instanceof jQuery) {
|
254
|
-
var result = jQueryMatchers[methodName].apply(this, arguments);
|
255
|
-
this.actual = jasmine.JQuery.elementToString(this.actual);
|
256
|
-
return result;
|
257
|
-
}
|
258
|
-
|
259
|
-
if (builtInMatcher) {
|
260
|
-
return builtInMatcher.apply(this, arguments);
|
261
|
-
}
|
262
|
-
|
263
|
-
return false;
|
264
|
-
};
|
265
|
-
};
|
266
|
-
|
267
|
-
for(var methodName in jQueryMatchers) {
|
268
|
-
bindMatcher(methodName);
|
269
|
-
}
|
270
|
-
})();
|
271
|
-
|
272
|
-
beforeEach(function() {
|
273
|
-
this.addMatchers(jasmine.JQuery.matchersClass);
|
274
|
-
this.addMatchers({
|
275
|
-
toHaveBeenTriggeredOn: function(selector) {
|
276
|
-
this.message = function() {
|
277
|
-
return [
|
278
|
-
"Expected event " + this.actual + " to have been triggered on" + selector,
|
279
|
-
"Expected event " + this.actual + " not to have been triggered on" + selector
|
280
|
-
];
|
281
|
-
};
|
282
|
-
return jasmine.JQuery.events.wasTriggered(selector, this.actual);
|
283
|
-
}
|
284
|
-
})
|
285
|
-
});
|
286
|
-
|
287
|
-
afterEach(function() {
|
288
|
-
jasmine.getFixtures().cleanUp();
|
289
|
-
jasmine.JQuery.events.cleanUp();
|
290
|
-
});
|