Skip to content

Instantly share code, notes, and snippets.

@NicholasMurray
NicholasMurray / QUnit equal
Created February 25, 2014 00:01
QUnit equal
equal: function( actual, expected, message ) {
/*jshint eqeqeq:false */
QUnit.push( expected == actual, actual, expected, message );
},
push: function( result, actual, expected, message ) {
if ( !config.current ) {
throw new Error( "assertion outside test context, was " + sourceFromStacktrace() );
}
@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
/* 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 / 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>');
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');
var app = angular.module("app",[]);
app.factory("customerService", function () {
app.factory("customerService", function () {
var customers = [
{
firstname: "Joe",
lastname: "Bloggs"
},
function Logger() {}
Logger.prototype.log = function(message) {
console.log('Logger: ' + message)
};
function AppLogger() {
Logger.call(this);
app.factory("newsService", function() {
var hewsHeadlines = [
{
title: 'Big Scandal'
},
{
title: 'Small Heatwave'
}
];
@NicholasMurray
NicholasMurray / NicholasHTMLExample
Created June 28, 2012 23:04
JQuery Tutorial Html Example
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>This is a Sample Page</title>
<link href="allstateni-1.0.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Truncate Example</h1>
(function ($) {
$.fn.truncate = function (options) {
var defaults = {
length: 300,
minTrail: 20,
moreText: "more",
lessText: "less",
ellipsisText: "..."
};