widget.html revision 37c410fc73ed5acc3161813869a31de525b5aa2e
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
5aab19b8b78189ce79cf89283f2d505566d4e6a8Dav Glass #console .yui3-console-entry {
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass padding:2px;
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass min-height:0;
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass #console .yui3-console-entry-fail .yui3-console-entry-cat {
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass background-color:red;
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass #console .yui3-console-entry-pass .yui3-console-entry-cat {
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass background-color:green;
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass #console .yui3-console-entry-perf .yui3-console-entry-cat {
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass background-color:blue;
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass position:static;
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass html, body {
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass height:100%;
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav GlassYUI({useBrowserConsole:false}).use('test', 'widget', 'node-event-simulate', 'console', function (Y) {
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass var suite = new Y.Test.Suite("Widget Tests");
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass name : "getSkinName",
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass "getSkinName should return null if not rendered" : function () {
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass var w = new Y.Widget();
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass "getSkinName should return name from BB if available": function () {
d0199bcbfc68b65683c19c4e3e0c38e238142e7eDav Glass var bb = Y.Node.create( '<div class="yui3-skin-foo"><div></div></div>' ),
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass cb = bb.one( 'div' ),
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass boundingBox: bb,
var w = new Y.Widget().render(),
body = Y.one( 'body' );
body.removeClass( "yui3-skin-sam" );
body.addClass( "yui3-skin-sam" );
var w = new Y.Widget().render( '#testbed' ),
body = Y.one( 'body' );
body.addClass( "yui3-skin-sam" );
var w = new Y.Widget({id:"foo"}).render();
w.destroy();
var w = new Y.Widget();
w.destroy();
MyWidget.superclass.constructor.apply(this, arguments);
MyWidget.NAME = "myWidget";
w.destroy();
w = new Y.Widget();
cb = w.get("contentBox");
w.on("click", h);
w.render();
cb.one(".et").simulate("click");
Y.ArrayAssert.itemsAreEqual(expectedEvents, actualEvents);
w.destroy();
w = new Y.Widget();
cb = w.get("contentBox");
w.on({
w.on("widget:mouseup", h);
w.on("foo|widget:mouseup", h);
w.on("mouseup", h);
w.after("widget:mouseup", h);
w.after("foo|widget:mouseup", h);
w.after("mouseup", h);
w.after({
w.render();
cb.one(".et").simulate("mousedown");
cb.one(".et").simulate("mouseup");
cb.one(".et").simulate("click");
Y.ArrayAssert.itemsAreEqual(expectedEvents, actualEvents);
w.destroy();
var outer = new Y.Widget();
var inner = new Y.Widget();
var ocb = outer.get('contentBox');
var icb = inner.get('contentBox');
outer.render();
inner.render(ocb);
ocb.one(".oet").simulate("click");
ocb.one(".iet").simulate("click");
Y.ArrayAssert.itemsAreEqual(expectedEvents, actualEvents);
w1 = new Y.Widget({render:true});
w1.on('click', function (e) {
actualEvents.push("clickOuter");
w2 = new Y1.Widget({render:".w2-container"});
w2.on('click', function (e) {
actualEvents.push("clickInner");
Y.Node.one(".miouter").simulate("click"); // only outer, once.
Y.Node.one(".miinner").simulate("click"); // inner, bubbled to outer (once each, without JS errors)
Y.ArrayAssert.itemsAreEqual(expectedEvents, actualEvents);
w1.destroy();
w2.destroy();
var a = new Y.Widget();
var b = new Y.Widget();
var c = new Y.Widget();
var a1 = Y.clone(a);
var a2 = Y.clone(a1);
var a3 = Y.clone(a2);
var b1 = Y.clone(b);
var b2 = Y.clone(b1);
var b3 = Y.clone(b2);
var c1 = Y.clone(c);
var c2 = Y.clone(c1);
var c3 = Y.clone(c2);
var a = new Y.Widget();
var b = new Y.Widget();
var c = new Y.Widget();
var o1 = Y.clone(o);
var o2 = Y.clone(o1);
var o3 = Y.clone(o2);
var a = new Y.Base();
var b = new Y.Base();
var c = new Y.Base();
var a1 = Y.clone(a);
var a2 = Y.clone(a1);
var a3 = Y.clone(a2);
var b1 = Y.clone(b);
var b2 = Y.clone(b1);
var b3 = Y.clone(b2);
var c1 = Y.clone(c);
var c2 = Y.clone(c1);
var c3 = Y.clone(c2);
var a = new Y.Base();
var b = new Y.Base();
var c = new Y.Base();
var o1 = Y.clone(o);
var o2 = Y.clone(o1);
var o3 = Y.clone(o2);
Y.Test.Runner.setName("Widget Tests");
Y.Test.Runner.add(suite);
Y.one("#btnRun").set("disabled", false).on("click", function() {
console = new Y.Console({