import React from "dist/React";
import ReactTestUtils from "lib/ReactTestUtils";
var ReactDOM = window.ReactDOM || React;

describe("ReactDOMInput", function() {
    this.timeout(200000);

    it("should properly control a value even if no event listener exists", () => {
        spyOnDev(console, "error");
        const container = document.createElement("div");
        const stub = ReactDOM.render(<input type="text" value="lion" />, container);
    
        document.body.appendChild(container);
    
        const node = ReactDOM.findDOMNode(stub);
        if (__DEV__) {
            expect(console.error.calls.count()).toBe(1);
        }
    
        setUntrackedValue.call(node, "giraffe");
    
        // This must use the native event dispatching. If we simulate, we will
        // bypass the lazy event attachment system so we won't actually test this.
        dispatchEventOnNode(node, "change");
    
        expect(node.value).toBe("lion");
    
        document.body.removeChild(container);
    });


});