Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updates to events and options unit tests

  • Loading branch information...
commit f381749ed7d557c65970df24c9f2dab4fbc242ac 1 parent a4fd544
@danwellman danwellman authored
View
32 tests/unit/selectmenu/selectmenu_events.js
@@ -9,25 +9,19 @@
test("change", function () {
expect(4);
- var counter = 0;
-
this.element.selectmenu({
change: function (event, ui) {
- counter++;
-
- if (counter === 1) {
- ok(event, "change event fired on change");
- equals(event.type, "selectmenuchange", "event type set to selectmenuchange");
- ok(ui, "ui object is passed as second argument to event handler");
- equals(ui.item.element[0].nodeName, "OPTION", "ui points to original option element");
- }
+ ok(event, "change event fired on change");
+ equals(event.type, "selectmenuchange", "event type set to selectmenuchange");
+ ok(ui, "ui object is passed as second argument to event handler");
+ equals(ui.item.element[0].nodeName, "OPTION", "ui points to original option element");
}
});
var widget = this.element.selectmenu("widget"),
menu = widget.filter(".ui-selectmenu-menu");
- menu.find(".ui-menu-item").simulate("click");
+ menu.find(".ui-menu-item").eq(0).simulate("click");
});
test("close", function () {
@@ -85,25 +79,19 @@
test("select", function () {
expect(4);
- var counter = 0;
-
this.element.selectmenu({
select: function (event, ui) {
- counter++;
-
- if (counter === 1) {
- ok(event, "select event fired on item select");
- equals(event.type, "selectmenuselect", "event type set to selectmenuselect");
- ok(ui, "ui object is passed as second argument to event handler");
- equals(ui.item.element[0].nodeName, "OPTION", "ui points to original option element");
- }
+ ok(event, "select event fired on item select");
+ equals(event.type, "selectmenuselect", "event type set to selectmenuselect");
+ ok(ui, "ui object is passed as second argument to event handler");
+ equals(ui.item.element[0].nodeName, "OPTION", "ui points to original option element");
}
});
var widget = this.element.selectmenu("widget"),
menu = widget.filter(".ui-selectmenu-menu");
- menu.find(".ui-menu-item").simulate("click");
+ menu.find(".ui-menu-item").eq(0).simulate("click");
});
})(jQuery);
View
29 tests/unit/selectmenu/selectmenu_options.js
@@ -7,47 +7,18 @@
}
});
- test("{ appendTo: default }", function () {
- expect(1);
-
- equals(this.element.selectmenu("option", "appendTo"), "body", "should be appended to <body> by default");
- });
-
test("appendTo another element", function () {
expect(1);
ok(this.element.selectmenu("option", "appendTo", "#qunit-fixture"), "appendTo accepts selector");
});
- test("{ dropdown: default }", function () {
- expect(1);
-
- equals(this.element.selectmenu("option", "dropdown"), true, "should be true by default");
- });
-
test("dropdown false", function () {
expect(1);
ok(this.element.selectmenu("option", "dropdown", false), "accepts false");
});
- test("{ position: default }", function () {
- expect(4);
-
- var pos = this.element.selectmenu("option", "position");
-
- ok(typeof (pos) === "object", "position should be of type 'object'");
- equals(pos.my, "left top", "my should be 'left top' by default");
- equals(pos.at, "left bottom", "at should be 'left bottom' by default");
- equals(pos.collision, "none", "collision should be 'none' by default")
- });
-
- test("{ value: default }", function () {
- expect(1);
-
- equals(this.element.selectmenu("option", "value"), "Medium", "should reflect selected value of underlying select");
- });
-
test("value in sync with selected item", function () {
expect(1);
Please sign in to comment.
Something went wrong with that request. Please try again.