widget.html revision d4a90de3308f343c5d935b5f9b6bcc9f5bc4d05f
1355N/A filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min'
1355N/A var suite = new Y.Test.Suite("Widget Tests");
1325N/A var bbFromDom = Y.Node.one("#widgetRender");
1325N/A Y.Assert.isTrue(bbFromDom.get("firstChild").compareTo(w.get("contentBox")), "contentBox not first child of boundingBox");
1325N/A Y.Assert.isTrue(bbFromDom.compareTo(Y.Node.one("body").get("firstChild")), "widget not inserted to body");
1186N/A var bbFromDom = Y.Node.one("#widgetRenderTo");
1281N/A Y.Assert.isTrue(bbFromDom.get("parentNode").compareTo(Y.Node.one("#widgetRenderToContainer")), "widget not rendered to container passed to render()");
1186N/A Y.Assert.isTrue(bbFromDom.get("firstChild").compareTo(w.get("contentBox")), "contentBox not first child of boundingBox");
1281N/A Y.Assert.isTrue(cb.hasClass("yui3-widget-content"), "cb missing yui3-widget-content marker");
1281N/A MyWidget.superclass.constructor.apply(this, arguments);
1281N/A MyWidget.NAME = "myWidget";
1186N/A var bb = myWidget.get("boundingBox");
1186N/A var cb = myWidget.get("contentBox");
1281N/A Y.Assert.isTrue(cb.hasClass("yui3-mywidget-content"), "cb missing yui3-mywidget-content marker");
1281N/A Y.Assert.isFalse(cb.hasClass("yui3-widget-content"), "cb shouldn't have yui3-widget-content marker");
1281N/A Y.Assert.isFalse(bb.hasClass("yui3-widget-disabled"), "bb should not have a disabled marker class");
1281N/A Y.Assert.isFalse(bb.hasClass("yui3-widget-disabled"), "bb should not have a disabled marker class");
1281N/A Y.Assert.isFalse(bb.hasClass("yui3-widget-disabled"), "bb should not have a disabled marker class");
1281N/A Y.Assert.isFalse(bb.hasClass("yui3-widget-disabled"), "bb should not have a disabled marker class");
1281N/A Y.Assert.isFalse(bb.hasClass("yui3-widget-focused"), "bb should not have a disabled marker class");
1186N/A Y.Assert.isFalse(bb.hasClass("yui3-widget-focused"), "bb should not have a focused marker class");
var w = new Y.Widget({render:true});
var bb = w.get("boundingBox");
Y.Assert.isTrue(bb.get("tabIndex") <= 0, "tabIndex should not be set by default"); // default varies across browsers 0 or -1
w.destroy();
w.destroy();
Y.Assert.areEqual("none", bb.getStyle("display"), "Default CSS should hide widget using display:none");
w.destroy();
Y.Assert.isTrue(w.get("boundingBox").get("parentNode").compareTo(container), "boundingBox moved from it's place in the DOM");
w.destroy();
Y.Assert.isTrue(w.get("boundingBox").get("parentNode").compareTo(container), "contentBox moved from it's place in the DOM");
w.destroy();
Y.Assert.isTrue(w.get("boundingBox").get("parentNode").compareTo(container), "bb moved from it's place in the DOM");
w.destroy();
Y.Assert.isTrue(w.get("boundingBox").get("parentNode").compareTo(container), "boundingBox moved from it's place in the DOM");
w.destroy();
Y.Assert.isTrue(w.get("boundingBox").get("parentNode").compareTo(container), "contentBox moved from it's place in the DOM");
w.destroy();
Y.Assert.isTrue(w.get("boundingBox").get("parentNode").compareTo(container), "bb moved from it's place in the DOM");
w.destroy();
Y.Assert.isTrue(w.get("srcNode").compareTo(sn), "srcNode should still be accessible from srcNode attribute");
Y.Assert.isTrue(w.get("boundingBox").get("parentNode").compareTo(container), "srcNode moved from it's place in the DOM");
o.render();
i.render();
Y.Assert.areSame(o, Y.Widget.getByNode(o.get("contentBox")), "Couldn't find outer widget from outer contentBox");
Y.Assert.areSame(o, Y.Widget.getByNode(o.get("boundingBox")), "Couldn't find outer widget from outer boundingBox");
Y.Assert.areSame(i, Y.Widget.getByNode(i.get("contentBox")), "Couldn't find inner widget from inner contentBox");
Y.Assert.areSame(i, Y.Widget.getByNode(i.get("boundingBox")), "Couldn't find inner widget from inner boundingBox");
w.render();
w.destroy();
w.destroy();
w.render();
w.destroy();
w.render();
w.render();
w.destroy();
w.on({
w.after({
w.render();
w.destroy();
outer.render();
w1.destroy();
w2.destroy();
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);
Y.Assert.isTrue(o3.a instanceof Y.Widget);
Y.Assert.isTrue(o3.b instanceof Y.Widget);
Y.Assert.isTrue(o3.c instanceof Y.Widget);
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);
Y.Assert.isTrue(a instanceof Y.Base);
Y.Assert.isTrue(a1 instanceof Y.Base);
Y.Assert.isTrue(a2 instanceof Y.Base);
Y.Assert.isTrue(a3 instanceof Y.Base);
var b1 = Y.clone(b);
var b2 = Y.clone(b1);
var b3 = Y.clone(b2);
Y.Assert.isTrue(b instanceof Y.Base);
Y.Assert.isTrue(b1 instanceof Y.Base);
Y.Assert.isTrue(b2 instanceof Y.Base);
Y.Assert.isTrue(b3 instanceof Y.Base);
var c1 = Y.clone(c);
var c2 = Y.clone(c1);
var c3 = Y.clone(c2);
Y.Assert.isTrue(c instanceof Y.Base);
Y.Assert.isTrue(c1 instanceof Y.Base);
Y.Assert.isTrue(c2 instanceof Y.Base);
Y.Assert.isTrue(c3 instanceof Y.Base);
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.Assert.isTrue(o3.a instanceof Y.Base);
Y.Assert.isTrue(o3.b instanceof Y.Base);
Y.Assert.isTrue(o3.c instanceof Y.Base);
Y.Test.Runner.setName("Widget Tests");
Y.Test.Runner.add(suite);
Y.one("#btnRun").set("disabled", false).on("click", function() {
console = new Y.Console({