This repository was archived by the owner on Feb 22, 2018. It is now read-only.
File tree 2 files changed +37
-1
lines changed
2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ class WalkingViewFactory implements ViewFactory {
118
118
@Injectable ()
119
119
class ViewCache {
120
120
// _viewFactoryCache is unbounded
121
- final _viewFactoryCache = new LruCache <String , ViewFactory >(capacity : 0 );
121
+ final _viewFactoryCache = new LruCache <String , ViewFactory >();
122
122
final Http http;
123
123
final TemplateCache templateCache;
124
124
final Compiler compiler;
Original file line number Diff line number Diff line change
1
+ library angular.dom.view_cache_spec;
2
+
3
+ import '../_specs.dart' ;
4
+
5
+ main () {
6
+ describe ('ViewCache' , () {
7
+ var HTML = '<div>html</div>' ;
8
+ var mockCompiler;
9
+ beforeEachModule ((Module module) {
10
+ var httpBackend = new MockHttpBackend ();
11
+
12
+ module
13
+ ..bind (HttpBackend , toValue: httpBackend)
14
+ ..bind (MockHttpBackend , toValue: httpBackend);
15
+ });
16
+
17
+ it ('should cache the ViewFactory' , async ((
18
+ ViewCache cache, MockHttpBackend backend, DirectiveMap directives) {
19
+ var firstFactory = cache.fromHtml (HTML , directives);
20
+
21
+ expect (cache.fromHtml (HTML , directives)).toBe (firstFactory);
22
+
23
+ // Also for fromUrl
24
+ backend.whenGET ('template.url' ).respond (200 , HTML );
25
+
26
+ var httpFactory;
27
+ cache.fromUrl ('template.url' , directives).then ((f) => httpFactory = f);
28
+
29
+ microLeap ();
30
+ backend.flush ();
31
+ microLeap ();
32
+
33
+ expect (httpFactory).toBe (firstFactory);
34
+ }));
35
+ });
36
+ }
You can’t perform that action at this time.
0 commit comments