Skip to content

Commit

Permalink
updating test suite to use v3 of github API.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed Jul 19, 2012
1 parent cbdd33e commit 6cf0248
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 767 deletions.
37 changes: 20 additions & 17 deletions test/js/dumpdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ function dumpModernizr(){
// skip previously done ones.
if (dumpModernizr.old[prop]) continue;
else dumpModernizr.old[prop] = true;

if (typeof Modernizr[prop] === 'function') continue;
// skip unit test items
if (/^test/.test(prop)) continue;

if (~TEST.inputs.indexOf(prop)) {
str += '<li><b>'+prop+'{}</b><ul>';
for (var field in Modernizr[prop]) {
Expand All @@ -28,27 +28,30 @@ function dumpModernizr(){

function grabFeatDetects(){
// thx github.js
gh.object("Modernizr", "Modernizr").blobAll('master', function (data) {

var filenames = [];
$.getScript('https://api.github.com/repos/Modernizr/Modernizr/git/trees/master?recursive=1&callback=processTree');
}

for (var file in data.blobs){
var match = file.match(/^feature-detects\/(.*)/);
if (!match) continue;

var relpath = location.host == "modernizr.github.com" ?
'https://raw.github.com/Modernizr/Modernizr/master/' : '../';

filenames.push(relpath + match[0]);
}
function processTree(data){
var filenames = [];

var jqxhrs = filenames.map(function(filename){
return jQuery.getScript(filename);
});
for (var i = 0; i < data.data.tree.length; i++){
var file = data.data.tree[i];
var match = file.path.match(/^feature-detects\/(.*)/);
if (!match) continue;

jQuery.when.apply(jQuery, jqxhrs).done(resultsToDOM);
var relpath = location.host == "modernizr.github.com" ?
'https://raw.github.com/Modernizr/Modernizr/master/' : '../';

filenames.push(relpath + match[0]);
}

var jqxhrs = filenames.map(function(filename){
return jQuery.getScript(filename);
});

jQuery.when.apply(jQuery, jqxhrs).done(resultsToDOM);

}

function resultsToDOM(){
Expand Down
Loading

0 comments on commit 6cf0248

Please sign in to comment.