aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/selectmenu/selectmenu_options.js
blob: 9fd053673570cd688a1c7ab5b6f2433d900109ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
(function ($) {

    module("selectmenu: options", {
        setup: function () {
            this.element = $("#speed");
            this.element.selectmenu();
        }
    });

    test("appendTo another element", function () {
        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", function () {
        expect(2);

        var button = $("#speed-button"),
            widget = this.element.selectmenu("widget"),
            buttonPos = {
                l: button.offset().top,
                t: button.offset().left
            },
            menuPos = {
                l: widget.offset().top,
                t: widget.offset().left
            };

        equals(menuPos.t, buttonPos.t, "menu positioned below button in dropdown mode"); //button has no height

        ok(this.element.selectmenu("option", "dropdown", false), "accepts false");
    });

})(jQuery);