<commit_before>/*global describe, it, expect, React, ReactIntlMixin*/
describe('React Intl mixin', function () {

    it('Formats numbers correctly', function () {
        var FormattedNumberComponent = React.createClass({
            displayName: 'FormattedNumber',

            mixins: [ReactIntlMixin],

            render: function () {
                return React.DOM.div(null, this.formatNumber(1000));
            }
        });

        var FormattedNumber = React.createFactory(FormattedNumberComponent);
        var testNode = document.getElementById('test1');

        React.render(FormattedNumber({
            locales: ['es-AR']
        }), testNode);

        expect(testNode.firstChild.innerHTML).to.equal('1.000');
    });

    it('Formats dates correctly', function () {
        var FormattedDateComponent = React.createClass({
            displayName: 'FormattedDate',

            mixins: [ReactIntlMixin],

            render: function () {
                return React.DOM.div(null, this.formatDate(this.props.date, {
                    weekday: 'long',
                    timeZone: 'UTC'
                }));
            }
        });

        var FormattedDate = React.createFactory(FormattedDateComponent);
        var testNode = document.getElementById('test2');

        React.render(FormattedDate({
            locales: ['es-AR'],
            date: Date.UTC(2014, 8, 22, 0, 0, 0, 0)
        }), testNode);

        expect(testNode.firstChild.innerHTML).to.contain('lunes');

        React.renderComponent(FormattedDate({
            locales: ['en-US'],
            date: 0
        }), testNode);

        expect(testNode.firstChild.innerHTML).to.contain('Thursday');
    });

    it('Formats messages correctly', function () {
        var FormattedMessageComponent = React.createClass({
            displayName: 'FormattedMessage',

            mixins: [ReactIntlMixin],

            getMyMessage: function () {
                return 'You have {numPhotos, plural, =0 {no photos} =1 {one photo} other {# photos}}.';
            },

            render: function () {
                return React.DOM.div(null, this.formatMessage(this.getMyMessage(), {
                    numPhotos: this.props.numPhotos
                }));
            }
        });

        var FormattedMessage = React.createFactory(FormattedMessageComponent);
        var testNode = document.getElementById('test3');<commit_msg>Remove use of deprecated React APIs in smoke tests<commit_after>/*global describe, it, expect, React, ReactIntlMixin*/
describe('React Intl mixin', function () {

    it('Formats numbers correctly', function () {
        var FormattedNumberComponent = React.createClass({
            displayName: 'FormattedNumber',

            mixins: [ReactIntlMixin],

            render: function () {
                return React.DOM.div(null, this.formatNumber(1000));
            }
        });

        var FormattedNumber = React.createFactory(FormattedNumberComponent);
        var testNode = document.getElementById('test1');

        React.render(FormattedNumber({
            locales: ['es-AR']
        }), testNode);

        expect(testNode.firstChild.innerHTML).to.equal('1.000');
    });

    it('Formats dates correctly', function () {
        var FormattedDateComponent = React.createClass({
            displayName: 'FormattedDate',

            mixins: [ReactIntlMixin],

            render: function () {
                return React.DOM.div(null, this.formatDate(this.props.date, {
                    weekday: 'long',
                    timeZone: 'UTC'
                }));
            }
        });

        var FormattedDate = React.createFactory(FormattedDateComponent);
        var testNode = document.getElementById('test2');

        React.render(FormattedDate({
            locales: ['es-AR'],
            date: Date.UTC(2014, 8, 22, 0, 0, 0, 0)
        }), testNode);

        expect(testNode.firstChild.innerHTML).to.contain('lunes');

        React.render(FormattedDate({
            locales: ['en-US'],
            date: 0
        }), testNode);

        expect(testNode.firstChild.innerHTML).to.contain('Thursday');
    });

    it('Formats messages correctly', function () {
        var FormattedMessageComponent = React.createClass({
            displayName: 'FormattedMessage',

            mixins: [ReactIntlMixin],

            getMyMessage: function () {
                return 'You have {numPhotos, plural, =0 {no photos} =1 {one photo} other {# photos}}.';
            },

            render: function () {
                return React.DOM.div(null, this.formatMessage(this.getMyMessage(), {
                    numPhotos: this.props.numPhotos
                }));
            }
        });

        var FormattedMessage = React.createFactory(FormattedMessageComponent);
        var testNode = document.getElementById('test3');
{'fraction_non_alphanumeric': 0.12453912331011881, 'fraction_numerical': 0.010241704219582138, 'mean_word_length': 2.0348042262274704, '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': '3059166', 'n_tokens_mistral': 1342, 'n_tokens_neox': 1257, 'n_words': 251}