@@ -98,16 +98,15 @@ _run({resolveUrls, staticMode}) {
98
98
Injector injector, VmTurnZone zone, MockHttpBackend backend,
99
99
DirectiveMap directives) {
100
100
101
- backend
102
- ..whenGET ('PREFIX:${prefix }simple.html' ).respond ('<div log="SIMPLE">Simple!</div>' )
103
- ..whenGET ('PREFIX:${prefix }simple.css' ).respond ('.hello{}' );
104
-
105
101
var element = e ('<div><html-and-css log>ignore</html-and-css><div>' );
106
102
zone.run (() {
107
103
compile ([element], directives)(rootScope, null , [element]);
108
104
});
109
105
110
- backend.flush ();
106
+ backend
107
+ ..flushGET ('PREFIX:${prefix }simple.css' ).respond ('.hello{}' )
108
+ ..flushGET ('PREFIX:${prefix }simple.html' ).respond ('<div log="SIMPLE">Simple!</div>' );
109
+
111
110
microLeap ();
112
111
113
112
expect (element).toHaveText ('.hello{}Simple!' );
@@ -131,13 +130,10 @@ _run({resolveUrls, staticMode}) {
131
130
it ('should replace element with template from url' , async (
132
131
(Http http, Compiler compile, Scope rootScope, Logger log,
133
132
Injector injector, MockHttpBackend backend, DirectiveMap directives) {
134
- backend.expectGET ('${prefix }simple.html' ).respond (200 , '<div log="SIMPLE">Simple!<img src="a.png"></div>' );
135
-
136
133
var element = es ('<div><simple-url log>ignore</simple-url><div>' );
137
134
compile (element, directives)(rootScope, null , element);
138
135
139
- microLeap ();
140
- backend.flush ();
136
+ backend.flushGET ('${prefix }simple.html' ).respond (200 , '<div log="SIMPLE">Simple!</div>' );
141
137
microLeap ();
142
138
143
139
expect (element[0 ]).toHaveText ('Simple!' );
@@ -149,17 +145,14 @@ _run({resolveUrls, staticMode}) {
149
145
it ('should load template from URL once' , async (
150
146
(Http http, Compiler compile, Scope rootScope, Logger log,
151
147
Injector injector, MockHttpBackend backend, DirectiveMap directives) {
152
- backend.whenGET ('${prefix }simple.html' ).respond (200 , '<div log="SIMPLE">Simple!</div>' );
153
-
154
148
var element = es (
155
149
'<div>'
156
150
'<simple-url log>ignore</simple-url>'
157
151
'<simple-url log>ignore</simple-url>'
158
152
'<div>' );
159
153
compile (element, directives)(rootScope, null , element);
160
154
161
- microLeap ();
162
- backend.flush ();
155
+ backend.flushGET ('${prefix }simple.html' ).respond (200 , '<div log="SIMPLE">Simple!</div>' );
163
156
microLeap ();
164
157
165
158
expect (element.first).toHaveText ('Simple!Simple!' );
@@ -172,15 +165,13 @@ _run({resolveUrls, staticMode}) {
172
165
it ('should load a CSS file into a style' , async (
173
166
(Http http, Compiler compile, Scope rootScope, Logger log,
174
167
Injector injector, MockHttpBackend backend, DirectiveMap directives) {
175
- backend
176
- ..expectGET ('${prefix }simple.css' ).respond (200 , '.hello{}' )
177
- ..expectGET ('${prefix }simple.html' ).respond (200 , '<div log="SIMPLE">Simple!</div>' );
178
-
179
168
var element = e ('<div><html-and-css log>ignore</html-and-css><div>' );
180
169
compile ([element], directives)(rootScope, null , [element]);
181
170
182
- microLeap ();
183
- backend.flush ();
171
+ backend
172
+ ..flushGET ('${prefix }simple.css' ).respond (200 , '.hello{}' )
173
+ ..flushGET ('${prefix }simple.html' ).respond (200 , '<div log="SIMPLE">Simple!</div>' );
174
+
184
175
microLeap ();
185
176
186
177
expect (element).toHaveText ('.hello{}Simple!' );
@@ -196,25 +187,23 @@ _run({resolveUrls, staticMode}) {
196
187
(Http http, Compiler compile, Scope rootScope, Injector injector,
197
188
MockHttpBackend backend, DirectiveMap directives) {
198
189
var element = es ('<div><inline-with-css log>ignore</inline-with-css><div>' );
199
- backend.expectGET ('${prefix }simple.css' ).respond (200 , '.hello{}' );
200
190
compile (element, directives)(rootScope, null , element);
201
191
192
+ backend.flushGET ('${prefix }simple.css' ).respond (200 , '.hello{}' );
202
193
microLeap ();
203
- backend.flush ();
204
- microLeap ();
194
+
205
195
expect (element[0 ]).toHaveText ('.hello{}inline!' );
206
196
}));
207
197
208
198
it ('should ignore CSS load errors ' , async (
209
199
(Http http, Compiler compile, Scope rootScope, Injector injector,
210
200
MockHttpBackend backend, DirectiveMap directives) {
211
201
var element = es ('<div><inline-with-css log>ignore</inline-with-css><div>' );
212
- backend.expectGET ('${prefix }simple.css' ).respond (500 , 'some error' );
213
202
compile (element, directives)(rootScope, null , element);
214
203
204
+ backend.flushGET ('${prefix }simple.css' ).respond (500 , 'some error' );
215
205
microLeap ();
216
- backend.flush ();
217
- microLeap ();
206
+
218
207
expect (element.first).toHaveText (
219
208
'/*\n '
220
209
'HTTP 500: some error\n '
@@ -226,28 +215,25 @@ _run({resolveUrls, staticMode}) {
226
215
(Http http, Compiler compile, Scope rootScope, Injector injector,
227
216
MockHttpBackend backend, DirectiveMap directives) {
228
217
var element = es ('<div><only-css log>ignore</only-css><div>' );
229
- backend.expectGET ('${prefix }simple.css' ).respond (200 , '.hello{}' );
230
218
compile (element, directives)(rootScope, null , element);
231
219
220
+ backend.flushGET ('${prefix }simple.css' ).respond (200 , '.hello{}' );
232
221
microLeap ();
233
- backend.flush ();
234
- microLeap ();
222
+
235
223
expect (element[0 ]).toHaveText ('.hello{}' );
236
224
}));
237
225
238
226
it ('should load the CSS before the template is loaded' , async (
239
227
(Http http, Compiler compile, Scope rootScope, Injector injector,
240
228
MockHttpBackend backend, DirectiveMap directives) {
241
- backend
242
- ..expectGET ('${prefix }simple.css' ).respond (200 , '.hello{}' )
243
- ..expectGET ('${prefix }simple.html' ).respond (200 , '<div>Simple!</div>' );
244
-
245
229
var element = es ('<html-and-css>ignore</html-and-css>' );
246
230
compile (element, directives)(rootScope, null , element);
247
231
232
+ backend
233
+ ..flushGET ('${prefix }simple.css' ).respond (200 , '.hello{}' )
234
+ ..flushGET ('${prefix }simple.html' ).respond (200 , '<div>Simple!</div>' );
248
235
microLeap ();
249
- backend.flush ();
250
- microLeap ();
236
+
251
237
expect (element.first).toHaveText ('.hello{}Simple!' );
252
238
}));
253
239
});
@@ -262,16 +248,13 @@ _run({resolveUrls, staticMode}) {
262
248
it ('should load multiple CSS files into a style' , async (
263
249
(Http http, Compiler compile, Scope rootScope, Logger log,
264
250
Injector injector, MockHttpBackend backend, DirectiveMap directives) {
265
- backend
266
- ..expectGET ('${prefix }simple.css' ).respond (200 , '.hello{}' )
267
- ..expectGET ('${prefix }another.css' ).respond (200 , '.world{}' )
268
- ..expectGET ('${prefix }simple.html' ).respond (200 , '<div log="SIMPLE">Simple!</div>' );
269
-
270
251
var element = e ('<div><html-and-css log>ignore</html-and-css><div>' );
271
252
compile ([element], directives)(rootScope, null , [element]);
272
253
273
- microLeap ();
274
- backend.flush ();
254
+ backend
255
+ ..flushGET ('${prefix }simple.css' ).respond (200 , '.hello{}' )
256
+ ..flushGET ('${prefix }another.css' ).respond (200 , '.world{}' )
257
+ ..flushGET ('${prefix }simple.html' ).respond (200 , '<div log="SIMPLE">Simple!</div>' );
275
258
microLeap ();
276
259
277
260
expect (element).toHaveText ('.hello{}.world{}Simple!' );
@@ -295,15 +278,12 @@ _run({resolveUrls, staticMode}) {
295
278
it ('should load css from the style cache for the second component' , async (
296
279
(Http http, Compiler compile, MockHttpBackend backend, RootScope rootScope,
297
280
DirectiveMap directives, Injector injector) {
298
- backend
299
- ..expectGET ('${prefix }simple.css' ).respond (200 , '.hello{}' )
300
- ..expectGET ('${prefix }simple.html' ).respond (200 , '<div log="SIMPLE">Simple!</div>' );
301
-
302
281
var element = e ('<div><html-and-css>ignore</html-and-css><div>' );
303
282
compile ([element], directives)(rootScope, null , [element]);
304
283
305
- microLeap ();
306
- backend.flush ();
284
+ backend
285
+ ..flushGET ('${prefix }simple.css' ).respond (200 , '.hello{}' )
286
+ ..flushGET ('${prefix }simple.html' ).respond (200 , '<div log="SIMPLE">Simple!</div>' );
307
287
microLeap ();
308
288
309
289
expect (element.children[0 ].shadowRoot).toHaveHtml (
0 commit comments