"use strict";
// 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 __());
    };
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var enzyme_1 = require("enzyme");
var enzyme_adapter_react_16_1 = __importDefault(require("enzyme-adapter-react-16"));
var ReactWrapper_1 = __importDefault(require("enzyme/build/ReactWrapper"));
var ShallowWrapper_1 = __importDefault(require("enzyme/build/ShallowWrapper"));
var server_1 = __importDefault(require("react-dom/server"));
var cheerio_1 = __importDefault(require("cheerio"));
enzyme_1.configure({ adapter: new enzyme_adapter_react_16_1.default() });
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_1.default));
function render(node) {
    var html = server_1.default.renderToStaticMarkup(node);
    return cheerio_1.default.load(html).root();
}
exports.render = render;
function shallow(node, options) {
    return new ShallowWrapper_1.default(node, null, options);
}
exports.shallow = shallow;
function mount(node, options) {
    var ReactWrapperWMUTS = ReactWrapperWMU;
    return new ReactWrapperWMUTS(node, null, options);
}
exports.mount = mount;
//# sourceMappingURL=enzyme.js.map