Skip to content

Instantly share code, notes, and snippets.

¯\_(ツ)_/¯
app.factory("newsService", function() {
var hewsHeadlines = [
{
title: 'Big Scandal'
},
{
title: 'Small Heatwave'
}
];
function Logger() {}
Logger.prototype.log = function(message) {
console.log('Logger: ' + message)
};
function AppLogger() {
Logger.call(this);
var app = angular.module("app",[]);
app.factory("customerService", function () {
app.factory("customerService", function () {
var customers = [
{
firstname: "Joe",
lastname: "Bloggs"
},
describe('The success button', function(){
var fixture;
beforeEach(function() {
setStyleFixtures('.btn-success { color: #fff; background-color: #5cb85c; border-color: #4cae4c; }');
fixture = setFixtures('<button type="button" class="btn btn-success">Success</button>');
});
it('should have a color of white', function() {
var successButton = fixture.find('.btn-success');
@NicholasMurray
NicholasMurray / AngularJS Geolocation Directive Jasmine Geolocation Not Available Test
Created February 18, 2015 23:27
AngularJS Geolocation Directive Jasmine Geolocation Not Available Test
describe('Directive tests: geolocation ', function() {
var $window, navigator;
describe('when called on a browser that does not have geolocation available ', function() {
beforeEach(module('geolocationApp'));
beforeEach(inject(function($rootScope, $compile, _$window_) {
element = angular.element('<geolocation class="geolocation"><p>This is a geolocation app</p></geolocation>');
@NicholasMurray
NicholasMurray / AngularJS Geolocation Directive Jasmine Geolocation Available Test
Created February 18, 2015 23:27
AngularJS Geolocation Directive Jasmine Geolocation Available Test
describe('Directive tests: geolocation ', function() {
var $window, navigator;
describe('when called on a browser that has geolocation available ', function() {
beforeEach(module('geolocationApp'));
beforeEach(inject(function($rootScope, $compile, _$window_) {
element = angular.element('<geolocation class="geolocation"><p>This is a geolocation app</p></geolocation>');
@NicholasMurray
NicholasMurray / AngularJS Geolocation Directive
Created February 18, 2015 23:25
AngularJS Geolocation Directive
angular
.module('directives', [])
.directive('geolocation', function($window) {
return {
restrict: "E",
template: '<div></div>',
link: function (scope, element, attrs) {
if ($window.navigator && $window.navigator.geolocation) {
$window.navigator.geolocation.getCurrentPosition(function(position) {
element.html('<div>Your geolocation is latitude:<span id="latitude"></span> and longitude:<span id="longitude"></span></div>');
/* Modernizr 2.8.3 (Custom Build) | MIT & BSD
* Build: http://modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-flexboxlegacy-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-draganddrop-hashchange-history-audio-video-indexeddb-input-inputtypes-localstorage-postmessage-sessionstorage-websockets-websqldatabase-webworkers-geolocation-inlinesvg-smil-svg-svgclippaths-touch-webgl-shiv-cssclasses-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-css_positionsticky-load
*/
;window.Modernizr=function(a,b,c){function C(a){j.cssText=a}function D(a,b){return C(n.join(a+";")+(b||""))}function E(a,b){return typeof a===b}function F(a,b){return!!~(""+a).indexOf(b)}function G(a,b){for(var d in a){var e=a[d];if(!F(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function H(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?
@NicholasMurray
NicholasMurray / QUnit deepEqual
Created February 25, 2014 00:03
QUnit deepEqual
deepEqual: function( actual, expected, message ) {
QUnit.push( QUnit.equiv(actual, expected), actual, expected, message );
}
...
innerEquiv = function() { // can take multiple arguments
var args = [].slice.apply( arguments );
if ( args.length < 2 ) {
return true; // end transition