Skip to content

Instantly share code, notes, and snippets.

@eoneill
Created March 8, 2011 20:05
Show Gist options
  • Save eoneill/860920 to your computer and use it in GitHub Desktop.
Save eoneill/860920 to your computer and use it in GitHub Desktop.
<style type="text/css">
*{font-family:Inconsolata, arial, serif;}
#content div{border:1px solid gray;-webkit-border-radius:15px;-moz-border-radius:15px;-o-border-radius:15px;height:15px;width:800px;cursor:pointer;margin:5px;padding:5px 15px 10px 40px;}
.test-case{background:url(./resources/ok.png) no-repeat left top;-webkit-transition:opacity 1s;-moz-transition:opacity 1s;-o-transition:opacity 1s;background-color:#AFA;opacity:0.6;}
.test-case:hover{-webkit-transition:opacity 1s;-moz-transition:opacity 1s;-o-transition:opacity 1s;opacity:1;background-color:#AFA;}
div.fail:hover{-webkit-transition:opacity 1s;-moz-transition:opacity 1s;-o-transition:opacity 1s;opacity:1;}
div.fail{background:url(./resources/error.png) no-repeat left top;-webkit-transition:opacity 1s;-moz-transition:opacity 1s;-o-transition:opacity 1s;opacity:0.6;background-color:#FAA;}
#connect-url,#connect-key{width:700px;font-size:20px;}
#load-connect-framework{font-size:25px;cursor:pointer;}
#title,#menu{padding:10px 20px;}
</style>
<!-- LinkedIn.Test.onLogin -->
<section id='content'>
<!-- test results go here -->
</section>
<script type='text/javascript' src='http://wien.linkedinlabs.com:4567/js/yui.js'></script>
<script type="in/login"></script>
<script type='text/javascript'>
var LinkedIn = LinkedIn || {};
LinkedIn.Test = {};
LinkedIn.Test.TIMEOUT = 10000;
LinkedIn.Test.appendScript = function (name) {
var head= document.getElementsByTagName('head')[0];
var script= document.createElement('script');
script.type= 'text/javascript';
script.src= "http://wien.linkedinlabs.com:4567/js/tests/" + name + '.js'
head.appendChild(script);
}
LinkedIn.Test.onLogin = function () {
IN.Event.on(IN, 'auth', LinkedIn.Test.loadSuites);
}
LinkedIn.Test.loadSuites = function () {
var suites = ['connections', 'member_updates', 'network_updates', 'profile', 'raw', 'search'], i = 0;
for(; i < suites.length ; i++) {
LinkedIn.Test.appendScript(suites[i]);
}
}
LinkedIn.Test.Visuals = {
container : document.getElementById('content'),
title : document.title,
failures: 0,
addVisuals : function (testRunner) {
testRunner.subscribe(testRunner.TEST_PASS_EVENT, LinkedIn.Test.Visuals.onTestPassed);
testRunner.subscribe(testRunner.TEST_FAIL_EVENT, LinkedIn.Test.Visuals.onTestFailed);
},
onTestPassed : function (data) {
console.log(data);
LinkedIn.Test.Visuals.container.innerHTML += '<div class="test-case">' + data.testCase.name + ":" + data.testName + '</div>';
},
onTestFailed : function (data) {
LinkedIn.Test.Visuals.container.innerHTML += '<div class="test-case, fail" title="'+ data.error +'">' + data.testCase.name + ":" + data.testName + '</div>';
document.title = LinkedIn.Test.Visuals.title + " (" + (++LinkedIn.Test.Visuals.failures) + ")";
console.error(data);
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment