Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

removed duplicates from options unit tests and added new options and …

…events tests
  • Loading branch information...
commit 716bf407d2ab0696f5cf0bab50ad656c5b5fcc64 1 parent f381749
@danwellman authored
View
4 tests/unit/selectmenu/selectmenu_events.js
@@ -7,7 +7,7 @@
});
test("change", function () {
@fnagel
fnagel added a note

I think we (also) should compare the ui hash values with previously saved ones.

init selectmenu
get and save value
click different item -> ui object value should not change (event should fire)
click same item -> ui object value should not change (event should not fire)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
- expect(4);
+ expect(5);
this.element.selectmenu({
change: function (event, ui) {
@@ -22,6 +22,8 @@
menu = widget.filter(".ui-selectmenu-menu");
menu.find(".ui-menu-item").eq(0).simulate("click");
+
+ equals(this.element.selectmenu("option", "value"), "Slower", "should be set to first option");
});
test("close", function () {
View
12 tests/unit/selectmenu/selectmenu_options.js
@@ -8,9 +8,10 @@
});
test("appendTo another element", function () {
- expect(1);
+ expect(2);
ok(this.element.selectmenu("option", "appendTo", "#qunit-fixture"), "appendTo accepts selector");
+ ok($("#qunit-fixture").find(".ui-selectmenu-menu").length, "selectmenu appendedTo other element");
});
test("dropdown false", function () {
@@ -19,15 +20,12 @@
ok(this.element.selectmenu("option", "dropdown", false), "accepts false");
@fnagel
fnagel added a note

What about testing of the CSS styles apply correctly when using dropdown mode?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
});
- test("value in sync with selected item", function () {
+ test("value option", function () {
expect(1);
- var widget = this.element.selectmenu("widget"),
- menu = widget.filter(".ui-selectmenu-menu");
-
- menu.find(".ui-menu-item").eq(0).simulate("click");
+ this.element.selectmenu("option", "value", "jQuery UI");
- equals(this.element.selectmenu("option", "value"), "Slower", "should be set to first option");
+ equals(this.element.selectmenu("option", "value"), "jQuery UI", "should be set to 'jQuery UI'");
@fnagel
fnagel added a note

Can we make the compared value ("jQuery UI") more dynamic, so we wont have problems when the markup changes? I tried to get my values off the native select, so the tests are more generic and not specific for the current markup structure.

@danwellman Owner

ok sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
});
})(jQuery);
@fnagel

I think we (also) should compare the ui hash values with previously saved ones.

init selectmenu
get and save value
click different item -> ui object value should not change (event should fire)
click same item -> ui object value should not change (event should not fire)

@fnagel

Can we make the compared value ("jQuery UI") more dynamic, so we wont have problems when the markup changes? I tried to get my values off the native select, so the tests are more generic and not specific for the current markup structure.

@fnagel

What about testing of the CSS styles apply correctly when using dropdown mode?

Please sign in to comment.
Something went wrong with that request. Please try again.