Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Unit Testing Initials
Scope
Provide the foundations of proper F.I.R.S.T. compliant Unit Tests, in a platform and client agnostic way.
For F.I.R.S.T. see : http://agileinaflash.blogspot.hu/2009/02/first.html
Introduced changes
Gitignore
I have added nbproject's private directory to the gitignore file, to save the headaches of others.
Package json
I have added mocha 2.4.5 as a dependency, and
mocha test/unit
as a test script. The reason for the hard-coded dependency is, that if in the future a patch or minor release would go out, that would break the current package, it won't have an impact on its users, as the loaded mocha version is not wildcarded.Stubs
The stubs directory and its contents are bare-bone at the moment. Will be extended in the future, as coverage increase goes on.
The current stubs directory contents are only the ones that are vital for the instantiation of a Croppie object, and performing the first two test methods, which do assertions on the constructor.
Stubs interfaces are implemented according their related MDN documentation.
Information on test execution
The tests are executed in node.js, using Mocha, therefore they are way faster, than the traditional karma, jstestdriver, or other ways usually the community does.
Another benefit of this approach is, that it will force the developer, to actually mock all of its external dependencies, therefore there is a greater chance of F.I.R.S.T. compliant tests.
The stubs mimic the browser environment, that is the reason for "global pollution".
Regrets
As I could not find a coding styleguide / guideline to this repository, I have intentionally created this pull request with tabs, to be scolded, and receive the proper styleguide.