| OLD | NEW |
| 1 library angular_spec; | 1 library angular_spec; |
| 2 | 2 |
| 3 import 'dart:mirrors'; | |
| 4 | |
| 5 import '_specs.dart'; | 3 import '_specs.dart'; |
| 6 import 'package:angular/utils.dart'; | 4 import 'package:angular/utils.dart'; |
| 7 import 'package:angular/tools/symbol_inspector/symbol_inspector.dart'; | |
| 8 | 5 |
| 9 main() { | 6 main() { |
| 10 describe('angular.dart unittests', () { | 7 describe('angular.dart unittests', () { |
| 11 it('should run in checked moded only', () { | 8 it('should run in checked moded only', () { |
| 12 expect(() { | 9 expect(() { |
| 13 dynamic v = 6; | 10 dynamic v = 6; |
| 14 String s = v; | 11 String s = v; |
| 15 }).toThrow(); | 12 }).toThrow(); |
| 16 }); | 13 }); |
| 17 }); | 14 }); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 36 expect(relaxFnApply(([a, b, c, d]) => d, noArgs)).toEqual(null); | 33 expect(relaxFnApply(([a, b, c, d]) => d, noArgs)).toEqual(null); |
| 37 expect(relaxFnApply(([a, b, c, d, e]) => e, noArgs)).toEqual(null); | 34 expect(relaxFnApply(([a, b, c, d, e]) => e, noArgs)).toEqual(null); |
| 38 }); | 35 }); |
| 39 | 36 |
| 40 it('should fail with not enough arguments', () { | 37 it('should fail with not enough arguments', () { |
| 41 expect(() { | 38 expect(() { |
| 42 relaxFnApply((required, alsoRequired) => "happy", [1]); | 39 relaxFnApply((required, alsoRequired) => "happy", [1]); |
| 43 }).toThrow('Unknown function type, expecting 0 to 5 args.'); | 40 }).toThrow('Unknown function type, expecting 0 to 5 args.'); |
| 44 }); | 41 }); |
| 45 }); | 42 }); |
| 46 | |
| 47 describe('symbols', () { | |
| 48 it('should not export unknown symbols from animate', () { | |
| 49 LibraryInfo libraryInfo; | |
| 50 try { | |
| 51 libraryInfo = getSymbolsFromLibrary("angular.animate"); | |
| 52 } on UnimplementedError catch (e) { | |
| 53 return; // Not implemented, quietly skip. | |
| 54 } | |
| 55 | |
| 56 var ALLOWED_NAMES = [ | |
| 57 "angular.animate.AbstractNgAnimate", | |
| 58 "angular.animate.AnimationLoop", | |
| 59 "angular.animate.AnimationModule", | |
| 60 "angular.animate.AnimationOptimizer", | |
| 61 "angular.animate.CssAnimate", | |
| 62 "angular.animate.CssAnimationMap", | |
| 63 "angular.animate.NgAnimate", | |
| 64 "angular.animate.NgAnimateChildren", | |
| 65 "angular.animate.CssAnimation", | |
| 66 "angular.animate.AnimationFrame", | |
| 67 "angular.animate.AnimationList", | |
| 68 "angular.animate.LoopedAnimation" | |
| 69 ]; | |
| 70 assertSymbolNamesAreOk(ALLOWED_NAMES, libraryInfo); | |
| 71 | |
| 72 }); | |
| 73 | |
| 74 it('should not export unknown symbols from angular', () { | |
| 75 // Test is failing? Add new symbols to the "ALLOWED_NAMES" list below. | |
| 76 // But make sure that you intend to export the symbol! | |
| 77 // Questions? Talk to @jbdeboer | |
| 78 | |
| 79 // There is a bug at the intersection of the angular library, | |
| 80 // dart2js and findLibrary(). http://dartbug.com/18302 | |
| 81 try { | |
| 82 currentMirrorSystem().findLibrary(const Symbol("angular")); | |
| 83 } catch (e) { | |
| 84 return; | |
| 85 } | |
| 86 | |
| 87 LibraryInfo libraryInfo; | |
| 88 try { | |
| 89 libraryInfo = getSymbolsFromLibrary("angular"); | |
| 90 } on UnimplementedError catch (e) { | |
| 91 return; // Not implemented, quietly skip. | |
| 92 } | |
| 93 | |
| 94 var ALLOWED_NAMES = [ | |
| 95 "angular.app.AngularModule", | |
| 96 "angular.app.Application", | |
| 97 "angular.core.annotation.ShadowRootAware", | |
| 98 "angular.core.annotation_src.AttachAware", | |
| 99 "angular.core.annotation_src.Component", | |
| 100 "angular.core.annotation_src.Controller", | |
| 101 "angular.core.annotation_src.Decorator", | |
| 102 "angular.core.annotation_src.DetachAware", | |
| 103 "angular.core.annotation_src.Directive", | |
| 104 "angular.core.annotation_src.DirectiveAnnotation", | |
| 105 "angular.core.annotation_src.Formatter", | |
| 106 "angular.core.annotation_src.Injectable", | |
| 107 "angular.core.annotation_src.NgAttr", | |
| 108 "angular.core.annotation_src.NgCallback", | |
| 109 "angular.core.annotation_src.NgOneWay", | |
| 110 "angular.core.annotation_src.NgOneWayOneTime", | |
| 111 "angular.core.annotation_src.NgTwoWay", | |
| 112 "angular.core.dom_internal.Animate", | |
| 113 "angular.core.dom_internal.Animation", | |
| 114 "angular.core.dom_internal.AnimationResult", | |
| 115 "angular.core.dom_internal.BoundViewFactory", | |
| 116 "angular.core.dom_internal.BrowserCookies", | |
| 117 "angular.core.dom_internal.Compiler", | |
| 118 "angular.core.dom_internal.Cookies", | |
| 119 "angular.core.dom_internal.DirectiveMap", | |
| 120 "angular.core.dom_internal.ElementProbe", | |
| 121 "angular.core.dom_internal.EventHandler", | |
| 122 "angular.core.dom_internal.Http", | |
| 123 "angular.core.dom_internal.HttpBackend", | |
| 124 "angular.core.dom_internal.HttpDefaultHeaders", | |
| 125 "angular.core.dom_internal.HttpDefaults", | |
| 126 "angular.core.dom_internal.HttpInterceptor", | |
| 127 "angular.core.dom_internal.HttpInterceptors", | |
| 128 "angular.core.dom_internal.HttpResponse", | |
| 129 "angular.core.dom_internal.HttpResponseConfig", | |
| 130 "angular.core.dom_internal.LocationWrapper", | |
| 131 "angular.core.dom_internal.NgElement", | |
| 132 "angular.core.dom_internal.NoOpAnimation", | |
| 133 "angular.core.dom_internal.NullTreeSanitizer", | |
| 134 "angular.core.dom_internal.RequestErrorInterceptor", | |
| 135 "angular.core.dom_internal.RequestInterceptor", | |
| 136 "angular.core.dom_internal.Response", | |
| 137 "angular.core.dom_internal.ResponseError", | |
| 138 "angular.core.dom_internal.TemplateCache", | |
| 139 "angular.core.dom_internal.UrlRewriter", | |
| 140 "angular.core.dom_internal.View", | |
| 141 "angular.core.dom_internal.ViewCache", | |
| 142 "angular.core.dom_internal.ViewFactory", | |
| 143 "angular.core.dom_internal.ViewPort", | |
| 144 "angular.core_internal.CacheStats", | |
| 145 "angular.core_internal.ExceptionHandler", | |
| 146 "angular.core_internal.Interpolate", | |
| 147 "angular.core_internal.RootScope", | |
| 148 "angular.core_internal.Scope", | |
| 149 "angular.core_internal.ScopeDigestTTL", | |
| 150 "angular.core_internal.ScopeEvent", | |
| 151 "angular.core_internal.ScopeStats", | |
| 152 "angular.core_internal.ScopeStatsConfig", | |
| 153 "angular.core_internal.ScopeStatsEmitter", | |
| 154 "angular.core_internal.VmTurnZone", | |
| 155 "angular.core.parser.dynamic_parser.ClosureMap", | |
| 156 "angular.core.parser.Parser", | |
| 157 "angular.directive.AHref", | |
| 158 "angular.directive.ContentEditable", | |
| 159 "angular.directive.DecoratorFormatter", | |
| 160 "angular.directive.InputCheckbox", | |
| 161 "angular.directive.InputDateLike", | |
| 162 "angular.directive.InputNumberLike", | |
| 163 "angular.directive.InputRadio", | |
| 164 "angular.directive.InputSelect", | |
| 165 "angular.directive.InputTextLike", | |
| 166 "angular.directive.NgAttribute", | |
| 167 "angular.directive.NgBaseCss", | |
| 168 "angular.directive.NgBind", | |
| 169 "angular.directive.NgBindHtml", | |
| 170 "angular.directive.NgBindTemplate", | |
| 171 "angular.directive.NgBindTypeForDateLike", | |
| 172 "angular.directive.NgBooleanAttribute", | |
| 173 "angular.directive.NgClass", | |
| 174 "angular.directive.NgClassEven", | |
| 175 "angular.directive.NgClassOdd", | |
| 176 "angular.directive.NgCloak", | |
| 177 "angular.directive.NgControl", | |
| 178 "angular.directive.NgEvent", | |
| 179 "angular.directive.NgFalseValue", | |
| 180 "angular.directive.NgForm", | |
| 181 "angular.directive.NgHide", | |
| 182 "angular.directive.NgIf", | |
| 183 "angular.directive.NgInclude", | |
| 184 "angular.directive.NgModel", | |
| 185 "angular.directive.NgModelConverter", | |
| 186 "angular.directive.NgModelEmailValidator", | |
| 187 "angular.directive.NgModelMaxLengthValidator", | |
| 188 "angular.directive.NgModelMaxNumberValidator", | |
| 189 "angular.directive.NgModelMinLengthValidator", | |
| 190 "angular.directive.NgModelMinNumberValidator", | |
| 191 "angular.directive.NgModelNumberValidator", | |
| 192 "angular.directive.NgModelPatternValidator", | |
| 193 "angular.directive.NgModelRequiredValidator", | |
| 194 "angular.directive.NgModelUrlValidator", | |
| 195 "angular.directive.NgNonBindable", | |
| 196 "angular.directive.NgNullControl", | |
| 197 "angular.directive.NgNullForm", | |
| 198 "angular.directive.NgPluralize", | |
| 199 "angular.directive.NgRepeat", | |
| 200 "angular.directive.NgShow", | |
| 201 "angular.directive.NgSource", | |
| 202 "angular.directive.NgStyle", | |
| 203 "angular.directive.NgSwitch", | |
| 204 "angular.directive.NgSwitchDefault", | |
| 205 "angular.directive.NgSwitchWhen", | |
| 206 "angular.directive.NgTemplate", | |
| 207 "angular.directive.NgTrueValue", | |
| 208 "angular.directive.NgUnless", | |
| 209 "angular.directive.NgValidator", | |
| 210 "angular.directive.NgValue", | |
| 211 "angular.directive.OptionValue", | |
| 212 "angular.formatter_internal.Currency", | |
| 213 "angular.formatter_internal.Date", | |
| 214 "angular.formatter_internal.Filter", | |
| 215 "angular.formatter_internal.Json", | |
| 216 "angular.formatter_internal.LimitTo", | |
| 217 "angular.formatter_internal.Lowercase", | |
| 218 "angular.formatter_internal.Arrayify", | |
| 219 "angular.formatter_internal.Number", | |
| 220 "angular.formatter_internal.OrderBy", | |
| 221 "angular.formatter_internal.Stringify", | |
| 222 "angular.formatter_internal.Uppercase", | |
| 223 "angular.introspection.ngDirectives", | |
| 224 "angular.introspection.ngInjector", | |
| 225 "angular.introspection.ngProbe", | |
| 226 "angular.introspection.ngQuery", | |
| 227 "angular.introspection.ngScope", | |
| 228 "angular.routing.NgBindRoute", | |
| 229 "angular.routing.ngRoute", | |
| 230 "angular.routing.NgRouteCfg", | |
| 231 "angular.routing.NgRoutingHelper", | |
| 232 "angular.routing.NgRoutingUsePushState", | |
| 233 "angular.routing.NgView", | |
| 234 "angular.routing.RouteInitializer", | |
| 235 "angular.routing.RouteInitializerFn", | |
| 236 "angular.routing.RouteProvider", | |
| 237 "angular.routing.RouteViewFactory", | |
| 238 "angular.routing.RoutingModule", | |
| 239 "angular.watch_group.PrototypeMap", | |
| 240 "angular.watch_group.ReactionFn", | |
| 241 "angular.watch_group.Watch", | |
| 242 "change_detection.AvgStopwatch", | |
| 243 "change_detection.FieldGetterFactory", | |
| 244 "di.CircularDependencyError", | |
| 245 "di.FactoryFn", | |
| 246 "di.Injector", | |
| 247 "di.InvalidBindingError", | |
| 248 "di.Module", | |
| 249 "di.NoProviderError", | |
| 250 "di.ObjectFactory", | |
| 251 "di.TypeFactory", | |
| 252 "di.Visibility", | |
| 253 "route.client.Routable", | |
| 254 "route.client.Route", | |
| 255 "route.client.RouteEnterEvent", | |
| 256 "route.client.RouteEnterEventHandler", | |
| 257 "route.client.RouteEvent", | |
| 258 "route.client.RouteHandle", | |
| 259 "route.client.RouteImpl", | |
| 260 "route.client.RouteLeaveEvent", | |
| 261 "route.client.RouteLeaveEventHandler", | |
| 262 "route.client.RoutePreEnterEvent", | |
| 263 "route.client.RoutePreEnterEventHandler", | |
| 264 "route.client.Router", | |
| 265 "route.client.RouteStartEvent", | |
| 266 "url_matcher.UrlMatch", | |
| 267 "url_matcher.UrlMatcher" | |
| 268 ]; | |
| 269 | |
| 270 assertSymbolNamesAreOk(ALLOWED_NAMES, libraryInfo); | |
| 271 }); | |
| 272 }); | |
| 273 } | 43 } |
| 274 | |
| OLD | NEW |