// react-addons-shallow-compare and react-addons-test-utils are required for enzyme
// jshint esversion: 6
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import ReactWrapper from 'enzyme/build/ReactWrapper';
import ShallowWrapper from 'enzyme/build/ShallowWrapper';
import ReactDOMServer from 'react-dom/server';
import cheerio from 'cheerio';
configure({ adapter: new Adapter() });
var TEST_ID_DELIMITER = '.';
var TEST_ID_ATTRIBUTE = 'data-test-automation-id';
var ReactWrapperWMU = /** @class */ (function (_super) {
    __extends(ReactWrapperWMU, _super);
    function ReactWrapperWMU() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ReactWrapperWMU.prototype.findByTestAutomation = function (path) {
        var _a;
        var w = this;
        path = path.split(TEST_ID_DELIMITER);
        while (path.length && w) {
            w = w.find((_a = {},
                _a[TEST_ID_ATTRIBUTE] = path.shift(),
                _a));
        }
        return w;
    };
    return ReactWrapperWMU;
}(ReactWrapper));
export function render(node) {
    var html = ReactDOMServer.renderToStaticMarkup(node);
    return cheerio.load(html).root();
}
export function shallow(node, options) {
    return new ShallowWrapper(node, null, options);
}
export function mount(node, options) {
    var ReactWrapperWMUTS = ReactWrapperWMU;
    return new ReactWrapperWMUTS(node, null, options);
}
//# sourceMappingURL=enzyme.js.map