text: /* eslint-env node, jasmine */
  /* eslint-disable no-undefined, class-methods-use-this */
  
  describe("cloneElement-prod", () => {
      "use strict";
  
      var vrdom;
  
      beforeAll((done) => {
          window.require.undef("vrdom");
  
          require(["vrdom"], function() {
              vrdom = arguments[0];
  
              done();
          });
      });
  
      afterAll(() => {
          vrdom.reset();
      });
  
      it("should clone DOM element", () => {
          var element = <div id="id" />;
  
          var container = document.createElement("div");
          var domNode = vrdom.render(vrdom.cloneElement(element), container);
  
          expect(domNode.id).toBe("id");
  
          var cloned = vrdom.cloneElement(element, {id: "new id", key: "key"});
          expect(vrdom.isValidElement(cloned)).toBe(true);
          expect(cloned.props).toEqual({id: "new id"});
          expect(cloned.key).toBe("key");
  
          vrdom.render(cloned, container);
          expect(domNode.id).toBe("new id");
      });
  
      it("should clone Composite Component element", () => {
          class Component extends vrdom.Component {
              render() {
                  return <div { ...this.props } />;
              }
          }
  
          var element = <Component id="id" />;
  
          var container = document.createElement("div");
          var cloned = vrdom.cloneElement(element);
          expect(vrdom.isValidElement(cloned)).toBe(true);
          var instance = vrdom.render(cloned, container);
          var domNode = vrdom.findDOMNode(instance);
  
          expect(domNode.id).toBe("id");
  
          vrdom.render(vrdom.cloneElement(element, {id: "new id"}), container);
          expect(domNode.id).toBe("new id");
      });
  
      it("should set ref and children", () => {
          class Child extends vrdom.Component {
              render() {
                  var cloned = vrdom.cloneElement(this.props.children, {ref: "div", children: "child"});
                  expect(vrdom.isValidElement(cloned)).toBe(true);
                  expect(cloned.ref).toBe("div");
                  expect(cloned.props.children).toBe("child");
                  return <div>{ cloned }</div>;
              }
          }
  
          class Parent extends vrdom.Component {
              render() {
                  return <Child ref="child"><div /></Child>;
              }
          }
  
          var container = document.createElement("div");
          var instance = vrdom.render(<Parent />, container);
          expect(instance.refs.child.refs.div).toBe(container.firstChild.firstChild);
          expect(instance.refs.child.refs.div.innerHTML).toBe("child");
  
      });
  
      it("should treat arguments after config as children", () => {
          spyOn(console, "error");
  
          class Component extends vrdom.Component {
              render() {
                  return <b/>;
              }
          }
  
          var children = [<div />, 2, <span />];
          var cloned = vrdom.cloneElement.apply(vrdom, [<Component />, null].concat(children));
          expect(vrdom.isValidElement(cloned)).toBe(true);
          expect(cloned.props.children).toEqual(children);
  
          // check warn for unique key prop
          expect(console.error.calls.count()).toBe(0);
      });
  
      it("should preserve ref owner", () => {
          class Child extends vrdom.Component {
              render() {
                  return <div>{ vrdom.cloneElement(this.props.children) }</div>;
              }
          }
  
          class Parent extends vrdom.Component {
              render() {
                  return <Child><div ref="div"></div></Child>;
              }
          }
  
          var container = document.createElement("div");
          var instance = vrdom.render(<Parent />, container);
          expect(instance.refs.div).toBe(container.firstChild.firstChild);
  
      });
  
      it("should change ref owner if ref is overrided", () => {
          class Child extends vrdom.Component {
              render() {
                  var cloned = vrdom.cloneElement(this.props.children, {ref: "div"});
                  expect(cloned.ref).toBe("div");
                  return <div>{ cloned }</div>;
              }
          }
  
          class Parent extends vrdom.Component {
              render() {
                  return <Child ref="child"><div ref="div"></div></Child>;
              }
          }
  
          var container = document.createElement("div");
          var instance = vrdom.render(<Parent />, container);
          expect(instance.refs.child.refs.div).toBe(container.firstChild.firstChild);
  
      });
  
  });