Refactored loader and added unit tests

This pull request adds unit tests for the loader.

When testing a loader I prefer a test which actually uses webpack instead of mocking it (like you did at the css-loader). Thus we know exactly if the loader works with the current webpack version.