describe("depends-pattern", function() {
    var pattern;

    requireDependencies(["patterns/depends"], function(cls) {
        pattern = cls;
    });

    // Reset the lab before each test
    beforeEach(function() {
        $("#lab *").remove();
    });

    describe("init", function() {
        it("Hide if condition is not met initially", function() {
            $("#lab").html([
                '<input type="checkbox" id="control" value="yes"/>',
                '<div id="slave" class="pat-depends"/>'
                ].join("\n"));
            var $slave = $("#slave");
            pattern.init($slave, {condition: "control"});
            expect($slave.css("display")).toBe("none");
        });

        it("Show if condition is not met initially", function() {
            $("#lab").html([
                '<input type="checkbox" id="control" value="yes" checked="checked"/>',
                '<div id="slave" class="pat-depends" style="display: none"/>'
                ].join("\n"));
            var $slave = $("#slave");
            pattern.init($slave, {condition: "control"});
            expect($slave.css("display")).not.toBe("none");
        });
    });

    describe("_disable", function() {
        it("Input element", function() {
            $("#lab").append('<button type="button">Click me</button>');
            var $slave = $("#lab button");
            pattern._disable($slave);
            expect($slave[0].disabled).toBeTruthy();
            expect($slave.hasClass("disabled")).toBe(true);
        });

        it("Anchor", function() {
            $("#lab").append('<a href="#target">Click me</button>');
            var $slave = $("#lab a");
            pattern._disable($slave);
            var events = $._data($slave[0]).events;
            expect($slave.hasClass("disabled")).toBe(true);
            expect(events.click).toBeDefined();
            expect(events.click[0].namespace).toBe("patternDepends");
        });
    });

    describe("_enable", function() {
        it("Input element", function() {
            $("#lab").append('<button disabled="disabled" class="disabled" type="button">Click me</button>');
            var $slave = $("#lab button");
            pattern._enable($slave);
            expect($slave[0].disabled).toBeFalsy();
            expect($slave.hasClass("disabled")).toBe(false);
        });

        it("Anchor", function() {
            $("#lab").append('<a href="#target" class="disabled">Click me</button>');
            var $slave = $("#lab a");
            $slave.on("click.patternDepends", false);
            pattern._enable($slave);
            expect($slave.hasClass("disabled")).toBe(false);
            expect($._data($slave[0]).events).toBe(undefined);
        });
    });
});

// jshint indent: 4, browser: true, jquery: true, quotmark: double
// vim: sw=4 expandtab

@@ -1612,38 +1612,33 @@
 rget%22%3EClick me%3C/
-button
+a
 %3E');%0A           
@@ -2448,38 +2448,33 @@
 bled%22%3EClick me%3C/
-button
+a
 %3E');%0A           

Fix markup error in depends test