oop.html revision ba2328a2983042c5fed38cfe42b67ec9ea3fb588
<html>
<head>
<title>YUI OOP Tests</title>
</head>
<body class="yui-skin-sam">
<h1>OOP Tests</h1>
<p><input type="button" value="Run Tests" id="btnRun" disabled="true" /></p>
<script type="text/javascript">
(function() {
YUI({
base: "/build/",
filter: "debug",
useConsole: true,
// logInclude: ['event', 'test']
//logExclude: ['Dom', 'Selector', 'Node', 'attribute']
logExclude: {Dom:true,
Selector:true, Node:true, attribute:true, event:true, base:true}
}).use("dump", "test", "console", "event-custom", function(Y) {
var button = Y.get('#btnRun');
// Set up the page
button.set("disabled", false);
Y.on("click", function() {
}, button);
var myConsole = new Y.Console().render();
var testOOP= new Y.Test.Case({
name: "OOP tests",
testExtend: function() {
var firedbase = false;
var firedextended = false;
var Base = function() {
Y.log('Base constructor executed');
arguments.callee.superclass.constructor.apply(this, arguments);
};
Y.extend(Base, Y.Event.Target, {
base: function() {
Y.log('base function');
firedbase = true;
}
});
var Extended = function() {
Y.log('Extended constructor executed');
arguments.callee.superclass.constructor.apply(this, arguments);
};
Y.extend(Extended, Base, {
base: function() {
Y.log('extended function');
firedextended = true;
}
});
var b = new Extended();
b.fire('testStringFn', 1, 2);
Y.Assert.isFalse(firedbase);
Y.Assert.isTrue(firedextended);
}
});
Y.Test.Runner.add(testOOP);
});
})();
</script>
</body>
</html>