Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

AngularJS component event binding test passes even with no component event binding #14739

Closed
@rmorrise

Description

@rmorrise

Do you want to request a feature or report a bug?
Test framework bug or possibly a documentation issue?

What is the current behavior?
I am looking at a component unit test that is formulated just like the one in the AngularJS docs for component:
it('should call the onDelete binding when a hero is deleted', ...)

Even if I comment out the binding in the component definition ("onDelete"), the test will still pass.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar (template: http://plnkr.co/edit/tpl:yBpEi4).

  1. In the configuration of the component under test, comment out the event binding:
    //onDelete: '&',
  2. Execute the test "component: heroDetail should call the onDelete binding when a hero is deleted"

The test will still pass.

What is the expected behavior?

It seems to me like the best behavior would be to not bind the unspecified property when $componentController is invoked, which would result in a test failure.

What is the motivation / use case for changing the behavior?

The test should verify that my component config is correct, and fail otherwise.

Which versions of Angular, and which browser / OS are affected by this issue? Did this work in previous versions of Angular? Please also test with the latest stable and snapshot (https://code.angularjs.org/snapshot/) versions.

Tested in AngularJS v1.5.2 (latest versions of Karma+PhantonJS).

Other information (e.g. stacktraces, related issues, suggestions how to fix)

Here is the doc page in question:
https://github.com/angular/angular.js/blob/master/docs/content/guide/component.ngdoc

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions