Skip to content

Instantly share code, notes, and snippets.

View DamianMullins's full-sized avatar
💭
👽

Damian Mullins DamianMullins

💭
👽
View GitHub Profile
@DamianMullins
DamianMullins / substring.js
Created January 12, 2016 21:21
Check that one string contains another substring
~'foo'.indexOf('oo');
// Copyright © John Leitch 2010 [email protected]
var destination = null;
var useClone = false;
var cloneSource = null;
var cloneDelay = 1000;
function hookInputs() {
var frame = document.getElementById('overlayFrame');
var keyPressScript =
@DamianMullins
DamianMullins / mocha-chai-jsdom-global.js
Last active June 22, 2016 10:50
Testing with Mocha, Chai, and jsdom global.
import { expect } from 'chai';
describe('dom', () => {
before(function () {
this.jsdom = require('jsdom-global')()
})
after(function () {
this.jsdom()
@DamianMullins
DamianMullins / helpers.js
Last active June 22, 2016 10:50
Testing with Tape and jsdom global.
import tape from 'tape';
import jsdom from 'jsdom-global';
export function test (description, fn, { html } = {}) {
tape(description, t => {
const cleanup = jsdom(html);
fn(t);
cleanup();
});
}
@DamianMullins
DamianMullins / esnextbin.md
Last active September 20, 2016 20:11
esnextbin sketch
@DamianMullins
DamianMullins / _you-dont-know-js-scope-&-closures.md
Last active October 11, 2016 13:30
You Don't Know JS: Scope & Closures - Notes

Notes

@DamianMullins
DamianMullins / esnextbin.md
Last active September 21, 2016 08:00
esnextbin sketch
@DamianMullins
DamianMullins / esnextbin.md
Last active September 21, 2016 09:11
esnextbin sketch
@DamianMullins
DamianMullins / _you-dont-know-js-this-&-object-prototypes.md
Last active October 20, 2016 12:56
You Don't Know JS: this & Object Prototypes - Notes

Notes

@DamianMullins
DamianMullins / unit-testing-frontend-javacript-with-ava-and-jsdom.md
Last active November 8, 2016 12:52
unit-testing-the-dom-with-ava.md

Unit testing front-end JavaScript with AVA and jsdom

Writing tests for JavaScript code that interacts with the DOM can be tricky. Luckily, using a combination of AVA and jsdom, writing those tests becomes a lot easier.

This article will walk you through how to set everything up so you can get started writing your tests today.

What is AVA?

AVA is described as a "Futuristic JavaScript test runner". Sounds fancy, huh?! So, what is it exactly that makes it "futuristic"?!