Created
May 11, 2016 19:25
-
-
Save averyvery/21cfd2836eed13262d22bc76e8afe4bc to your computer and use it in GitHub Desktop.
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
// better describe() method that nests your describe blocks | |
// if you pass it a string with slashes | |
(function() { | |
var recursiveNestedDescribe = function(title, callback) { | |
var titleChunk = title.shift(); | |
if (title.length === 0) { | |
describe(titleChunk, callback); | |
} else { | |
describe('/' + titleChunk, function() { | |
recursiveNestedDescribe(title, callback); | |
}) | |
} | |
} | |
window.nestedDescribe = function(title, callback) { | |
recursiveNestedDescribe(title.split('/'), callback); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment