Skip to content

Testing Directive Controllers #2

@thynctank

Description

@thynctank

Sorry if there's a better place for comment, but I didn't find one on your rendered blog or in the source for it.

Regarding https://github.com/dagingaa/dagingaa.github.com/blob/master/_posts/2014-03-03-testing-angular-directive-controllers-with-jasmine-and-karma.md

You have a directive controller which defines methods on $scope, but many times we need to define methods on this, so that the controller can be used in other directives which get transcluded into the current one. (the controller gets injected as an addl param on the child directive's link function, so long as there is a require parameter of "^parentDirective".

Any idea if there's a way to test these?

My thinking is I may not want to test the controller as it's internals, and so long as I'm testing the behaviors of the directives I'm happy with it from a BDD perspective. If I was aiming for 100% coverage that would be another story.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions