Created
November 16, 2013 00:44
-
-
Save jonnybojangles/7494287 to your computer and use it in GitHub Desktop.
Similar to https://gist.github.com/jonnybojangles/7492609 but this snippet extends the module widget. Good for use across multiple files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('widget', []). | |
factory('widgetVersion', function(){ | |
return { | |
version: '0.123' | |
} | |
}); | |
/* | |
* Extend widget, sans []s | |
* */ | |
angular.module('widget'). | |
config(function($provide){ | |
$provide.factory('widgetDate', function(){ | |
return { | |
date: 'Today' | |
} | |
}); | |
}); | |
describe('Test widget', function(){ | |
"use strict"; | |
beforeEach(module('widget')); | |
/* | |
* Testing a factory | |
* */ | |
describe('widgetVersion', function(){ | |
"use strict"; | |
it('Make sure the widget version is correct.', inject(function(widgetVersion){ | |
expect(widgetVersion.version).toBe('0.123'); | |
})); | |
}); | |
/* | |
* Testing config (factory) | |
* */ | |
describe("widgetDate", function () { | |
"use strict"; | |
it("Does the widget date match our expect value?", inject(function(widgetDate){ | |
expect(widgetDate.date).toBe('Today') | |
})); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment