@@ -58,16 +58,15 @@ void main() {
58
58
Injector injector, VmTurnZone zone, MockHttpBackend backend,
59
59
DirectiveMap directives) {
60
60
61
- backend
62
- ..whenGET ('PREFIX:simple.html' ).respond ('<div log="SIMPLE">Simple!</div>' )
63
- ..whenGET ('PREFIX:simple.css' ).respond ('.hello{}' );
64
-
65
61
var element = e ('<div><html-and-css log>ignore</html-and-css><div>' );
66
62
zone.run (() {
67
63
compile ([element], directives)(rootScope, null , [element]);
68
64
});
69
65
70
- backend.flush ();
66
+ backend
67
+ ..flushGET ('PREFIX:simple.css' ).respond ('.hello{}' )
68
+ ..flushGET ('PREFIX:simple.html' ).respond ('<div log="SIMPLE">Simple!</div>' );
69
+
71
70
microLeap ();
72
71
73
72
expect (element).toHaveText ('.hello{}Simple!' );
@@ -91,13 +90,11 @@ void main() {
91
90
it ('should replace element with template from url' , async (
92
91
(Http http, Compiler compile, Scope rootScope, Logger log,
93
92
Injector injector, MockHttpBackend backend, DirectiveMap directives) {
94
- backend.expectGET ('simple.html' ).respond (200 , '<div log="SIMPLE">Simple!</div>' );
95
93
96
94
var element = es ('<div><simple-url log>ignore</simple-url><div>' );
97
95
compile (element, directives)(rootScope, null , element);
98
96
99
- microLeap ();
100
- backend.flush ();
97
+ backend.flushGET ('simple.html' ).respond (200 , '<div log="SIMPLE">Simple!</div>' );
101
98
microLeap ();
102
99
103
100
expect (element[0 ]).toHaveText ('Simple!' );
@@ -109,17 +106,14 @@ void main() {
109
106
it ('should load template from URL once' , async (
110
107
(Http http, Compiler compile, Scope rootScope, Logger log,
111
108
Injector injector, MockHttpBackend backend, DirectiveMap directives) {
112
- backend.whenGET ('simple.html' ).respond (200 , '<div log="SIMPLE">Simple!</div>' );
113
-
114
109
var element = es (
115
110
'<div>'
116
111
'<simple-url log>ignore</simple-url>'
117
112
'<simple-url log>ignore</simple-url>'
118
113
'<div>' );
119
114
compile (element, directives)(rootScope, null , element);
120
115
121
- microLeap ();
122
- backend.flush ();
116
+ backend.flushGET ('simple.html' ).respond (200 , '<div log="SIMPLE">Simple!</div>' );
123
117
microLeap ();
124
118
125
119
expect (element.first).toHaveText ('Simple!Simple!' );
@@ -132,15 +126,13 @@ void main() {
132
126
it ('should load a CSS file into a style' , async (
133
127
(Http http, Compiler compile, Scope rootScope, Logger log,
134
128
Injector injector, MockHttpBackend backend, DirectiveMap directives) {
135
- backend
136
- ..expectGET ('simple.css' ).respond (200 , '.hello{}' )
137
- ..expectGET ('simple.html' ).respond (200 , '<div log="SIMPLE">Simple!</div>' );
138
-
139
129
var element = e ('<div><html-and-css log>ignore</html-and-css><div>' );
140
130
compile ([element], directives)(rootScope, null , [element]);
141
131
142
- microLeap ();
143
- backend.flush ();
132
+ backend
133
+ ..flushGET ('simple.css' ).respond (200 , '.hello{}' )
134
+ ..flushGET ('simple.html' ).respond (200 , '<div log="SIMPLE">Simple!</div>' );
135
+
144
136
microLeap ();
145
137
146
138
expect (element).toHaveText ('.hello{}Simple!' );
@@ -156,25 +148,23 @@ void main() {
156
148
(Http http, Compiler compile, Scope rootScope, Injector injector,
157
149
MockHttpBackend backend, DirectiveMap directives) {
158
150
var element = es ('<div><inline-with-css log>ignore</inline-with-css><div>' );
159
- backend.expectGET ('simple.css' ).respond (200 , '.hello{}' );
160
- compile (element, directives)(rootScope, null , element);
151
+ compile (element, directives)(injector, element);
161
152
153
+ backend.flushGET ('simple.css' ).respond (200 , '.hello{}' );
162
154
microLeap ();
163
- backend.flush ();
164
- microLeap ();
155
+
165
156
expect (element[0 ]).toHaveText ('.hello{}inline!' );
166
157
}));
167
158
168
159
it ('should ignore CSS load errors ' , async (
169
160
(Http http, Compiler compile, Scope rootScope, Injector injector,
170
161
MockHttpBackend backend, DirectiveMap directives) {
171
162
var element = es ('<div><inline-with-css log>ignore</inline-with-css><div>' );
172
- backend.expectGET ('simple.css' ).respond (500 , 'some error' );
173
- compile (element, directives)(rootScope, null , element);
163
+ compile (element, directives)(injector, element);
174
164
165
+ backend.flushGET ('simple.css' ).respond (500 , 'some error' );
175
166
microLeap ();
176
- backend.flush ();
177
- microLeap ();
167
+
178
168
expect (element.first).toHaveText (
179
169
'/*\n '
180
170
'HTTP 500: some error\n '
@@ -186,28 +176,25 @@ void main() {
186
176
(Http http, Compiler compile, Scope rootScope, Injector injector,
187
177
MockHttpBackend backend, DirectiveMap directives) {
188
178
var element = es ('<div><only-css log>ignore</only-css><div>' );
189
- backend.expectGET ('simple.css' ).respond (200 , '.hello{}' );
190
- compile (element, directives)(rootScope, null , element);
179
+ compile (element, directives)(injector, element);
191
180
181
+ backend.flushGET ('simple.css' ).respond (200 , '.hello{}' );
192
182
microLeap ();
193
- backend.flush ();
194
- microLeap ();
183
+
195
184
expect (element[0 ]).toHaveText ('.hello{}' );
196
185
}));
197
186
198
187
it ('should load the CSS before the template is loaded' , async (
199
188
(Http http, Compiler compile, Scope rootScope, Injector injector,
200
189
MockHttpBackend backend, DirectiveMap directives) {
201
- backend
202
- ..expectGET ('simple.css' ).respond (200 , '.hello{}' )
203
- ..expectGET ('simple.html' ).respond (200 , '<div>Simple!</div>' );
204
-
205
190
var element = es ('<html-and-css>ignore</html-and-css>' );
206
191
compile (element, directives)(rootScope, null , element);
207
192
193
+ backend
194
+ ..flushGET ('simple.css' ).respond (200 , '.hello{}' )
195
+ ..flushGET ('simple.html' ).respond (200 , '<div>Simple!</div>' );
208
196
microLeap ();
209
- backend.flush ();
210
- microLeap ();
197
+
211
198
expect (element.first).toHaveText ('.hello{}Simple!' );
212
199
}));
213
200
});
@@ -222,16 +209,13 @@ void main() {
222
209
it ('should load multiple CSS files into a style' , async (
223
210
(Http http, Compiler compile, Scope rootScope, Logger log,
224
211
Injector injector, MockHttpBackend backend, DirectiveMap directives) {
225
- backend
226
- ..expectGET ('simple.css' ).respond (200 , '.hello{}' )
227
- ..expectGET ('another.css' ).respond (200 , '.world{}' )
228
- ..expectGET ('simple.html' ).respond (200 , '<div log="SIMPLE">Simple!</div>' );
229
-
230
212
var element = e ('<div><html-and-css log>ignore</html-and-css><div>' );
231
213
compile ([element], directives)(rootScope, null , [element]);
232
214
233
- microLeap ();
234
- backend.flush ();
215
+ backend
216
+ ..flushGET ('simple.css' ).respond (200 , '.hello{}' )
217
+ ..flushGET ('another.css' ).respond (200 , '.world{}' )
218
+ ..flushGET ('simple.html' ).respond (200 , '<div log="SIMPLE">Simple!</div>' );
235
219
microLeap ();
236
220
237
221
expect (element).toHaveText ('.hello{}.world{}Simple!' );
@@ -254,15 +238,12 @@ void main() {
254
238
it ('should load css from the style cache for the second component' , async (
255
239
(Http http, Compiler compile, MockHttpBackend backend, RootScope rootScope,
256
240
DirectiveMap directives, Injector injector) {
257
- backend
258
- ..expectGET ('simple.css' ).respond (200 , '.hello{}' )
259
- ..expectGET ('simple.html' ).respond (200 , '<div log="SIMPLE">Simple!</div>' );
260
-
261
241
var element = e ('<div><html-and-css>ignore</html-and-css><div>' );
262
242
compile ([element], directives)(rootScope, null , [element]);
263
243
264
- microLeap ();
265
- backend.flush ();
244
+ backend
245
+ ..flushGET ('simple.css' ).respond (200 , '.hello{}' )
246
+ ..flushGET ('simple.html' ).respond (200 , '<div log="SIMPLE">Simple!</div>' );
266
247
microLeap ();
267
248
268
249
expect (element.children[0 ].shadowRoot).toHaveHtml (
0 commit comments