Skip to content
This repository has been archived by the owner on Sep 15, 2024. It is now read-only.

Make setup of unit tests easier #92

Merged
merged 28 commits into from
May 29, 2016

Conversation

svenwiegand
Copy link
Contributor

The ScalaDoc of AngularTestEnvironment contains a description and a short example of how to write a unit test for an Angular directive using ScalaTest 3.

…ul to add the ScopeOps trait to the test suite to be able to dynamically add stuff to the scope.
For example load a template from a file relative to the current source file: {{{
 val templateUrl = Template.relativeTemplate("./my-template.html")
}}}

 If the following code is placed in `MyDirective.scala` the content of `MyDirective.html` from the same source
directory will be embedded: {{{
 val templateUrl = Template.companionTemplate
 }}}
(cherry picked from commit 930118e)
@mysticfall
Copy link
Member

mysticfall commented May 29, 2016

I really like this enhancement, and I think it looks cleaner than the one I'm using currently in my project (#42, btw I'm also using ScalaTest now).

Just a minor request though: do you mind change the name of the variable from app -> module, and appModuleName -> moduleName?

I know it's just a matter of personal preference, but I tend to avoid using abbreviated names in variables when it's not too long. :)

And maybe it'd be better if we add org.scalajs.dom.document to the import statements, so we can write just document.documentElement. I think it looks a bit more intuitive as I'm used to write that in Javascript.

Anyway it looks great, and I'll probably migrate my own project using the new API as soon as it is merged. I wish I could spend sometime in writing unit tests for this project, as it seems now we have all the tools needed in place finally.

@svenwiegand
Copy link
Contributor Author

Thanks for your suggestions. I've adjusted the code according to them.

@mysticfall mysticfall merged commit 167efa8 into greencatsoft:master May 29, 2016
@mysticfall mysticfall self-assigned this May 29, 2016
@mysticfall
Copy link
Member

Just merged it and published a new snapshot. Can't wait to try it out myself. Thanks :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants