<commit_before>var assert = chai.assert;


describe('react-frozenhead', function () {
    it('passes a test', function () {
        assert(true);
    });
});<commit_msg>Test that titles are updated as expected<commit_after>var assert = chai.assert,
    html = React.DOM.html,
    title = React.DOM.title,
    FrozenHead = ReactFrozenHead;

var page = function (pageTitle) {
    return (
        html(null,
            FrozenHead(null,
                title(null, pageTitle)
            )
        )
    );
};

var App = React.createClass({
    getDefaultProps: function () {
        return {title: 'HOME'};
    },
    render: function () {
        return page(this.props.title);
    }
});

describe('react-frozenhead', function () {
    it('renders the initial title', function () {
        var app = App({title: 'INITIAL'}),
            html = React.renderComponentToString(app);
        assert.include(html, '<title>INITIAL</title>');
    });

    it("doesn't update the DOM title after mounting", function (done) {
        var container = document.createElement('div');
            app = React.renderComponent(App({title: 'INITIAL'}), container);
        app.setProps({title: 'NEW'}, function () {
            var titleEl = container.querySelector('title');
            assert.equal(titleEl.text, 'INITIAL');
            done();
        });
    });
});
{'fraction_non_alphanumeric': 0.1499261447562777, 'fraction_numerical': 0.0, 'mean_word_length': 2.4478371501272265, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3255539', 'n_tokens_mistral': 396, 'n_tokens_neox': 388, 'n_words': 86}