"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); /** * @jest-environment node */ var React = require("react"); var server_1 = require("react-dom/server"); var customizable_1 = require("./customizable"); var Customizations_1 = require("./Customizations"); var Foo = /** @class */ (function (_super) { tslib_1.__extends(Foo, _super); function Foo() { return _super !== null && _super.apply(this, arguments) || this; } Foo.prototype.render = function () { return React.createElement("div", null, this.props.field); }; Foo = tslib_1.__decorate([ (0, customizable_1.customizable)('Foo', ['field']) ], Foo); return Foo; }(React.Component)); describe('customizable (server-side rendering)', function () { beforeEach(function () { Customizations_1.Customizations.reset(); }); it('can receive global customizations', function () { Customizations_1.Customizations.applySettings({ field: 'globalName' }); expect((0, server_1.renderToStaticMarkup)(React.createElement(Foo, null))).toEqual('
globalName
'); }); it('can receive scoped customizations', function () { Customizations_1.Customizations.applySettings({ field: 'globalName' }); Customizations_1.Customizations.applyScopedSettings('Foo', { field: 'scopedName' }); expect((0, server_1.renderToStaticMarkup)(React.createElement(Foo, null))).toEqual('
scopedName
'); }); it('can ignore scoped customizations that do not apply', function () { Customizations_1.Customizations.applySettings({ field: 'globalName' }); Customizations_1.Customizations.applyScopedSettings('Bar', { field: 'scopedName' }); expect((0, server_1.renderToStaticMarkup)(React.createElement(Foo, null))).toEqual('
globalName
'); }); it('can accept props over global/scoped values', function () { Customizations_1.Customizations.applySettings({ field: 'globalName' }); Customizations_1.Customizations.applyScopedSettings('Foo', { field: 'scopedName' }); expect((0, server_1.renderToStaticMarkup)(React.createElement(Foo, { field: "name" }))).toEqual('
name
'); }); }); //# sourceMappingURL=customizable.server.test.js.map