<commit_before>import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import ReactPDF from '../src/react-pdf';

import './test.less';

import samplePDF from './test.pdf';

let componentRenderCount = 0;

class WrappedReactPDF extends ReactPDF {
    componentDidMount() {
        super.componentDidMount();
    }

    componentWillReceiveProps(nextProps) {
        super.componentWillReceiveProps(nextProps);
    }

    componentWillUpdate() {
        componentRenderCount += 1;
    }
}

WrappedReactPDF.propTypes = ReactPDF.propTypes;

class Test extends Component {
    state = {
        file: null,
        pageIndex: null,
        pageNumber: null,
        passObj: false,
        pageRenderCount: 0,
        pageWidth: 300,
        total: null,
    }

    onFileChange = (event) => {
        this.setState({
            file: event.target.files[0],
        });
    }

    onFileUintChange = (event) => {
        const reader = new FileReader();

        reader.onloadend = () => {
            this.setState({
                file: reader.result,
            });
        };

        reader.readAsArrayBuffer(event.target.files[0]);
    }

    onURLChange = (event) => {
        event.preventDefault();

        this.setState({
            file: event.target.querySelector('input').value,
        });
    }

    onRequestChange = (event) => {
        event.preventDefault();

        const url = event.target.querySelector('input').value;

        fetch(url).then(response => response.blob()).then((blob) => {
            this.setState({
                file: blob,
            });
        });
    }

    onUseImported = () => {
        this.setState({
            file: samplePDF,
        });
    }

    onPassObjChange = (event) => {
        this.setState({ passObj: event.target.checked });
    }

    onPageWidthChange = (event) => {
        const width = event.target.value;

        this.setState({
            pageWidth: parseInt(width, 10),
        });
    }

    onDocumentLoad = ({ total }) => {
        this.setState({ total });
    }

    onDocumentError = ({ message }) => {
        // eslint-disable-next-line no-console
        console.error(message);
    }

    onPageLoad = ({ pageIndex, pageNumber }) => {
        this.setState({ pageIndex, pageNumber });
    }

    onPageRender = () => {
        this.setState({ pageRenderCount: (this.state.pageRenderCount + 1) });
    }<commit_msg>Improve test suite input handling<commit_after>import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import ReactPDF from '../src/react-pdf';

import './test.less';

import samplePDF from './test.pdf';

let componentRenderCount = 0;

class WrappedReactPDF extends ReactPDF {
    componentDidMount() {
        super.componentDidMount();
    }

    componentWillReceiveProps(nextProps) {
        super.componentWillReceiveProps(nextProps);
    }

    componentWillUpdate() {
        componentRenderCount += 1;
    }
}

WrappedReactPDF.propTypes = ReactPDF.propTypes;

class Test extends Component {
    state = {
        file: null,
        pageIndex: null,
        pageNumber: null,
        passObj: false,
        pageRenderCount: 0,
        pageWidth: 300,
        total: null,
    }

    onFileChange = (event) => {
        this.setState({
            file: event.target.files[0],
        });
    }

    onFileUintChange = (event) => {
        const reader = new FileReader();

        reader.onloadend = () => {
            this.setState({
                file: reader.result,
            });
        };

        reader.readAsArrayBuffer(event.target.files[0]);
    }

    onURLChange = (event) => {
        event.preventDefault();

        const url = event.target.querySelector('input').value;

        if (!url) {
            return;
        }

        this.setState({
            file: url,
        });
    }

    onRequestChange = (event) => {
        event.preventDefault();

        const url = event.target.querySelector('input').value;

        if (!url) {
            return;
        }

        fetch(url).then(response => response.blob()).then((blob) => {
            this.setState({
                file: blob,
            });
        });
    }

    onUseImported = () => {
        this.setState({
            file: samplePDF,
        });
    }

    onPassObjChange = (event) => {
        this.setState({ passObj: event.target.checked });
    }

    onPageWidthChange = (event) => {
        const width = event.target.value;

        if (!width) {
            return;
        }

        this.setState({
            pageWidth: parseInt(width, 10),
        });
    }

    onDocumentLoad = ({ total }) => {
        this.setState({ total });
    }

    onDocumentError = ({ message }) => {
        // eslint-disable-next-line no-console
        console.error(message);
    }

    onPageLoad = ({ pageIndex, pageNumber }) => {
        this.setState({ pageIndex, pageNumber });
    }

    onPageRender = () => {
        this.setState({ pageRenderCount: (this.state.pageRenderCount + 1) });
    }
{'fraction_non_alphanumeric': 0.1366066125519699, 'fraction_numerical': 0.004355573153830924, 'mean_word_length': 1.8737201365187712, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 31, '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': '5585819', 'n_tokens_mistral': 1468, 'n_tokens_neox': 1431, 'n_words': 266}