<commit_before>describe("iD.behavior.Hash", function () {
    mocha.globals('__onhashchange.hash');

    var hash, context;

    beforeEach(function () {
        context = iD();

        // Neuter connection
        context.connection().loadTiles = function () {};

        hash = iD.behavior.Hash(context);

        d3.select(document.createElement('div'))
            .call(context.map());
    });

    afterEach(function () {
        hash.off();
    });

    it("sets hadHash if location.hash is present", function () {
        location.hash = "map=20.00/38.87952/-77.02405";

        hash();

        expect(hash.hadHash).to.be.true;
    });

    it("centerZooms map to requested level", function () {
        location.hash = "map=20.00/38.87952/-77.02405";

        hash();

        expect(context.map().center()[0]).to.be.closeTo(-77.02405, 0.1);
        expect(context.map().center()[1]).to.be.closeTo(38.87952, 0.1);
        expect(context.map().zoom()).to.equal(20.0);
    });

    it("centerZooms map at requested coordinates on hash change", function (done) {
        hash();

        d3.select(window).one('hashchange', function () {
            expect(context.map().center()[0]).to.be.closeTo(-77.02405, 0.1);
            expect(context.map().center()[1]).to.be.closeTo(38.87952, 0.1);
            expect(context.map().zoom()).to.equal(20.0);
            done();
        });

        location.hash = "#map=20.00/38.87952/-77.02405";
    });

    it("stores the current zoom and coordinates in location.hash on map move events", function () {
        location.hash = "";
<commit_msg>fix hash test<commit_after>describe("iD.behavior.Hash", function () {
    mocha.globals('__onhashchange.hash');

    var hash, context;

    beforeEach(function () {
        context = iD();

        // Neuter connection
        context.connection().loadTiles = function () {};

        hash = iD.behavior.Hash(context);

        d3.select(document.createElement('div'))
            .call(context.map());
    });

    afterEach(function () {
        hash.off();
    });

    it("sets hadHash if location.hash is present", function () {
        location.hash = "map=20.00/38.87952/-77.02405";

        hash();

        expect(hash.hadHash).to.be.true;
    });

    it("centerZooms map to requested level", function () {
        location.hash = "map=20.00/38.87952/-77.02405";

        hash();

        expect(context.map().center()[0]).to.be.closeTo(-77.02405, 0.1);
        expect(context.map().center()[1]).to.be.closeTo(38.87952, 0.1);
        expect(context.map().zoom()).to.equal(20.0);
    });

    it("centerZooms map at requested coordinates on hash change", function (done) {
        hash();

        d3.select(window).on('hashchange', function () {
            expect(context.map().center()[0]).to.be.closeTo(-77.02405, 0.1);
            expect(context.map().center()[1]).to.be.closeTo(38.87952, 0.1);
            expect(context.map().zoom()).to.equal(20.0);
            d3.select(window).on('hashchange', null);
            done();
        });

        location.hash = "#map=20.00/38.87952/-77.02405";
    });

    it("stores the current zoom and coordinates in location.hash on map move events", function () {
        location.hash = "";

{'fraction_non_alphanumeric': 0.18563058896083873, 'fraction_numerical': 0.06321307431390688, 'mean_word_length': 2.340885684860968, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '487776', 'n_tokens_mistral': 1153, 'n_tokens_neox': 1004, 'n_words': 162}