@angular-wave/angular.ts 0.7.7 → 0.8.0
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.
- package/@types/animations/raf-scheduler.d.ts +2 -2
- package/@types/animations/shared.d.ts +0 -1
- package/@types/core/compile/attributes.d.ts +3 -3
- package/@types/core/compile/compile.d.ts +1 -1
- package/@types/core/di/injector.d.ts +0 -1
- package/@types/core/di/internal-injector.d.ts +1 -0
- package/@types/core/di/ng-module.d.ts +5 -0
- package/@types/core/filter/filter.d.ts +11 -13
- package/@types/core/parse/parse.d.ts +6 -7
- package/@types/core/sanitize/sanitize-uri.d.ts +3 -6
- package/@types/core/scope/scope.d.ts +1 -1
- package/@types/directive/attrs/attrs.d.ts +7 -1
- package/@types/directive/bind/bind.d.ts +2 -1
- package/@types/directive/events/events.d.ts +9 -3
- package/@types/directive/http/http.d.ts +6 -2
- package/@types/directive/include/include.d.ts +2 -2
- package/@types/directive/input/input.d.ts +2 -12
- package/@types/directive/messages/messages.d.ts +9 -48
- package/@types/directive/model/model.d.ts +3 -3
- package/@types/directive/options/options.d.ts +13 -20
- package/@types/directive/switch/switch.d.ts +1 -0
- package/@types/directive/transclude/transclude.d.ts +10 -6
- package/@types/index.d.ts +1 -1
- package/@types/interface.d.ts +56 -18
- package/@types/{public.d.ts → ng.d.ts} +2 -2
- package/@types/router/directives/view-directive.d.ts +2 -19
- package/@types/router/{common → glob}/glob.d.ts +5 -1
- package/@types/router/globals.d.ts +2 -3
- package/@types/router/path/path-utils.d.ts +8 -11
- package/@types/router/state/interface.d.ts +1 -1
- package/@types/router/state/state-object.d.ts +1 -1
- package/@types/router/state/state-registry.d.ts +1 -2
- package/@types/router/state/state-service.d.ts +8 -7
- package/@types/router/state-filters.d.ts +24 -2
- package/@types/router/transition/transition.d.ts +12 -15
- package/@types/router/url/url-matcher.d.ts +3 -3
- package/@types/router/url/url-rule.d.ts +1 -0
- package/@types/router/url/url-rules.d.ts +26 -6
- package/@types/router/url/url-service.d.ts +30 -42
- package/@types/services/anchor-scroll.d.ts +1 -1
- package/@types/{core → services/exception}/exception-handler.d.ts +4 -4
- package/@types/{core/error-handler.d.ts → services/exception/interface.d.ts} +1 -1
- package/@types/services/http/http.d.ts +48 -3
- package/@types/services/http/interface.d.ts +2 -2
- package/@types/services/http-backend/http-backend.d.ts +49 -44
- package/@types/services/location/interface.d.ts +63 -0
- package/@types/services/location/location.d.ts +330 -0
- package/@types/{core → services}/sce/sce.d.ts +1 -1
- package/@types/services/template-cache/interface.d.ts +8 -2
- package/@types/services/template-cache/template-cache.d.ts +1 -1
- package/@types/services/template-request.d.ts +1 -1
- package/@types/shared/cache.d.ts +0 -2
- package/@types/shared/common.d.ts +0 -2
- package/@types/shared/dom.d.ts +6 -0
- package/@types/shared/interface.d.ts +0 -4
- package/@types/{router/common → shared}/queue.d.ts +2 -2
- package/@types/shared/test-utils.d.ts +1 -0
- package/@types/shared/url-utils/interface.d.ts +46 -0
- package/@types/shared/url-utils/url-utils.d.ts +64 -0
- package/@types/shared/utils.d.ts +44 -6
- package/Makefile +8 -4
- package/dist/angular-ts.esm.js +1889 -2199
- package/dist/angular-ts.umd.js +1889 -2199
- package/dist/angular-ts.umd.min.js +1 -1
- package/docs/assets/scss/index.scss +23 -0
- package/docs/content/_index.md +9 -8
- package/docs/content/docs/_index.md +1 -1
- package/docs/content/docs/directive/app.md +1 -1
- package/docs/content/docs/directive/bind.md +10 -8
- package/docs/content/docs/directive/blur.md +1 -1
- package/docs/content/docs/directive/channel.md +2 -2
- package/docs/content/docs/directive/class-even.md +1 -1
- package/docs/content/docs/directive/class-odd.md +1 -1
- package/docs/content/docs/directive/class.md +1 -1
- package/docs/content/docs/directive/click.md +1 -1
- package/docs/content/docs/directive/copy.md +1 -1
- package/docs/content/docs/directive/cut.md +1 -1
- package/docs/content/docs/directive/dblclick.md +1 -1
- package/docs/content/docs/directive/focus.md +1 -1
- package/docs/content/docs/directive/get.md +203 -0
- package/docs/content/docs/directive/keydown.md +1 -1
- package/docs/content/docs/directive/keyup.md +1 -1
- package/docs/content/docs/directive/load.md +1 -1
- package/docs/content/docs/directive/mousedown.md +1 -1
- package/docs/content/docs/directive/mouseenter.md +1 -1
- package/docs/content/docs/directive/mouseleave.md +1 -1
- package/docs/content/docs/directive/mousemove.md +1 -1
- package/docs/content/docs/directive/mouseout.md +1 -1
- package/docs/content/docs/directive/mouseover.md +1 -1
- package/docs/content/docs/directive/mouseup.md +1 -1
- package/docs/content/docs/directive/non-bindable.md +28 -0
- package/docs/content/docs/provider/locationProvider.md +26 -0
- package/docs/content/docs/provider/templateCacheProvider.md +66 -1
- package/docs/content/docs/service/location.md +57 -0
- package/docs/content/docs/service/templateCache.md +2 -2
- package/docs/content/docs/service/url.md +5 -0
- package/docs/layouts/partials/hooks/head-end.html +1 -1
- package/docs/layouts/shortcodes/showcss.html +2 -0
- package/docs/layouts/shortcodes/version.html +1 -0
- package/docs/static/examples/counter/counter-test.html +0 -4
- package/docs/static/examples/eventbus/eventbus-test.html +0 -4
- package/docs/static/examples/ng-bind/ng-bind.html +2 -2
- package/docs/static/examples/ng-non-bindable/ng-non-bindable-test.html +13 -0
- package/docs/static/examples/ng-non-bindable/ng-non-bindable.html +3 -0
- package/docs/static/examples/ng-non-bindable/ng-non-bindable.test.js +11 -0
- package/docs/static/typedoc/assets/hierarchy.js +1 -1
- package/docs/static/typedoc/assets/highlight.css +6 -6
- package/docs/static/typedoc/assets/navigation.js +1 -1
- package/docs/static/typedoc/assets/search.js +1 -1
- package/docs/static/typedoc/classes/Location.html +55 -0
- package/docs/static/typedoc/classes/LocationProvider.html +20 -0
- package/docs/static/typedoc/classes/NgModule.html +32 -0
- package/docs/static/typedoc/classes/TemplateCacheProvider.html +1 -1
- package/docs/static/typedoc/hierarchy.html +1 -1
- package/docs/static/typedoc/index.html +1 -1
- package/docs/static/typedoc/interfaces/DefaultPorts.html +5 -0
- package/docs/static/typedoc/interfaces/Directive.html +5 -4
- package/docs/static/typedoc/interfaces/Html5Mode.html +23 -0
- package/docs/static/typedoc/interfaces/HttpProviderDefaults.html +1 -1
- package/docs/static/typedoc/interfaces/HttpResponse.html +2 -3
- package/docs/static/typedoc/interfaces/Provider.html +16 -10
- package/docs/static/typedoc/interfaces/RequestConfig.html +1 -1
- package/docs/static/typedoc/interfaces/RequestShortcutConfig.html +1 -1
- package/docs/static/typedoc/interfaces/TemplateCache.html +7 -0
- package/docs/static/typedoc/interfaces/UrlParts.html +9 -0
- package/docs/static/typedoc/types/AnnotatedDirectiveFactory.html +1 -0
- package/docs/static/typedoc/types/AnnotatedFactory.html +1 -1
- package/docs/static/typedoc/types/DirectiveFactory.html +1 -2
- package/docs/static/typedoc/types/DirectiveFactoryFn.html +1 -0
- package/docs/static/typedoc/types/Expression.html +1 -1
- package/docs/static/typedoc/types/HttpResponseStatus.html +1 -0
- package/docs/static/typedoc/types/{TemplateCache.html → SwapModeType.html} +1 -1
- package/docs/static/typedoc/types/UrlChangeListener.html +5 -0
- package/docs/static/typedoc/variables/SwapMode.html +11 -0
- package/docs/static/version.js +13 -0
- package/docs/test-results/.last-run.json +4 -0
- package/docs/test-results/static-examples-counter-counter-counter-example/error-context.md +50 -0
- package/legacy.d.ts +0 -10
- package/package.json +1 -3
- package/src/{loader.js → angular.js} +5 -10
- package/src/angular.spec.js +189 -21
- package/src/animations/animate-children-directive.js +2 -2
- package/src/animations/animate-css.js +17 -18
- package/src/animations/animate.spec.js +1 -1
- package/src/animations/raf-scheduler.js +1 -1
- package/src/animations/shared.js +2 -12
- package/src/binding.spec.js +1 -1
- package/src/core/compile/attributes.js +1 -1
- package/src/core/compile/compile.js +7 -10
- package/src/core/compile/compile.spec.js +1 -1
- package/src/core/controller/controller.spec.js +1 -1
- package/src/core/controller/controller.test.js +1 -0
- package/src/core/di/injector.js +11 -25
- package/src/core/di/injector.spec.js +2 -2
- package/src/core/di/injector.test.js +2 -2
- package/src/core/di/internal-injector.js +7 -7
- package/src/core/di/ng-module.js +12 -27
- package/src/core/filter/filter.js +28 -28
- package/src/core/filter/filter.spec.js +1 -1
- package/src/core/filter/filter.test.js +1 -0
- package/src/core/interpolate/interpolate.js +4 -6
- package/src/core/interpolate/interpolate.spec.js +1 -1
- package/src/core/interpolate/interpolate.test.js +1 -0
- package/src/core/parse/ast/ast.spec.js +1 -1
- package/src/core/parse/ast/ast.test.js +1 -1
- package/src/core/parse/interpreter.js +32 -38
- package/src/core/parse/lexer/lexer.spec.js +1 -1
- package/src/core/parse/parse.js +150 -146
- package/src/core/parse/parse.spec.js +17 -16
- package/src/core/prop.spec.js +1 -1
- package/src/core/root-element.spec.js +1 -1
- package/src/core/sanitize/sanitize-uri.js +3 -3
- package/src/core/scope/scope.js +12 -13
- package/src/core/scope/scope.spec.js +3 -4
- package/src/directive/aria/aria.spec.js +1 -1
- package/src/directive/aria/aria.test.js +1 -0
- package/src/directive/attrs/attrs.js +7 -4
- package/src/directive/attrs/attrs.spec.js +1 -1
- package/src/directive/attrs/attrs.test.js +1 -0
- package/src/directive/attrs/boolean.spec.js +1 -1
- package/src/directive/attrs/boolean.test.js +1 -0
- package/src/directive/attrs/element-style.spec.js +1 -1
- package/src/directive/attrs/element-style.test.js +1 -0
- package/src/directive/attrs/src.spec.js +1 -1
- package/src/directive/attrs/src.test.js +1 -0
- package/src/directive/bind/bind-html.spec.js +1 -1
- package/src/directive/bind/bind.js +1 -0
- package/src/directive/bind/bind.spec.js +1 -1
- package/src/directive/bind/bind.test.js +1 -0
- package/src/directive/channel/channel.spec.js +1 -1
- package/src/directive/channel/channel.test.js +1 -0
- package/src/directive/class/class.spec.js +1 -1
- package/src/directive/class/class.test.js +1 -0
- package/src/directive/cloak/cloak.spec.js +1 -1
- package/src/directive/cloak/cloak.test.js +1 -0
- package/src/directive/controller/controller.spec.js +1 -1
- package/src/directive/controller/controller.test.js +1 -0
- package/src/directive/events/click.spec.js +1 -1
- package/src/directive/events/event.spec.js +1 -1
- package/src/directive/events/events.js +6 -2
- package/src/directive/events/events.test.js +1 -0
- package/src/directive/form/form.js +8 -5
- package/src/directive/form/form.spec.js +1 -1
- package/src/directive/form/form.test.js +1 -0
- package/src/directive/http/delete.spec.js +3 -1
- package/src/directive/http/form-test.html +18 -0
- package/src/directive/http/get.spec.js +281 -4
- package/src/directive/http/http.js +112 -15
- package/src/directive/http/http.test.js +2 -2
- package/src/directive/http/post.spec.js +506 -9
- package/src/directive/http/put.spec.js +3 -1
- package/src/directive/if/if.spec.js +1 -1
- package/src/directive/include/include.js +7 -7
- package/src/directive/include/include.spec.js +1 -1
- package/src/directive/init/init.spec.js +1 -1
- package/src/directive/init/init.test.js +1 -0
- package/src/directive/input/input.js +19 -43
- package/src/directive/input/input.spec.js +1 -2
- package/src/directive/input/input.test.js +1 -0
- package/src/directive/messages/messages.js +4 -0
- package/src/directive/messages/messages.spec.js +1 -1
- package/src/directive/messages/messages.test.js +1 -0
- package/src/directive/model/model.js +14 -14
- package/src/directive/model/model.spec.js +1 -1
- package/src/directive/model/model.test.js +1 -0
- package/src/directive/model-options/model-option.test.js +1 -0
- package/src/directive/model-options/model-options.js +1 -1
- package/src/directive/model-options/model-options.spec.js +1 -1
- package/src/directive/non-bindable/non-bindable.spec.js +1 -1
- package/src/directive/non-bindable/non-bindable.test.js +1 -0
- package/src/directive/observe/observe.spec.js +1 -1
- package/src/directive/observe/observe.test.js +1 -0
- package/src/directive/on/on.spec.js +1 -1
- package/src/directive/on/on.test.js +1 -0
- package/src/directive/options/options.js +454 -464
- package/src/directive/options/options.spec.js +1 -1
- package/src/directive/options/options.test.js +1 -0
- package/src/directive/ref/href.spec.js +1 -1
- package/src/directive/ref/href.test.js +2 -0
- package/src/directive/ref/ref.spec.js +1 -1
- package/src/directive/repeat/repeat.spec.js +2 -3
- package/src/directive/repeat/repeat.test.js +1 -0
- package/src/directive/script/script.spec.js +1 -1
- package/src/directive/script/script.test.js +1 -0
- package/src/directive/select/select.js +1 -1
- package/src/directive/select/select.spec.js +1 -1
- package/src/directive/select/select.test.js +1 -0
- package/src/directive/setter/setter.js +12 -14
- package/src/directive/setter/setter.spec.js +40 -17
- package/src/directive/setter/setter.test.js +1 -0
- package/src/directive/show-hide/show-hide.spec.js +1 -1
- package/src/directive/show-hide/show-hide.test.js +1 -0
- package/src/directive/style/style.spec.js +1 -1
- package/src/directive/style/style.test.js +1 -0
- package/src/directive/switch/switch.js +1 -0
- package/src/directive/switch/switch.spec.js +1 -1
- package/src/directive/switch/switch.test.js +1 -0
- package/src/directive/transclude/transclude.js +87 -89
- package/src/directive/validators/validators.js +82 -84
- package/src/directive/validators/validators.spec.js +5 -4
- package/src/directive/validators/validators.test.js +1 -0
- package/src/filters/filter.spec.js +1 -1
- package/src/filters/filters.spec.js +1 -1
- package/src/filters/limit-to.js +2 -3
- package/src/filters/limit-to.spec.js +1 -1
- package/src/filters/order-by.spec.js +1 -1
- package/src/index.js +1 -1
- package/src/injection-tokens.js +6 -2
- package/src/interface.ts +70 -19
- package/src/loader.md +0 -155
- package/src/{public.js → ng.js} +16 -23
- package/src/{public.spec.js → ng.spec.js} +1 -1
- package/src/router/directives/state-directives.spec.js +9 -8
- package/src/router/directives/view-directive.js +11 -9
- package/src/router/directives/view-directive.spec.js +8 -9
- package/src/router/{common/common.html → glob/glob.html} +2 -3
- package/src/router/{common → glob}/glob.js +5 -0
- package/src/router/{common/common.test.js → glob/glob.test.js} +2 -1
- package/src/router/globals.js +1 -2
- package/src/router/path/path-utils.js +5 -0
- package/src/router/router-test-hashbang.html +45 -0
- package/src/router/services.spec.js +5 -6
- package/src/router/state/interface.ts +1 -1
- package/src/router/state/state-builder.js +3 -3
- package/src/router/state/state-builder.spec.js +1 -1
- package/src/router/state/state-object.js +1 -1
- package/src/router/state/state-registry.js +2 -3
- package/src/router/state/state-service.js +13 -10
- package/src/router/state/state.spec.js +23 -22
- package/src/router/state/state.test.js +1 -0
- package/src/router/state/views.js +1 -1
- package/src/router/state-filter.spec.js +1 -1
- package/src/router/state-filters.js +15 -11
- package/src/router/template-factory.js +5 -4
- package/src/router/template-factory.spec.js +1 -1
- package/src/router/transition/hook-registry.js +1 -1
- package/src/router/transition/transition-service.js +6 -5
- package/src/router/transition/transition.js +4 -4
- package/src/router/url/url-matcher.js +3 -3
- package/src/router/url/url-rule.js +1 -0
- package/src/router/url/url-rules.js +8 -5
- package/src/router/url/url-service.js +82 -85
- package/src/router/url/url-service.spec.js +55 -39
- package/src/router/url/url.test.js +1 -0
- package/src/router/view/view.js +4 -5
- package/src/router/view/view.spec.js +10 -12
- package/src/router/view/view.test.js +1 -0
- package/src/router/view-hook.spec.js +1 -1
- package/src/router/view-scroll.spec.js +1 -1
- package/src/services/anchor-scroll.html +2 -9
- package/src/services/anchor-scroll.js +6 -5
- package/src/{core → services/exception}/exception-handler.js +2 -2
- package/src/{core/error-handler.ts → services/exception/interface.ts} +1 -1
- package/src/services/http/http.js +11 -17
- package/src/services/http/http.spec.js +2 -7
- package/src/services/http/interface.ts +2 -2
- package/src/services/http/template-request.spec.js +1 -1
- package/src/services/http-backend/http-backend.js +53 -89
- package/src/services/http-backend/http-backend.spec.js +2 -6
- package/src/services/http-backend/http-backend.test.js +1 -0
- package/src/services/location/interface.ts +70 -0
- package/src/{core → services}/location/location.html +4 -1
- package/src/services/location/location.js +999 -0
- package/src/{core → services}/location/location.spec.js +911 -532
- package/src/{core → services}/location/location.test.js +2 -2
- package/src/services/log/log.spec.js +1 -1
- package/src/services/log/log.test.js +1 -0
- package/src/services/pubsub/pubsub.spec.js +1 -1
- package/src/{core → services}/sce/sce.html +1 -1
- package/src/{core → services}/sce/sce.js +14 -10
- package/src/{core → services}/sce/sce.md +2 -2
- package/src/{core → services}/sce/sce.spec.js +3 -4
- package/src/{core → services}/sce/sce.test.js +1 -1
- package/src/services/template-cache/interface.ts +8 -2
- package/src/services/template-cache/template-cache.js +3 -1
- package/src/services/template-cache/template-cache.spec.js +73 -1
- package/src/services/template-cache/template-cache.test.js +1 -0
- package/src/services/template-request.js +2 -1
- package/src/shared/cache.js +0 -2
- package/src/shared/common.js +0 -5
- package/src/shared/common.spec.js +1 -1
- package/src/shared/dom.js +10 -0
- package/src/shared/interface.ts +0 -4
- package/src/{router/common → shared}/queue.js +7 -7
- package/src/shared/shared.html +1 -0
- package/src/shared/shared.test.js +1 -0
- package/src/shared/test-utils.js +1 -0
- package/src/shared/url-utils/interface.ts +54 -0
- package/src/{core → shared}/url-utils/url-utils.html +4 -1
- package/src/{core → shared}/url-utils/url-utils.js +26 -47
- package/src/{core → shared}/url-utils/url-utils.spec.js +10 -17
- package/src/{core → shared}/url-utils/url-utils.test.js +1 -1
- package/src/shared/utils.js +60 -9
- package/src/shared/utils.spec.js +35 -1
- package/src/src.html +1 -2
- package/typedoc.json +0 -1
- package/utils/express.js +36 -2
- package/utils/version.cjs +23 -0
- package/@types/core/location/location.d.ts +0 -317
- package/@types/core/task-tracker-factory.d.ts +0 -76
- package/@types/core/url-utils/url-utils.d.ts +0 -56
- package/@types/router/state-provider.d.ts +0 -123
- package/@types/services/browser.d.ts +0 -101
- package/docs/static/typedoc/types/SwapInsertPosition.html +0 -2
- package/jsdoc.json +0 -22
- package/src/core/location/location.js +0 -984
- package/src/core/location/location.md +0 -114
- package/src/core/task-tracker-factory.js +0 -145
- package/src/core/url-utils/url-utils.md +0 -46
- package/src/directive/non-bindable/non-bindable.md +0 -17
- package/src/loader.spec.js +0 -169
- package/src/router/state-provider.js +0 -146
- package/src/services/browser.js +0 -212
- /package/@types/{loader.d.ts → angular.d.ts} +0 -0
- /package/src/router/{common → glob}/glob.spec.js +0 -0
- /package/src/{router/common → shared}/queue.spec.js +0 -0
package/src/angular.spec.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
encodeUriQuery,
|
|
3
|
+
encodeUriSegment,
|
|
4
|
+
equals,
|
|
4
5
|
extend,
|
|
5
|
-
|
|
6
|
+
fromJson,
|
|
7
|
+
getNodeName,
|
|
8
|
+
hashKey,
|
|
9
|
+
isArrayLike,
|
|
6
10
|
isDate,
|
|
7
|
-
|
|
11
|
+
isDefined,
|
|
8
12
|
isElement,
|
|
9
|
-
shallowCopy,
|
|
10
|
-
equals,
|
|
11
|
-
isWindow,
|
|
12
|
-
hashKey,
|
|
13
|
-
toKeyValue,
|
|
14
|
-
parseKeyValue,
|
|
15
13
|
isError,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
toJson,
|
|
20
|
-
fromJson,
|
|
14
|
+
isRegExp,
|
|
15
|
+
isWindow,
|
|
16
|
+
lowercase,
|
|
21
17
|
nextUid,
|
|
22
|
-
|
|
18
|
+
parseKeyValue,
|
|
19
|
+
shallowCopy,
|
|
23
20
|
snakeCase,
|
|
21
|
+
toJson,
|
|
22
|
+
toKeyValue,
|
|
23
|
+
uppercase,
|
|
24
24
|
} from "./shared/utils.js";
|
|
25
25
|
import { createElementFromHTML, dealoc, startingTag } from "./shared/dom.js";
|
|
26
|
-
import { Angular } from "./
|
|
26
|
+
import { Angular } from "./angular.js";
|
|
27
27
|
import { createInjector } from "./core/di/injector.js";
|
|
28
28
|
import { wait } from "./shared/test-utils.js";
|
|
29
29
|
|
|
@@ -594,15 +594,16 @@ describe("angular", () => {
|
|
|
594
594
|
|
|
595
595
|
it("should look for ngApp directive using querySelectorAll", () => {
|
|
596
596
|
window.angular.module("ABC", []);
|
|
597
|
-
|
|
598
|
-
|
|
597
|
+
element.querySelector["[ng-app]"] = createElementFromHTML(
|
|
598
|
+
'<div ng-app="ABC"></div>',
|
|
599
|
+
);
|
|
599
600
|
window.angular.init(element);
|
|
600
601
|
expect(bootstrapSpy).toHaveBeenCalled();
|
|
601
602
|
});
|
|
602
603
|
|
|
603
604
|
it("should bootstrap anonymously", () => {
|
|
604
|
-
|
|
605
|
-
|
|
605
|
+
element.querySelector["[ng-app]"] =
|
|
606
|
+
createElementFromHTML("<div ng-app></div>");
|
|
606
607
|
window.angular.init(element);
|
|
607
608
|
expect(bootstrapSpy).toHaveBeenCalled();
|
|
608
609
|
});
|
|
@@ -1021,3 +1022,170 @@ describe("angular", () => {
|
|
|
1021
1022
|
});
|
|
1022
1023
|
});
|
|
1023
1024
|
});
|
|
1025
|
+
|
|
1026
|
+
describe("module loader", () => {
|
|
1027
|
+
let angular;
|
|
1028
|
+
beforeEach(() => {
|
|
1029
|
+
angular = window.angular = new Angular();
|
|
1030
|
+
});
|
|
1031
|
+
|
|
1032
|
+
it("allows registering a module", () => {
|
|
1033
|
+
const myModule = angular.module("myModule", []);
|
|
1034
|
+
expect(myModule).toBeDefined();
|
|
1035
|
+
expect(myModule.name).toEqual("myModule");
|
|
1036
|
+
});
|
|
1037
|
+
|
|
1038
|
+
it("allows getting a module", () => {
|
|
1039
|
+
const myModule = angular.module("myModule", []);
|
|
1040
|
+
const gotModule = angular.module("myModule");
|
|
1041
|
+
expect(gotModule).toBeDefined();
|
|
1042
|
+
expect(gotModule).toBe(myModule);
|
|
1043
|
+
});
|
|
1044
|
+
|
|
1045
|
+
it("throws when trying to get a nonexistent module", () => {
|
|
1046
|
+
expect(() => {
|
|
1047
|
+
angular.module("nonexistent");
|
|
1048
|
+
}).toThrow();
|
|
1049
|
+
});
|
|
1050
|
+
|
|
1051
|
+
it("does not allow a module to be called hasOwnProperty", () => {
|
|
1052
|
+
expect(() => {
|
|
1053
|
+
angular.module("hasOwnProperty", []);
|
|
1054
|
+
}).toThrow();
|
|
1055
|
+
});
|
|
1056
|
+
|
|
1057
|
+
it("attaches the requires array to the registered module", () => {
|
|
1058
|
+
const myModule = angular.module("myModule", ["myOtherModule"]);
|
|
1059
|
+
expect(myModule.requires).toEqual(["myOtherModule"]);
|
|
1060
|
+
});
|
|
1061
|
+
|
|
1062
|
+
it("replaces a module when registered with same name again", () => {
|
|
1063
|
+
const myModule = angular.module("myModule", []);
|
|
1064
|
+
const myNewModule = angular.module("myModule", []);
|
|
1065
|
+
expect(myNewModule).not.toBe(myModule);
|
|
1066
|
+
});
|
|
1067
|
+
|
|
1068
|
+
it("should record calls", () => {
|
|
1069
|
+
const otherModule = angular.module("other", []);
|
|
1070
|
+
otherModule.config("otherInit");
|
|
1071
|
+
|
|
1072
|
+
const myModule = angular.module("my", ["other"], "config");
|
|
1073
|
+
|
|
1074
|
+
expect(
|
|
1075
|
+
myModule
|
|
1076
|
+
.decorator("dk", "dv")
|
|
1077
|
+
.provider("sk", "sv")
|
|
1078
|
+
.factory("fk", "fv")
|
|
1079
|
+
.service("a", "aa")
|
|
1080
|
+
.value("k", "v")
|
|
1081
|
+
.filter("f", "ff")
|
|
1082
|
+
.directive("d", "dd")
|
|
1083
|
+
.component("c", "cc")
|
|
1084
|
+
.controller("ctrl", "ccc")
|
|
1085
|
+
.config("init2")
|
|
1086
|
+
.constant("abc", 123)
|
|
1087
|
+
.run("runBlock"),
|
|
1088
|
+
).toBe(myModule);
|
|
1089
|
+
|
|
1090
|
+
expect(myModule.requires).toEqual(["other"]);
|
|
1091
|
+
expect(myModule.invokeQueue).toEqual([
|
|
1092
|
+
["$provide", "constant", jasmine.objectContaining(["abc", 123])],
|
|
1093
|
+
["$provide", "provider", jasmine.objectContaining(["sk", "sv"])],
|
|
1094
|
+
["$provide", "factory", jasmine.objectContaining(["fk", "fv"])],
|
|
1095
|
+
["$provide", "service", jasmine.objectContaining(["a", "aa"])],
|
|
1096
|
+
["$provide", "value", jasmine.objectContaining(["k", "v"])],
|
|
1097
|
+
["$filterProvider", "register", jasmine.objectContaining(["f", "ff"])],
|
|
1098
|
+
["$compileProvider", "directive", jasmine.objectContaining(["d", "dd"])],
|
|
1099
|
+
["$compileProvider", "component", jasmine.objectContaining(["c", "cc"])],
|
|
1100
|
+
[
|
|
1101
|
+
"$controllerProvider",
|
|
1102
|
+
"register",
|
|
1103
|
+
jasmine.objectContaining(["ctrl", "ccc"]),
|
|
1104
|
+
],
|
|
1105
|
+
]);
|
|
1106
|
+
expect(myModule.configBlocks).toEqual([
|
|
1107
|
+
["$injector", "invoke", jasmine.objectContaining(["config"])],
|
|
1108
|
+
["$provide", "decorator", jasmine.objectContaining(["dk", "dv"])],
|
|
1109
|
+
["$injector", "invoke", jasmine.objectContaining(["init2"])],
|
|
1110
|
+
]);
|
|
1111
|
+
expect(myModule.runBlocks).toEqual(["runBlock"]);
|
|
1112
|
+
});
|
|
1113
|
+
|
|
1114
|
+
it("should not throw error when `module.decorator` is declared before provider that it decorates", () => {
|
|
1115
|
+
angular
|
|
1116
|
+
.module("theModule", [])
|
|
1117
|
+
.decorator("theProvider", ($delegate) => $delegate)
|
|
1118
|
+
.factory("theProvider", () => ({}));
|
|
1119
|
+
|
|
1120
|
+
expect(() => {
|
|
1121
|
+
createInjector(["theModule"]);
|
|
1122
|
+
}).not.toThrow();
|
|
1123
|
+
});
|
|
1124
|
+
|
|
1125
|
+
it("should run decorators in order of declaration, even when mixed with provider.decorator", () => {
|
|
1126
|
+
let log = "";
|
|
1127
|
+
|
|
1128
|
+
angular
|
|
1129
|
+
.module("theModule", [])
|
|
1130
|
+
.factory("theProvider", () => ({ api: "provider" }))
|
|
1131
|
+
.decorator("theProvider", ($delegate) => {
|
|
1132
|
+
$delegate.api += "-first";
|
|
1133
|
+
return $delegate;
|
|
1134
|
+
})
|
|
1135
|
+
.config(($provide) => {
|
|
1136
|
+
$provide.decorator("theProvider", ($delegate) => {
|
|
1137
|
+
$delegate.api += "-second";
|
|
1138
|
+
return $delegate;
|
|
1139
|
+
});
|
|
1140
|
+
})
|
|
1141
|
+
.decorator("theProvider", ($delegate) => {
|
|
1142
|
+
$delegate.api += "-third";
|
|
1143
|
+
return $delegate;
|
|
1144
|
+
})
|
|
1145
|
+
.run((theProvider) => {
|
|
1146
|
+
log = theProvider.api;
|
|
1147
|
+
});
|
|
1148
|
+
|
|
1149
|
+
createInjector(["theModule"]);
|
|
1150
|
+
expect(log).toBe("provider-first-second-third");
|
|
1151
|
+
});
|
|
1152
|
+
|
|
1153
|
+
it("should decorate the last declared provider if multiple have been declared", () => {
|
|
1154
|
+
let log = "";
|
|
1155
|
+
|
|
1156
|
+
angular
|
|
1157
|
+
.module("theModule", [])
|
|
1158
|
+
.factory("theProvider", () => ({
|
|
1159
|
+
api: "firstProvider",
|
|
1160
|
+
}))
|
|
1161
|
+
.decorator("theProvider", ($delegate) => {
|
|
1162
|
+
$delegate.api += "-decorator";
|
|
1163
|
+
return $delegate;
|
|
1164
|
+
})
|
|
1165
|
+
.factory("theProvider", () => ({
|
|
1166
|
+
api: "secondProvider",
|
|
1167
|
+
}))
|
|
1168
|
+
.run((theProvider) => {
|
|
1169
|
+
log = theProvider.api;
|
|
1170
|
+
});
|
|
1171
|
+
|
|
1172
|
+
createInjector(["theModule"]);
|
|
1173
|
+
expect(log).toBe("secondProvider-decorator");
|
|
1174
|
+
});
|
|
1175
|
+
|
|
1176
|
+
it("should allow module redefinition", () => {
|
|
1177
|
+
expect(angular.module("a", [])).not.toBe(angular.module("a", []));
|
|
1178
|
+
});
|
|
1179
|
+
|
|
1180
|
+
it("should complain of no module", () => {
|
|
1181
|
+
expect(() => {
|
|
1182
|
+
angular.module("dontExist");
|
|
1183
|
+
}).toThrow();
|
|
1184
|
+
});
|
|
1185
|
+
|
|
1186
|
+
it('should complain if a module is called "hasOwnProperty', () => {
|
|
1187
|
+
expect(() => {
|
|
1188
|
+
angular.module("hasOwnProperty", []);
|
|
1189
|
+
}).toThrow();
|
|
1190
|
+
});
|
|
1191
|
+
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { isString } from "../shared/utils.js";
|
|
2
2
|
import { NG_ANIMATE_CHILDREN_DATA } from "./shared.js";
|
|
3
3
|
import { setCacheData } from "../shared/dom.js";
|
|
4
|
-
import { $injectTokens } from "../injection-tokens.js";
|
|
4
|
+
import { $injectTokens as $t } from "../injection-tokens.js";
|
|
5
5
|
|
|
6
|
-
$$AnimateChildrenDirective.$inject = [$
|
|
6
|
+
$$AnimateChildrenDirective.$inject = [$t.$interpolate];
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @param {*} $interpolate
|
|
@@ -5,33 +5,33 @@ import {
|
|
|
5
5
|
} from "../shared/dom.js";
|
|
6
6
|
import { isDefined } from "../shared/utils.js";
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
ACTIVE_CLASS_SUFFIX,
|
|
9
|
+
ADD_CLASS_SUFFIX,
|
|
10
10
|
ANIMATION_DELAY_PROP,
|
|
11
|
-
TRANSITION_PROP,
|
|
12
|
-
PROPERTY_KEY,
|
|
13
11
|
ANIMATION_DURATION_PROP,
|
|
14
12
|
ANIMATION_ITERATION_COUNT_KEY,
|
|
15
13
|
ANIMATION_PROP,
|
|
16
|
-
|
|
14
|
+
ANIMATIONEND_EVENT,
|
|
17
15
|
applyAnimationClassesFactory,
|
|
18
|
-
pendClasses,
|
|
19
|
-
prepareAnimationOptions,
|
|
20
|
-
packageStyles,
|
|
21
|
-
EVENT_CLASS_PREFIX,
|
|
22
|
-
ADD_CLASS_SUFFIX,
|
|
23
|
-
REMOVE_CLASS_SUFFIX,
|
|
24
|
-
applyInlineStyle,
|
|
25
|
-
SAFE_FAST_FORWARD_DURATION_VALUE,
|
|
26
|
-
ACTIVE_CLASS_SUFFIX,
|
|
27
16
|
applyAnimationFromStyles,
|
|
28
17
|
applyAnimationStyles,
|
|
18
|
+
applyAnimationToStyles,
|
|
19
|
+
applyInlineStyle,
|
|
29
20
|
blockKeyframeAnimations,
|
|
21
|
+
DURATION_KEY,
|
|
22
|
+
EVENT_CLASS_PREFIX,
|
|
23
|
+
packageStyles,
|
|
24
|
+
pendClasses,
|
|
25
|
+
prepareAnimationOptions,
|
|
26
|
+
PROPERTY_KEY,
|
|
27
|
+
REMOVE_CLASS_SUFFIX,
|
|
30
28
|
removeFromArray,
|
|
29
|
+
SAFE_FAST_FORWARD_DURATION_VALUE,
|
|
31
30
|
TIMING_KEY,
|
|
31
|
+
TRANSITION_DELAY_PROP,
|
|
32
|
+
TRANSITION_DURATION_PROP,
|
|
33
|
+
TRANSITION_PROP,
|
|
32
34
|
TRANSITIONEND_EVENT,
|
|
33
|
-
ANIMATIONEND_EVENT,
|
|
34
|
-
applyAnimationToStyles,
|
|
35
35
|
} from "./shared.js";
|
|
36
36
|
|
|
37
37
|
const ANIMATE_TIMER_KEY = "$$animateCss";
|
|
@@ -771,8 +771,7 @@ export function AnimateCssProvider() {
|
|
|
771
771
|
|
|
772
772
|
temporaryStyles.forEach((entry) => {
|
|
773
773
|
const key = entry[0];
|
|
774
|
-
|
|
775
|
-
node.style[key] = value;
|
|
774
|
+
node.style[key] = entry[1];
|
|
776
775
|
});
|
|
777
776
|
|
|
778
777
|
applyAnimationClasses(element, options);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { dealoc } from "../../shared/dom.js";
|
|
2
|
-
import { Angular } from "../../
|
|
2
|
+
import { Angular } from "../../angular.js";
|
|
3
3
|
import { isObject } from "../../shared/utils.js";
|
|
4
4
|
import { isFunction } from "../../shared/utils.js";
|
|
5
5
|
import { createInjector } from "../di/injector.js";
|
package/src/animations/shared.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isString, minErr
|
|
1
|
+
import { extend, isString, minErr } from "../shared/utils.js";
|
|
2
2
|
import { ASTType } from "../core/parse/ast-type.js";
|
|
3
3
|
|
|
4
4
|
export const ADD_CLASS_SUFFIX = "-add";
|
|
@@ -76,15 +76,6 @@ export function assertArg(arg, name, reason) {
|
|
|
76
76
|
return arg;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
export function mergeClasses(a, b) {
|
|
80
|
-
if (!a && !b) return "";
|
|
81
|
-
if (!a) return b;
|
|
82
|
-
if (!b) return a;
|
|
83
|
-
if (Array.isArray(a)) a = a.join(" ");
|
|
84
|
-
if (Array.isArray(b)) b = b.join(" ");
|
|
85
|
-
return `${a} ${b}`;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
79
|
export function packageStyles(options) {
|
|
89
80
|
const styles = {};
|
|
90
81
|
if (options && (options.to || options.from)) {
|
|
@@ -340,8 +331,7 @@ export function blockKeyframeAnimations(node, applyBlock) {
|
|
|
340
331
|
|
|
341
332
|
export function applyInlineStyle(node, styleTuple) {
|
|
342
333
|
const prop = styleTuple[0];
|
|
343
|
-
|
|
344
|
-
node.style[prop] = value;
|
|
334
|
+
node.style[prop] = styleTuple[1];
|
|
345
335
|
}
|
|
346
336
|
|
|
347
337
|
export function concatWithSpace(a, b) {
|
package/src/binding.spec.js
CHANGED
|
@@ -26,7 +26,7 @@ export class Attributes {
|
|
|
26
26
|
/**
|
|
27
27
|
* @param {import('../scope/scope.js').Scope} $rootScope
|
|
28
28
|
* @param {*} $animate
|
|
29
|
-
* @param {import("
|
|
29
|
+
* @param {import("../../services/exception/exception-handler.js").ErrorHandler} $exceptionHandler
|
|
30
30
|
* @param {*} $sce
|
|
31
31
|
* @param {import("../../shared/noderef.js").NodeRef} [nodeRef]
|
|
32
32
|
* @param {Object} [attributesToCopy]
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
isProxy,
|
|
38
38
|
hasOwn,
|
|
39
39
|
} from "../../shared/utils.js";
|
|
40
|
-
import { SCE_CONTEXTS } from "
|
|
40
|
+
import { SCE_CONTEXTS } from "../../services/sce/sce.js";
|
|
41
41
|
import { PREFIX_REGEXP } from "../../shared/constants.js";
|
|
42
42
|
import { createEventDirective } from "../../directive/events/events.js";
|
|
43
43
|
import { Attributes } from "./attributes.js";
|
|
@@ -139,7 +139,7 @@ const EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/;
|
|
|
139
139
|
export const DirectiveSuffix = "Directive";
|
|
140
140
|
|
|
141
141
|
export class CompileProvider {
|
|
142
|
-
static $inject = ["$provide", "$$sanitizeUriProvider"];
|
|
142
|
+
/* @ignore */ static $inject = ["$provide", "$$sanitizeUriProvider"];
|
|
143
143
|
|
|
144
144
|
/**
|
|
145
145
|
* @param {import('../../interface.js').Provider} $provide
|
|
@@ -291,7 +291,7 @@ export class CompileProvider {
|
|
|
291
291
|
"$exceptionHandler",
|
|
292
292
|
/**
|
|
293
293
|
* @param {import("../../core/di/internal-injector.js").InjectorService} $injector
|
|
294
|
-
* @param {import('
|
|
294
|
+
* @param {import('../../services/exception/exception-handler.js').ErrorHandler} $exceptionHandler
|
|
295
295
|
*/
|
|
296
296
|
function ($injector, $exceptionHandler) {
|
|
297
297
|
const directives = [];
|
|
@@ -619,7 +619,7 @@ export class CompileProvider {
|
|
|
619
619
|
/**
|
|
620
620
|
* @param {import("../../core/di/internal-injector.js").InjectorService} $injector
|
|
621
621
|
* @param {*} $interpolate
|
|
622
|
-
* @param {import("
|
|
622
|
+
* @param {import("../../services/exception/exception-handler.js").ErrorHandler} $exceptionHandler
|
|
623
623
|
* @param {*} $templateRequest
|
|
624
624
|
* @param {import("../parse/interface.ts").ParseService} $parse
|
|
625
625
|
* @param {*} $controller
|
|
@@ -1216,8 +1216,7 @@ export class CompileProvider {
|
|
|
1216
1216
|
// Null out all of these references for garbage collection
|
|
1217
1217
|
compileNodes = transcludeFn = previousCompileContext = null;
|
|
1218
1218
|
}
|
|
1219
|
-
|
|
1220
|
-
return linked;
|
|
1219
|
+
return compiled.apply(this, arguments);
|
|
1221
1220
|
};
|
|
1222
1221
|
}
|
|
1223
1222
|
|
|
@@ -1561,14 +1560,13 @@ export class CompileProvider {
|
|
|
1561
1560
|
// * `undefined` - a slot that was not declared (i.e. invalid)
|
|
1562
1561
|
const slotTranscludeFn = boundTranscludeFn.$$slots[slotName];
|
|
1563
1562
|
if (slotTranscludeFn) {
|
|
1564
|
-
|
|
1563
|
+
return slotTranscludeFn(
|
|
1565
1564
|
scope,
|
|
1566
1565
|
cloneAttachFn,
|
|
1567
1566
|
transcludeControllers,
|
|
1568
1567
|
futureParentElement,
|
|
1569
1568
|
scopeToChild,
|
|
1570
1569
|
);
|
|
1571
|
-
return slotTranscludeRes;
|
|
1572
1570
|
}
|
|
1573
1571
|
|
|
1574
1572
|
if (isUndefined(slotTranscludeFn)) {
|
|
@@ -1581,14 +1579,13 @@ export class CompileProvider {
|
|
|
1581
1579
|
);
|
|
1582
1580
|
}
|
|
1583
1581
|
} else {
|
|
1584
|
-
|
|
1582
|
+
return boundTranscludeFn(
|
|
1585
1583
|
scope,
|
|
1586
1584
|
cloneAttachFn,
|
|
1587
1585
|
transcludeControllers,
|
|
1588
1586
|
futureParentElement,
|
|
1589
1587
|
scopeToChild,
|
|
1590
1588
|
);
|
|
1591
|
-
return boundTranscludeRes;
|
|
1592
1589
|
}
|
|
1593
1590
|
}
|
|
1594
1591
|
};
|
|
@@ -5,6 +5,7 @@ const TEST_URL = "src/core/controller/controller.html";
|
|
|
5
5
|
test("unit tests contain no errors", async ({ page }) => {
|
|
6
6
|
await page.goto(TEST_URL);
|
|
7
7
|
await page.content();
|
|
8
|
+
await page.waitForTimeout(1000);
|
|
8
9
|
await expect(page.locator(".jasmine-overall-result")).toHaveText(
|
|
9
10
|
/0 failures/,
|
|
10
11
|
);
|
package/src/core/di/injector.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
+
assert,
|
|
3
|
+
assertArg,
|
|
2
4
|
assertArgFn,
|
|
3
|
-
|
|
5
|
+
assertNotHasOwnProperty,
|
|
4
6
|
isFunction,
|
|
7
|
+
isObject,
|
|
5
8
|
isString,
|
|
6
9
|
isUndefined,
|
|
7
|
-
|
|
8
|
-
assertNotHasOwnProperty,
|
|
9
|
-
isObject,
|
|
10
|
-
assert,
|
|
10
|
+
minErr,
|
|
11
11
|
} from "../../shared/utils.js";
|
|
12
12
|
import { INJECTOR_LITERAL } from "./ng-module.js";
|
|
13
|
-
import {
|
|
13
|
+
import { InjectorService, ProviderInjector } from "./internal-injector.js";
|
|
14
14
|
|
|
15
15
|
const ARROW_ARG = /^([^(]+?)=>/;
|
|
16
16
|
const FN_ARGS = /^[^(]*\(\s*([^)]*)\)/m;
|
|
@@ -33,9 +33,6 @@ export function createInjector(modulesToLoad, strictDi = false) {
|
|
|
33
33
|
const loadedModules = new Map(); // Keep track of loaded modules to avoid circular dependencies
|
|
34
34
|
|
|
35
35
|
const providerCache = {
|
|
36
|
-
/**
|
|
37
|
-
* @type {import('../../interface.ts').Provider}
|
|
38
|
-
*/
|
|
39
36
|
$provide: {
|
|
40
37
|
provider: supportObject(provider),
|
|
41
38
|
factory: supportObject(factory),
|
|
@@ -62,15 +59,10 @@ export function createInjector(modulesToLoad, strictDi = false) {
|
|
|
62
59
|
const runBlocks = loadModules(modulesToLoad);
|
|
63
60
|
instanceInjector = protoInstanceInjector.get(INJECTOR_LITERAL);
|
|
64
61
|
|
|
65
|
-
runBlocks.forEach((fn) =>
|
|
66
|
-
if (fn) instanceInjector.invoke(fn);
|
|
67
|
-
});
|
|
62
|
+
runBlocks.forEach((fn) => fn && instanceInjector.invoke(fn));
|
|
68
63
|
|
|
69
|
-
instanceInjector.loadNewModules =
|
|
70
|
-
loadModules(mods).forEach((fn) =>
|
|
71
|
-
if (fn) instanceInjector.invoke(fn);
|
|
72
|
-
});
|
|
73
|
-
};
|
|
64
|
+
instanceInjector.loadNewModules = (mods) =>
|
|
65
|
+
loadModules(mods).forEach((fn) => fn && instanceInjector.invoke(fn));
|
|
74
66
|
|
|
75
67
|
return instanceInjector;
|
|
76
68
|
|
|
@@ -199,7 +191,7 @@ export function createInjector(modulesToLoad, strictDi = false) {
|
|
|
199
191
|
|
|
200
192
|
try {
|
|
201
193
|
if (isString(module)) {
|
|
202
|
-
/** @type {import('./ng-module').NgModule} */
|
|
194
|
+
/** @type {import('./ng-module.js').NgModule} */
|
|
203
195
|
const moduleFn = window["angular"].module(module);
|
|
204
196
|
instanceInjector.modules[/** @type {string } */ (module)] = moduleFn;
|
|
205
197
|
runBlocks = runBlocks
|
|
@@ -260,12 +252,10 @@ function stringifyFn(fn) {
|
|
|
260
252
|
*/
|
|
261
253
|
function extractArgs(fn) {
|
|
262
254
|
const fnText = stringifyFn(fn).replace(STRIP_COMMENTS, "");
|
|
263
|
-
|
|
264
|
-
return args;
|
|
255
|
+
return fnText.match(ARROW_ARG) || fnText.match(FN_ARGS);
|
|
265
256
|
}
|
|
266
257
|
|
|
267
258
|
/**
|
|
268
|
-
*
|
|
269
259
|
* @param {any} fn
|
|
270
260
|
* @param {boolean} [strictDi]
|
|
271
261
|
* @param {String} [name]
|
|
@@ -304,10 +294,6 @@ export function annotate(fn, strictDi, name) {
|
|
|
304
294
|
return $inject;
|
|
305
295
|
}
|
|
306
296
|
|
|
307
|
-
/**
|
|
308
|
-
* @param {function(string, any):any} delegate
|
|
309
|
-
* @returns {any}
|
|
310
|
-
*/
|
|
311
297
|
function supportObject(delegate) {
|
|
312
298
|
return function (key, value) {
|
|
313
299
|
if (isObject(key)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Angular } from "../../
|
|
1
|
+
import { Angular } from "../../angular.js";
|
|
2
2
|
import { createInjector, annotate } from "./injector.js";
|
|
3
3
|
import { extend } from "../../shared/utils.js";
|
|
4
4
|
|
|
@@ -296,7 +296,7 @@ describe("injector.modules", () => {
|
|
|
296
296
|
module.constant("b", 2);
|
|
297
297
|
const injector = createInjector(["myModule"]);
|
|
298
298
|
class Foo {
|
|
299
|
-
static $inject = ["a", "b"];
|
|
299
|
+
/* @ignore */ static $inject = ["a", "b"];
|
|
300
300
|
constructor(a, b) {
|
|
301
301
|
this.c = a + b;
|
|
302
302
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { test, expect } from "@playwright/test";
|
|
2
2
|
|
|
3
|
-
const TEST_URL = "src/core/di/injector.html";
|
|
3
|
+
const TEST_URL = "src/core/di/injector.html?random=false";
|
|
4
4
|
|
|
5
5
|
test("unit tests contain no errors", async ({ page }) => {
|
|
6
6
|
await page.goto(TEST_URL);
|
|
7
7
|
await page.content();
|
|
8
|
-
await page.waitForTimeout(
|
|
8
|
+
await page.waitForTimeout(1000);
|
|
9
9
|
await expect(page.locator(".jasmine-overall-result")).toHaveText(
|
|
10
10
|
/0 failures/,
|
|
11
11
|
);
|
|
@@ -109,8 +109,7 @@ class AbstractInjector {
|
|
|
109
109
|
|
|
110
110
|
if (isClass(/** @type {Function} */ (fn))) {
|
|
111
111
|
args.unshift(null);
|
|
112
|
-
|
|
113
|
-
return res;
|
|
112
|
+
return new (Function.prototype.bind.apply(fn, args))();
|
|
114
113
|
} else {
|
|
115
114
|
return /** @type {Function} */ (fn).apply(self, args);
|
|
116
115
|
}
|
|
@@ -186,8 +185,11 @@ export class InjectorService extends AbstractInjector {
|
|
|
186
185
|
*/
|
|
187
186
|
constructor(providerInjector, strictDi) {
|
|
188
187
|
super(strictDi);
|
|
188
|
+
|
|
189
|
+
/** @type {ProviderInjector} */
|
|
189
190
|
this.providerInjector = providerInjector;
|
|
190
|
-
|
|
191
|
+
/** @type {Object.<string, import("./ng-module.js").NgModule>} */
|
|
192
|
+
this.modules = providerInjector.modules;
|
|
191
193
|
}
|
|
192
194
|
|
|
193
195
|
/**
|
|
@@ -196,8 +198,7 @@ export class InjectorService extends AbstractInjector {
|
|
|
196
198
|
*/
|
|
197
199
|
factory(serviceName) {
|
|
198
200
|
const provider = this.providerInjector.get(serviceName + providerSuffix);
|
|
199
|
-
|
|
200
|
-
return res;
|
|
201
|
+
return this.invoke(provider.$get, provider, undefined, serviceName);
|
|
201
202
|
}
|
|
202
203
|
|
|
203
204
|
/**
|
|
@@ -231,8 +232,7 @@ function stringifyFn(fn) {
|
|
|
231
232
|
*/
|
|
232
233
|
function extractArgs(fn) {
|
|
233
234
|
const fnText = stringifyFn(fn).replace(STRIP_COMMENTS, "");
|
|
234
|
-
|
|
235
|
-
return args;
|
|
235
|
+
return fnText.match(ARROW_ARG) || fnText.match(FN_ARGS);
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
/**
|