@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
|
@@ -5,6 +5,7 @@ const TEST_URL = "src/directive/options/options.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(3000);
|
|
8
9
|
await expect(page.locator(".jasmine-overall-result")).toHaveText(
|
|
9
10
|
/0 failures/,
|
|
10
11
|
);
|
|
@@ -3,6 +3,7 @@ import { test, expect } from "@playwright/test";
|
|
|
3
3
|
test("unit href tests contain no errors", async ({ page }) => {
|
|
4
4
|
await page.goto("src/directive/ref/href.html");
|
|
5
5
|
await page.content();
|
|
6
|
+
await page.waitForTimeout(1000);
|
|
6
7
|
await expect(page.locator(".jasmine-overall-result")).toHaveText(
|
|
7
8
|
/0 failures/,
|
|
8
9
|
);
|
|
@@ -11,6 +12,7 @@ test("unit href tests contain no errors", async ({ page }) => {
|
|
|
11
12
|
test("unit ref tests contain no errors", async ({ page }) => {
|
|
12
13
|
await page.goto("src/directive/ref/ref.html");
|
|
13
14
|
await page.content();
|
|
15
|
+
await page.waitForTimeout(1000);
|
|
14
16
|
await expect(page.locator(".jasmine-overall-result")).toHaveText(
|
|
15
17
|
/0 failures/,
|
|
16
18
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Angular } from "../../
|
|
1
|
+
import { Angular } from "../../angular.js";
|
|
2
2
|
import { createElementFromHTML, dealoc } from "../../shared/dom.js";
|
|
3
3
|
import { wait } from "../../shared/test-utils.js";
|
|
4
4
|
|
|
@@ -88,8 +88,7 @@ describe("ngRepeat", () => {
|
|
|
88
88
|
"<a class='test' name='y'>b</a>" +
|
|
89
89
|
"<a class='test' name='x'>c</a>";
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
scope.items = htmlCollection;
|
|
91
|
+
scope.items = document.getElementsByClassName("test");
|
|
93
92
|
await wait();
|
|
94
93
|
expect(element.querySelectorAll("li").length).toEqual(3);
|
|
95
94
|
expect(element.textContent).toEqual("x;y;x;");
|
|
@@ -5,6 +5,7 @@ const TEST_URL = "src/directive/repeat/repeat.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
|
);
|
|
@@ -5,6 +5,7 @@ const TEST_URL = "src/directive/script/script.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
|
);
|
|
@@ -5,6 +5,7 @@ const TEST_URL = "src/directive/select/select.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
|
);
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { $injectTokens as $t } from "../../injection-tokens.js";
|
|
2
|
+
|
|
3
|
+
ngSetterDirective.$inject = [$t.$parse, $t.$log];
|
|
4
|
+
|
|
2
5
|
/**
|
|
3
6
|
* @param {import('../../core/parse/interface.ts').ParseService} $parse
|
|
4
7
|
* @param {import('../../services/log/interface.ts').LogService} $log
|
|
@@ -11,19 +14,19 @@ export function ngSetterDirective($parse, $log) {
|
|
|
11
14
|
const modelExpression = attrs["ngSetter"];
|
|
12
15
|
|
|
13
16
|
if (!modelExpression) {
|
|
14
|
-
$log.warn("
|
|
17
|
+
$log.warn("ng-setter: expression null");
|
|
15
18
|
return;
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
const assignModel = $parse(modelExpression).assign;
|
|
19
22
|
|
|
20
23
|
if (!assignModel) {
|
|
21
|
-
$log.warn("
|
|
24
|
+
$log.warn("ng-setter: expression invalid");
|
|
22
25
|
return;
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
const updateModel = (value) => {
|
|
26
|
-
assignModel(scope, value);
|
|
29
|
+
assignModel(scope, value.trim());
|
|
27
30
|
};
|
|
28
31
|
|
|
29
32
|
const observer = new MutationObserver((mutationsList) => {
|
|
@@ -43,16 +46,11 @@ export function ngSetterDirective($parse, $log) {
|
|
|
43
46
|
}
|
|
44
47
|
});
|
|
45
48
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
});
|
|
52
|
-
} else {
|
|
53
|
-
$log.warn("ngSetter: Element is not a valid DOM node.");
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
49
|
+
observer.observe(element, {
|
|
50
|
+
childList: true,
|
|
51
|
+
subtree: true,
|
|
52
|
+
characterData: true,
|
|
53
|
+
});
|
|
56
54
|
|
|
57
55
|
scope.$on("$destroy", () => observer.disconnect());
|
|
58
56
|
updateModel(element.innerHTML);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Angular } from "../../
|
|
1
|
+
import { Angular } from "../../angular.js";
|
|
2
2
|
import { dealoc } from "../../shared/dom.js";
|
|
3
3
|
import { wait } from "../../shared/test-utils.js";
|
|
4
4
|
|
|
@@ -7,7 +7,7 @@ describe("setter", () => {
|
|
|
7
7
|
|
|
8
8
|
beforeEach(() => {
|
|
9
9
|
dealoc(document.getElementById("app"));
|
|
10
|
-
|
|
10
|
+
let angular = new Angular();
|
|
11
11
|
angular.module("myModule", []);
|
|
12
12
|
angular
|
|
13
13
|
.bootstrap(document.getElementById("app"), ["myModule"])
|
|
@@ -44,34 +44,57 @@ describe("setter", () => {
|
|
|
44
44
|
expect($rootScope.testModel).toBe("Initial content");
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
+
it("should handle expression content in the element", async () => {
|
|
48
|
+
$rootScope.testModel = "";
|
|
49
|
+
$compile('<div ng-setter="testModel"> {{ 2 + 2 }} </div>')($rootScope);
|
|
50
|
+
await wait();
|
|
51
|
+
|
|
52
|
+
expect($rootScope.testModel).toBe("4");
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it("should handle expression and text content in the element", async () => {
|
|
56
|
+
$rootScope.testModel = "";
|
|
57
|
+
$compile('<div ng-setter="testModel"> Res: {{ 2 + 2 }} </div>')($rootScope);
|
|
58
|
+
await wait();
|
|
59
|
+
|
|
60
|
+
expect($rootScope.testModel).toBe("Res: 4");
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("should update value if expression changes", async () => {
|
|
64
|
+
$rootScope.a = 2;
|
|
65
|
+
$compile('<div ng-setter="testModel"> {{ a + 2 }} </div>')($rootScope);
|
|
66
|
+
await wait();
|
|
67
|
+
expect($rootScope.testModel).toBe("4");
|
|
68
|
+
|
|
69
|
+
$rootScope.a = 4;
|
|
70
|
+
await wait();
|
|
71
|
+
expect($rootScope.testModel).toBe("6");
|
|
72
|
+
});
|
|
73
|
+
|
|
47
74
|
it("should warn if no model expression is provided", async () => {
|
|
48
75
|
spyOn($log, "warn");
|
|
49
76
|
|
|
50
77
|
$compile("<div ng-setter></div>")($rootScope);
|
|
51
78
|
await wait();
|
|
52
79
|
|
|
53
|
-
expect($log.warn).toHaveBeenCalledWith(
|
|
54
|
-
"ngSetter: Model expression is not provided.",
|
|
55
|
-
);
|
|
80
|
+
expect($log.warn).toHaveBeenCalledWith("ng-setter: expression null");
|
|
56
81
|
});
|
|
57
82
|
|
|
58
|
-
it("should
|
|
59
|
-
spyOn(
|
|
60
|
-
const element = $compile('<div ng-setter="testModel"></div>')($rootScope);
|
|
83
|
+
it("should warn if invalid model expression is provided", async () => {
|
|
84
|
+
spyOn($log, "warn");
|
|
61
85
|
|
|
62
|
-
$
|
|
86
|
+
$compile("<div ng-setter='2+2'></div>")($rootScope);
|
|
63
87
|
await wait();
|
|
64
|
-
|
|
88
|
+
|
|
89
|
+
expect($log.warn).toHaveBeenCalledWith("ng-setter: expression invalid");
|
|
65
90
|
});
|
|
66
91
|
|
|
67
|
-
it("should
|
|
68
|
-
spyOn(
|
|
92
|
+
it("should clean up the MutationObserver on scope destruction", async () => {
|
|
93
|
+
spyOn(window, "MutationObserver").and.returnValue(observerSpy);
|
|
94
|
+
$compile('<div ng-setter="testModel"></div>')($rootScope);
|
|
69
95
|
|
|
70
|
-
|
|
96
|
+
$rootScope.$destroy();
|
|
71
97
|
await wait();
|
|
72
|
-
|
|
73
|
-
expect(console.warn).not.toHaveBeenCalledWith(
|
|
74
|
-
"ngSetter: Element is not a valid DOM node.",
|
|
75
|
-
);
|
|
98
|
+
expect(observerSpy.disconnect).toHaveBeenCalled();
|
|
76
99
|
});
|
|
77
100
|
});
|
|
@@ -5,6 +5,7 @@ const TEST_URL = "src/directive/setter/setter.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
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Angular } from "../../
|
|
1
|
+
import { Angular } from "../../angular.js";
|
|
2
2
|
import { createInjector } from "../../core/di/injector.js";
|
|
3
3
|
import { dealoc, createElementFromHTML } from "../../shared/dom.js";
|
|
4
4
|
import { wait } from "../../shared/test-utils.js";
|
|
@@ -5,6 +5,7 @@ const TEST_URL = "src/directive/show-hide/show-hide.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
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Angular } from "../../
|
|
1
|
+
import { Angular } from "../../angular.js";
|
|
2
2
|
import { createInjector } from "../../core/di/injector.js";
|
|
3
3
|
import { createElementFromHTML, dealoc } from "../../shared/dom.js";
|
|
4
4
|
import { wait } from "../../shared/test-utils.js";
|
|
@@ -5,6 +5,7 @@ const TEST_URL = "src/directive/style/style.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
|
);
|
|
@@ -5,6 +5,7 @@ const TEST_URL = "src/directive/switch/switch.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
|
);
|
|
@@ -18,107 +18,105 @@ import { emptyElement, startingTag } from "../../shared/dom.js";
|
|
|
18
18
|
* or its value is the same as the name of the attribute then the default slot is used.
|
|
19
19
|
*/
|
|
20
20
|
const ngTranscludeMinErr = minErr("ngTransclude");
|
|
21
|
-
export const ngTranscludeDirective = [
|
|
22
|
-
"$compile",
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
ngTranscludeDirective.$inject = ["$compile"];
|
|
23
|
+
/**
|
|
24
|
+
* @param {import("../../core/compile/compile.js").CompileFn} $compile
|
|
25
|
+
* @returns {import("../../interface.ts").Directive}
|
|
26
|
+
*/
|
|
27
|
+
export function ngTranscludeDirective($compile) {
|
|
28
|
+
return {
|
|
29
|
+
compile: function ngTranscludeCompile(tElement) {
|
|
30
|
+
// Remove and cache any original content to act as a fallback
|
|
31
|
+
const fallbackLinkFn = $compile(tElement.childNodes);
|
|
32
|
+
emptyElement(tElement);
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @param {import("../../core/scope/scope.js").Scope} $scope
|
|
37
|
+
* @param {Element} $element
|
|
38
|
+
* @param {import("../../core/compile/attributes.js").Attributes} $attrs
|
|
39
|
+
* @param {*} _controller
|
|
40
|
+
* @param {*} $transclude
|
|
41
|
+
*/
|
|
42
|
+
function ngTranscludePostLink(
|
|
43
|
+
$scope,
|
|
44
|
+
$element,
|
|
45
|
+
$attrs,
|
|
46
|
+
_controller,
|
|
47
|
+
$transclude,
|
|
48
|
+
) {
|
|
49
|
+
if (!$transclude) {
|
|
50
|
+
throw ngTranscludeMinErr(
|
|
51
|
+
"orphan",
|
|
52
|
+
"Illegal use of ngTransclude directive in the template! " +
|
|
53
|
+
"No parent directive that requires a transclusion found. " +
|
|
54
|
+
"Element: {0}",
|
|
55
|
+
startingTag($element),
|
|
56
|
+
);
|
|
57
|
+
}
|
|
59
58
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
// If the attribute is of the form: `ng-transclude="ng-transclude"` then treat it like the default
|
|
60
|
+
if ($attrs["ngTransclude"] === $attrs.$attr.ngTransclude) {
|
|
61
|
+
$attrs["ngTransclude"] = "";
|
|
62
|
+
}
|
|
63
|
+
const slotName = $attrs["ngTransclude"] || $attrs["ngTranscludeSlot"];
|
|
65
64
|
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
// If the slot is required and no transclusion content is provided then this call will throw an error
|
|
66
|
+
$transclude(ngTranscludeCloneAttachFn, null, slotName);
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
// If the slot is optional and no transclusion content is provided then use the fallback content
|
|
69
|
+
if (slotName && !$transclude.isSlotFilled(slotName)) {
|
|
70
|
+
useFallbackContent();
|
|
71
|
+
}
|
|
73
72
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
} else {
|
|
85
|
-
$element.append(/** @type {Node} */ (clone));
|
|
86
|
-
}
|
|
73
|
+
/**
|
|
74
|
+
* @param {NodeList | Node} clone
|
|
75
|
+
* @param {import("../../core/scope/scope.js").Scope} transcludedScope
|
|
76
|
+
*/
|
|
77
|
+
function ngTranscludeCloneAttachFn(clone, transcludedScope) {
|
|
78
|
+
if (notWhitespace(clone)) {
|
|
79
|
+
if (clone instanceof NodeList) {
|
|
80
|
+
Array.from(clone).forEach((el) => {
|
|
81
|
+
$element.append(el);
|
|
82
|
+
});
|
|
87
83
|
} else {
|
|
88
|
-
|
|
89
|
-
// There is nothing linked against the transcluded scope since no content was available,
|
|
90
|
-
// so it should be safe to clean up the generated scope.
|
|
91
|
-
transcludedScope.$destroy();
|
|
84
|
+
$element.append(/** @type {Node} */ (clone));
|
|
92
85
|
}
|
|
86
|
+
} else {
|
|
87
|
+
useFallbackContent();
|
|
88
|
+
// There is nothing linked against the transcluded scope since no content was available,
|
|
89
|
+
// so it should be safe to clean up the generated scope.
|
|
90
|
+
transcludedScope.$destroy();
|
|
93
91
|
}
|
|
92
|
+
}
|
|
94
93
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
function useFallbackContent() {
|
|
95
|
+
// Since this is the fallback content rather than the transcluded content,
|
|
96
|
+
// we link against the scope of this directive rather than the transcluded scope
|
|
97
|
+
fallbackLinkFn(
|
|
98
|
+
$scope,
|
|
100
99
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
100
|
+
(clone) => {
|
|
101
|
+
// @ts-ignore
|
|
102
|
+
$element.append(clone);
|
|
103
|
+
},
|
|
104
|
+
);
|
|
105
|
+
}
|
|
107
106
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
107
|
+
function notWhitespace(node) {
|
|
108
|
+
if (node instanceof Array) {
|
|
109
|
+
return false;
|
|
110
|
+
} else if (
|
|
111
|
+
node.nodeType !== Node.TEXT_NODE ||
|
|
112
|
+
node.nodeValue.trim()
|
|
113
|
+
) {
|
|
114
|
+
return true;
|
|
117
115
|
}
|
|
118
116
|
}
|
|
117
|
+
}
|
|
119
118
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
];
|
|
119
|
+
return ngTranscludePostLink;
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
}
|