aboutsummaryrefslogtreecommitdiffstats
path: root/test/ngMock/angular-mocksSpec.js
diff options
context:
space:
mode:
authorMerrick Christensen2013-08-25 23:45:58 -0600
committerVojta Jina2013-09-03 14:22:12 -0700
commitf737c97df02918eb5b19bf5c8248fa3e20f9b361 (patch)
tree40de4c1b0fb4ef95eea9b7c02b1fac2f6163f2ee /test/ngMock/angular-mocksSpec.js
parent8e48c4ff6abf7083a04cf20312d2b106f4ba5b2c (diff)
downloadangular.js-f737c97df02918eb5b19bf5c8248fa3e20f9b361.tar.bz2
feat(ngMock): allow passing an object literal as shorthand to module
Diffstat (limited to 'test/ngMock/angular-mocksSpec.js')
-rw-r--r--test/ngMock/angular-mocksSpec.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/ngMock/angular-mocksSpec.js b/test/ngMock/angular-mocksSpec.js
index 13e08a68..966877b8 100644
--- a/test/ngMock/angular-mocksSpec.js
+++ b/test/ngMock/angular-mocksSpec.js
@@ -520,6 +520,42 @@ describe('ngMock', function() {
});
describe('module', function() {
+
+ describe('object literal format', function() {
+ var mock = { log: 'module' };
+
+ beforeEach(function() {
+ module({
+ 'service': mock,
+ 'other': { some: 'replacement'}
+ },
+ 'ngResource',
+ function ($provide) { $provide.value('example', 'win'); }
+ );
+ });
+
+ it('should inject the mocked module', function() {
+ inject(function(service) {
+ expect(service).toEqual(mock);
+ });
+ });
+
+ it('should support multiple key value pairs', function() {
+ inject(function(service, other) {
+ expect(other.some).toEqual('replacement');
+ expect(service).toEqual(mock);
+ });
+ });
+
+ it('should integrate with string and function', function() {
+ inject(function(service, $resource, example) {
+ expect(service).toEqual(mock);
+ expect($resource).toBeDefined();
+ expect(example).toEqual('win');
+ });
+ });
+ });
+
describe('in DSL', function() {
it('should load module', module(function() {
log += 'module';