Skip to content

Commit

Permalink
YUI Test examples using Jack. (Not implemented yet)
Browse files Browse the repository at this point in the history
  • Loading branch information
keronsen committed Nov 10, 2009
1 parent 96a13c0 commit c0c9984
Show file tree
Hide file tree
Showing 3 changed files with 10,337 additions and 0 deletions.
71 changes: 71 additions & 0 deletions docs/examples/yuitest/example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>YUI Test results</title>

<link rel="stylesheet" type="text/css" href="lib/yuitest.css">
<script type="text/javascript" src="lib/yuitest.js"></script>

<script type="text/javascript" src="../../../src/jack.js"></script>

</head>
<body>
<script type="text/javascript">

/** START SPECIFYING FUNCTIONS THAT TESTS RUN AGAINST **/
function myGlobalFunction() {
return "This is myGlobalFunction()";
}

window.myGlobalObject = {}
window.myGlobalObject.functionOne = function() {
return "This is myGlobalObject.functionOne()";
}
/** END SPECIFYING FUNCTIONS THAT TESTS RUN AGAINST **/

var successfulTestCase = new YAHOO.tool.TestCase({

name: "Examples of successful expectations",

testExpectedFunctionIsCalled : function () {
jack(function(){
jack.expect("myGlobalFunction");
myGlobalFunction();
});
},

testExpectedFunctionIsCalledOnObject : function () {
jack(function(){
jack.expect("myGlobalObject.functionOne");
myGlobalObject.functionOne();
});
}
});

var failingTestCase = new YAHOO.tool.TestCase({

name: "Examples of failing expectations",

testExpectedFunctionIsNotCalled : function () {
jack(function(){
jack.expect("myGlobalFunction");
});
},

testExpectedFunctionIsNotCalledOnObject : function () {
jack(function(){
jack.expect("myGlobalObject.functionOne");
});
}
});

var logger = new YAHOO.tool.TestLogger();

YAHOO.tool.TestRunner.add(successfulTestCase);
YAHOO.tool.TestRunner.add(failingTestCase);
YAHOO.tool.TestRunner.run();

</script>
</body>
</html>
14 changes: 14 additions & 0 deletions docs/examples/yuitest/lib/yuitest.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c0c9984

Please sign in to comment.