Befor generating
This commit is contained in:
Generated
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import { FunctionComponent } from "../types";
|
||||
export interface FileProps {
|
||||
/**
|
||||
* `name` prop describes the filename for which should be used when generating the file. If none is specified the filename for the template are used.
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* `permissions` prop describes the permissions the file should be created with. This is interpreted as an octal number such as 0o777
|
||||
*/
|
||||
permissions?: number;
|
||||
}
|
||||
export declare const FilePropTypes: {
|
||||
/**
|
||||
* `name` prop describes the filename for which should be used when generating the file. If none is specified the filename for the template are used.
|
||||
*/
|
||||
name: PropTypes.Requireable<string>;
|
||||
/**
|
||||
* `permissions` prop describes the permissions the file should be created with. This is interpreted as an octal number such as 0o777
|
||||
*/
|
||||
permissions: PropTypes.Requireable<number>;
|
||||
};
|
||||
/**
|
||||
* Component is used to describe to the generator that you want a file to be created and rendered based on the defined children.
|
||||
*
|
||||
* @component
|
||||
* @example
|
||||
* const name = "test.js"
|
||||
* const permissions = 0o777
|
||||
* return (
|
||||
* <File name={name} permissions={permissions}>Test</File>
|
||||
* )
|
||||
*/
|
||||
declare const File: FunctionComponent<FileProps>;
|
||||
export default File;
|
||||
Generated
Vendored
+47
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FilePropTypes = void 0;
|
||||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
var prop_types_1 = __importDefault(require("prop-types"));
|
||||
exports.FilePropTypes = {
|
||||
/**
|
||||
* `name` prop describes the filename for which should be used when generating the file. If none is specified the filename for the template are used.
|
||||
*/
|
||||
name: prop_types_1.default.string,
|
||||
/**
|
||||
* `permissions` prop describes the permissions the file should be created with. This is interpreted as an octal number such as 0o777
|
||||
*/
|
||||
permissions: prop_types_1.default.number,
|
||||
};
|
||||
/**
|
||||
* Component is used to describe to the generator that you want a file to be created and rendered based on the defined children.
|
||||
*
|
||||
* @component
|
||||
* @example
|
||||
* const name = "test.js"
|
||||
* const permissions = 0o777
|
||||
* return (
|
||||
* <File name={name} permissions={permissions}>Test</File>
|
||||
* )
|
||||
*/
|
||||
var File = function (_a) {
|
||||
var children = _a.children;
|
||||
return jsx_runtime_1.jsx(jsx_runtime_1.Fragment, { children: children }, void 0);
|
||||
};
|
||||
File.propTypes = __assign({}, exports.FilePropTypes);
|
||||
exports.default = File;
|
||||
//# sourceMappingURL=File.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"File.js","sourceRoot":"","sources":["../../src/components/File.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,0DAAmC;AAetB,QAAA,aAAa,GAAG;IAC3B;;OAEG;IACH,IAAI,EAAE,oBAAS,CAAC,MAAM;IACtB;;OAEG;IACH,WAAW,EAAE,oBAAS,CAAC,MAAM;CAC9B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,IAAM,IAAI,GAAiC,UAAC,EAAY;QAAV,QAAQ,cAAA;IACpD,OAAO,sDAAG,QAAQ,WAAI,CAAC;AACzB,CAAC,CAAC;AAEF,IAAI,CAAC,SAAS,gBACT,qBAAa,CACjB,CAAC;AACF,kBAAe,IAAI,CAAC"}
|
||||
Generated
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import { IndentationTypes } from "../utils";
|
||||
import { FunctionComponent } from "../types";
|
||||
export interface IndentProps {
|
||||
/**
|
||||
* `size` prop expects a string which format should be a number which represent the number of `type`'s to indent each content. Default to no indentation.
|
||||
*/
|
||||
size?: number;
|
||||
/**
|
||||
* `type` prop expects a string, you can use the `IndentationTypes` enum, as either `TABS` or `SPACES`. The `type` defaults to `SPACES`.
|
||||
*/
|
||||
type?: IndentationTypes;
|
||||
}
|
||||
export declare const IndentPropTypes: {
|
||||
/**
|
||||
* `size` prop expects a string which format should be a number which represent the number of `type`'s to indent each content. Default to no indentation.
|
||||
*/
|
||||
size: PropTypes.Requireable<number>;
|
||||
/**
|
||||
* `type` prop expects a string, you can use the `IndentationTypes` enum, as either `TABS` or `SPACES`. The `type` defaults to `SPACES`.
|
||||
*/
|
||||
type: PropTypes.Requireable<IndentationTypes>;
|
||||
};
|
||||
/**
|
||||
* Component is for wrapping multiple components and apply an indentation on those.
|
||||
*
|
||||
* It supports any form of nested components as well, meaning you can have as many nested `Indent` components as you would like.
|
||||
*
|
||||
* @component
|
||||
* @example
|
||||
* const size = 4
|
||||
* const type = IndentationTypes.SPACES
|
||||
* return (
|
||||
* <Indent size={size} type={type}>test</Indent>
|
||||
* )
|
||||
*/
|
||||
declare const Indent: FunctionComponent<IndentProps>;
|
||||
export default Indent;
|
||||
Generated
Vendored
+50
@@ -0,0 +1,50 @@
|
||||
"use strict";
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.IndentPropTypes = void 0;
|
||||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
var prop_types_1 = __importDefault(require("prop-types"));
|
||||
var utils_1 = require("../utils");
|
||||
exports.IndentPropTypes = {
|
||||
/**
|
||||
* `size` prop expects a string which format should be a number which represent the number of `type`'s to indent each content. Default to no indentation.
|
||||
*/
|
||||
size: prop_types_1.default.number,
|
||||
/**
|
||||
* `type` prop expects a string, you can use the `IndentationTypes` enum, as either `TABS` or `SPACES`. The `type` defaults to `SPACES`.
|
||||
*/
|
||||
type: prop_types_1.default.oneOf(Object.values(utils_1.IndentationTypes)),
|
||||
};
|
||||
/**
|
||||
* Component is for wrapping multiple components and apply an indentation on those.
|
||||
*
|
||||
* It supports any form of nested components as well, meaning you can have as many nested `Indent` components as you would like.
|
||||
*
|
||||
* @component
|
||||
* @example
|
||||
* const size = 4
|
||||
* const type = IndentationTypes.SPACES
|
||||
* return (
|
||||
* <Indent size={size} type={type}>test</Indent>
|
||||
* )
|
||||
*/
|
||||
var Indent = function (_a) {
|
||||
var _b = _a.size, size = _b === void 0 ? 0 : _b, _c = _a.type, type = _c === void 0 ? utils_1.IndentationTypes.SPACES : _c, childrenContent = _a.childrenContent;
|
||||
return jsx_runtime_1.jsx(jsx_runtime_1.Fragment, { children: utils_1.withIndendation(childrenContent, size, type) }, void 0);
|
||||
};
|
||||
Indent.propTypes = __assign({}, exports.IndentPropTypes);
|
||||
exports.default = Indent;
|
||||
//# sourceMappingURL=Indent.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Indent.js","sourceRoot":"","sources":["../../src/components/Indent.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,0DAAmC;AAEnC,kCAA6D;AAchD,QAAA,eAAe,GAAG;IAC7B;;OAEG;IACH,IAAI,EAAE,oBAAS,CAAC,MAAM;IACtB;;OAEG;IACH,IAAI,EAAE,oBAAS,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,wBAAgB,CAAC,CAAC;CACvD,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,IAAM,MAAM,GAAmC,UAAC,EAA6D;QAA3D,YAAQ,EAAR,IAAI,mBAAG,CAAC,KAAA,EAAE,YAA8B,EAA9B,IAAI,mBAAG,wBAAgB,CAAC,MAAM,KAAA,EAAE,eAAe,qBAAA;IACzG,OAAO,sDAAG,uBAAe,CAAC,eAAe,EAAE,IAAI,EAAE,IAAI,CAAC,WAAI,CAAC;AAC7D,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,gBACX,uBAAe,CACnB,CAAC;AACF,kBAAe,MAAM,CAAC"}
|
||||
Generated
Vendored
+45
@@ -0,0 +1,45 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import { IndentationTypes } from "../utils";
|
||||
import { FunctionComponent } from "../types";
|
||||
export interface TextProps {
|
||||
/**
|
||||
* `indent` prop represents the number of `type`'s to indent each content. Default to no indentation.
|
||||
*/
|
||||
indent?: number;
|
||||
/**
|
||||
* `type` prop expects a string, you can use the `IndentationTypes` enum, as either `TABS` or `SPACES`. The `type` defaults to `SPACES`.
|
||||
*/
|
||||
type?: IndentationTypes;
|
||||
/**
|
||||
* `newLines` prop represents the number of appended new lines. Default to one new line.
|
||||
*/
|
||||
newLines?: number;
|
||||
}
|
||||
export declare const TextPropTypes: {
|
||||
/**
|
||||
* `size` prop expects a string which format should be a number which represent the number of `type`'s to indent each content. Default to no indentation.
|
||||
*/
|
||||
size: PropTypes.Requireable<number>;
|
||||
/**
|
||||
* `type` prop expects a string, you can use the `IndentationTypes` enum, as either `TABS` or `SPACES`. The `type` defaults to `SPACES`.
|
||||
*/
|
||||
type: PropTypes.Requireable<IndentationTypes>;
|
||||
/**
|
||||
* `newLines` prop represents the number of appended new lines. Default to one new line.
|
||||
*/
|
||||
newLines: PropTypes.Requireable<number>;
|
||||
};
|
||||
/**
|
||||
* Component is for defining a group of text which should be rendered on the same line.
|
||||
*
|
||||
* @component
|
||||
* @example
|
||||
* const indent = 4
|
||||
* const type = IndentationTypes.SPACES
|
||||
* const newLines = 2
|
||||
* return (
|
||||
* <Text indent={size} type={type} newLines={newLines}>Test</Text>
|
||||
* )
|
||||
*/
|
||||
declare const Text: FunctionComponent<TextProps>;
|
||||
export default Text;
|
||||
Generated
Vendored
+54
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TextPropTypes = void 0;
|
||||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
var prop_types_1 = __importDefault(require("prop-types"));
|
||||
var utils_1 = require("../utils");
|
||||
exports.TextPropTypes = {
|
||||
/**
|
||||
* `size` prop expects a string which format should be a number which represent the number of `type`'s to indent each content. Default to no indentation.
|
||||
*/
|
||||
size: prop_types_1.default.number,
|
||||
/**
|
||||
* `type` prop expects a string, you can use the `IndentationTypes` enum, as either `TABS` or `SPACES`. The `type` defaults to `SPACES`.
|
||||
*/
|
||||
type: prop_types_1.default.oneOf(Object.values(utils_1.IndentationTypes)),
|
||||
/**
|
||||
* `newLines` prop represents the number of appended new lines. Default to one new line.
|
||||
*/
|
||||
newLines: prop_types_1.default.number,
|
||||
};
|
||||
/**
|
||||
* Component is for defining a group of text which should be rendered on the same line.
|
||||
*
|
||||
* @component
|
||||
* @example
|
||||
* const indent = 4
|
||||
* const type = IndentationTypes.SPACES
|
||||
* const newLines = 2
|
||||
* return (
|
||||
* <Text indent={size} type={type} newLines={newLines}>Test</Text>
|
||||
* )
|
||||
*/
|
||||
var Text = function (_a) {
|
||||
var _b = _a.indent, indent = _b === void 0 ? 0 : _b, _c = _a.type, type = _c === void 0 ? utils_1.IndentationTypes.SPACES : _c, _d = _a.newLines, newLines = _d === void 0 ? 1 : _d, childrenContent = _a.childrenContent;
|
||||
var contentWithLines = utils_1.withNewLines(childrenContent, newLines);
|
||||
return jsx_runtime_1.jsx(jsx_runtime_1.Fragment, { children: utils_1.withIndendation(contentWithLines, indent, type) }, void 0);
|
||||
};
|
||||
Text.propTypes = __assign({}, exports.TextPropTypes);
|
||||
exports.default = Text;
|
||||
//# sourceMappingURL=Text.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../../src/components/Text.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,0DAAmC;AAEnC,kCAA2E;AAkB9D,QAAA,aAAa,GAAG;IAC3B;;OAEG;IACH,IAAI,EAAE,oBAAS,CAAC,MAAM;IACtB;;OAEG;IACH,IAAI,EAAE,oBAAS,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,wBAAgB,CAAC,CAAC;IACtD;;OAEG;IACH,QAAQ,EAAE,oBAAS,CAAC,MAAM;CAC3B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,IAAM,IAAI,GAAiC,UAAC,EAA6E;QAA3E,cAAU,EAAV,MAAM,mBAAG,CAAC,KAAA,EAAE,YAA8B,EAA9B,IAAI,mBAAG,wBAAgB,CAAC,MAAM,KAAA,EAAE,gBAAY,EAAZ,QAAQ,mBAAG,CAAC,KAAA,EAAE,eAAe,qBAAA;IACrH,IAAM,gBAAgB,GAAG,oBAAY,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;IACjE,OAAO,sDAAG,uBAAe,CAAC,gBAAgB,EAAE,MAAM,EAAE,IAAI,CAAC,WAAI,CAAC;AAChE,CAAC,CAAC;AAEF,IAAI,CAAC,SAAS,gBACT,qBAAa,CACjB,CAAC;AACF,kBAAe,IAAI,CAAC"}
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
Generated
Vendored
+50
@@ -0,0 +1,50 @@
|
||||
"use strict";
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
var utils_1 = require("../../utils");
|
||||
var __1 = require("../../");
|
||||
describe('<File />', function () {
|
||||
test('Should always render as is with default ptops', function () {
|
||||
var defaultProps = {};
|
||||
var wrapper = __1.render(jsx_runtime_1.jsx(__1.File, __assign({}, defaultProps, { children: "Test" }), void 0));
|
||||
expect(wrapper).toEqual('Test');
|
||||
});
|
||||
test('Should alwyas render as is with props', function () {
|
||||
var defaultProps = {
|
||||
fileName: 'test.ts',
|
||||
permissions: 511
|
||||
};
|
||||
var wrapper = __1.render(jsx_runtime_1.jsx(__1.File, __assign({}, defaultProps, { children: "Test" }), void 0));
|
||||
expect(wrapper).toEqual('Test');
|
||||
});
|
||||
test('Should always be able to render Indent', function () {
|
||||
var defaultProps = {};
|
||||
var indentProps = {
|
||||
size: 4,
|
||||
type: utils_1.IndentationTypes.SPACES
|
||||
};
|
||||
var wrapper = __1.render(jsx_runtime_1.jsx(__1.File, __assign({}, defaultProps, { children: jsx_runtime_1.jsx(__1.Indent, __assign({}, indentProps, { children: "Test" }), void 0) }), void 0));
|
||||
expect(wrapper).toEqual(' Test');
|
||||
});
|
||||
test('Should always be able to render Text', function () {
|
||||
var defaultProps = {};
|
||||
var textProps = {
|
||||
indent: 4,
|
||||
type: utils_1.IndentationTypes.SPACES
|
||||
};
|
||||
var wrapper = __1.render(jsx_runtime_1.jsx(__1.File, __assign({}, defaultProps, { children: jsx_runtime_1.jsx(__1.Text, __assign({}, textProps, { children: "Test" }), void 0) }), void 0));
|
||||
expect(wrapper).toEqual(' Test\n');
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=File.spec.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"File.spec.js","sourceRoot":"","sources":["../../../src/components/__tests__/File.spec.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,qCAA+C;AAC/C,4BAAoD;AAEpD,QAAQ,CAAC,UAAU,EAAE;IACnB,IAAI,CAAC,+CAA+C,EAAE;QACpD,IAAM,YAAY,GAAG,EAAE,CAAC;QACxB,IAAM,OAAO,GAAG,UAAM,CAAC,kBAAC,QAAI,eAAK,YAAY,gCAAa,CAAC,CAAC;QAC5D,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,uCAAuC,EAAE;QAC5C,IAAM,YAAY,GAAG;YACnB,QAAQ,EAAE,SAAS;YACnB,WAAW,EAAE,GAAK;SACnB,CAAC;QACF,IAAM,OAAO,GAAG,UAAM,CAAC,kBAAC,QAAI,eAAK,YAAY,gCAAa,CAAC,CAAC;QAC5D,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,wCAAwC,EAAE;QAC7C,IAAM,YAAY,GAAG,EAAE,CAAC;QACxB,IAAM,WAAW,GAAG;YAClB,IAAI,EAAE,CAAC;YACP,IAAI,EAAE,wBAAgB,CAAC,MAAM;SAC9B,CAAC;QACF,IAAM,OAAO,GAAG,UAAM,CAAC,kBAAC,QAAI,eAAK,YAAY,cAAE,kBAAC,UAAM,eAAK,WAAW,gCAAe,YAAO,CAAC,CAAC;QAC9F,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,sCAAsC,EAAE;QAC3C,IAAM,YAAY,GAAG,EAAE,CAAC;QACxB,IAAM,SAAS,GAAG;YAChB,MAAM,EAAE,CAAC;YACT,IAAI,EAAE,wBAAgB,CAAC,MAAM;SAC9B,CAAC;QACF,IAAM,OAAO,GAAG,UAAM,CAAC,kBAAC,QAAI,eAAK,YAAY,cAAE,kBAAC,QAAI,eAAK,SAAS,gCAAa,YAAO,CAAC,CAAC;QACxF,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
Generated
Vendored
+60
@@ -0,0 +1,60 @@
|
||||
"use strict";
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
var utils_1 = require("../../utils");
|
||||
var __1 = require("../..");
|
||||
describe('<Indent />', function () {
|
||||
test('Should always render as is with default props', function () {
|
||||
var defaultProps = {};
|
||||
var wrapper = __1.render(jsx_runtime_1.jsx(__1.Indent, __assign({}, defaultProps, { children: "Test" }), void 0));
|
||||
expect(wrapper).toEqual('Test');
|
||||
});
|
||||
test('Should always render indentation with spaces', function () {
|
||||
var defaultProps = {
|
||||
size: 4,
|
||||
type: utils_1.IndentationTypes.SPACES
|
||||
};
|
||||
var wrapper = __1.render(jsx_runtime_1.jsx(__1.Indent, __assign({}, defaultProps, { children: "Test" }), void 0));
|
||||
expect(wrapper).toEqual(' Test');
|
||||
});
|
||||
test('Should always render indentation with tabs', function () {
|
||||
var defaultProps = {
|
||||
size: 2,
|
||||
type: utils_1.IndentationTypes.TABS
|
||||
};
|
||||
var wrapper = __1.render(jsx_runtime_1.jsx(__1.Indent, __assign({}, defaultProps, { children: "Test" }), void 0));
|
||||
expect(wrapper).toEqual(' Test');
|
||||
});
|
||||
test('Should be able to make nest indentation', function () {
|
||||
var defaultProps = {
|
||||
size: 4,
|
||||
type: utils_1.IndentationTypes.SPACES
|
||||
};
|
||||
var wrapper = __1.render(jsx_runtime_1.jsx(__1.Indent, __assign({}, defaultProps, { children: jsx_runtime_1.jsx(__1.Indent, __assign({}, defaultProps, { size: 2 }, { children: "Test" }), void 0) }), void 0));
|
||||
expect(wrapper).toEqual(' Test');
|
||||
});
|
||||
test('Should be able contain text component', function () {
|
||||
var defaultProps = {
|
||||
size: 4,
|
||||
type: utils_1.IndentationTypes.SPACES
|
||||
};
|
||||
var defaultTextProps = {
|
||||
indent: 4,
|
||||
type: utils_1.IndentationTypes.SPACES
|
||||
};
|
||||
var wrapper = __1.render(jsx_runtime_1.jsx(__1.Indent, __assign({}, defaultProps, { children: jsx_runtime_1.jsx(__1.Text, __assign({}, defaultTextProps, { children: "Test" }), void 0) }), void 0));
|
||||
expect(wrapper).toEqual(' Test\n');
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=Indent.spec.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Indent.spec.js","sourceRoot":"","sources":["../../../src/components/__tests__/Indent.spec.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,qCAA+C;AAC/C,2BAA6C;AAE7C,QAAQ,CAAC,YAAY,EAAE;IACrB,IAAI,CAAC,+CAA+C,EAAE;QACpD,IAAM,YAAY,GAAG,EAAE,CAAC;QACxB,IAAM,OAAO,GAAG,UAAM,CAAC,kBAAC,UAAM,eAAK,YAAY,gCAAe,CAAC,CAAC;QAChE,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,8CAA8C,EAAE;QACnD,IAAM,YAAY,GAAG;YACnB,IAAI,EAAE,CAAC;YACP,IAAI,EAAE,wBAAgB,CAAC,MAAM;SAC9B,CAAC;QACF,IAAM,OAAO,GAAG,UAAM,CAAC,kBAAC,UAAM,eAAK,YAAY,gCAAe,CAAC,CAAC;QAChE,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,4CAA4C,EAAE;QACjD,IAAM,YAAY,GAAG;YACnB,IAAI,EAAE,CAAC;YACP,IAAI,EAAE,wBAAgB,CAAC,IAAI;SAC5B,CAAC;QACF,IAAM,OAAO,GAAG,UAAM,CAAC,kBAAC,UAAM,eAAK,YAAY,gCAAe,CAAC,CAAC;QAChE,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,yCAAyC,EAAE;QAC9C,IAAM,YAAY,GAAG;YACnB,IAAI,EAAE,CAAC;YACP,IAAI,EAAE,wBAAgB,CAAC,MAAM;SAC9B,CAAC;QACF,IAAM,OAAO,GAAG,UAAM,CAAC,kBAAC,UAAM,eAAK,YAAY,cAAE,kBAAC,UAAM,eAAK,YAAY,IAAE,IAAI,EAAE,CAAC,kCAAe,YAAS,CAAC,CAAC;QAC5G,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,uCAAuC,EAAE;QAC5C,IAAM,YAAY,GAAG;YACnB,IAAI,EAAE,CAAC;YACP,IAAI,EAAE,wBAAgB,CAAC,MAAM;SAC9B,CAAC;QACF,IAAM,gBAAgB,GAAG;YACvB,MAAM,EAAE,CAAC;YACT,IAAI,EAAE,wBAAgB,CAAC,MAAM;SAC9B,CAAC;QACF,IAAM,OAAO,GAAG,UAAM,CAAC,kBAAC,UAAM,eAAK,YAAY,cAAE,kBAAC,QAAI,eAAK,gBAAgB,gCAAa,YAAS,CAAC,CAAC;QACnG,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
Generated
Vendored
+45
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
var utils_1 = require("../../utils");
|
||||
var __1 = require("../..");
|
||||
describe('<Text />', function () {
|
||||
test('Should always render as is text with default props', function () {
|
||||
var defaultProps = {};
|
||||
var wrapper = __1.render(jsx_runtime_1.jsx(__1.Text, __assign({}, defaultProps, { children: "Test" }), void 0));
|
||||
expect(wrapper).toEqual('Test\n');
|
||||
});
|
||||
test('Should always render indentation with spaces', function () {
|
||||
var defaultProps = {
|
||||
indent: 4,
|
||||
type: utils_1.IndentationTypes.SPACES
|
||||
};
|
||||
var wrapper = __1.render(jsx_runtime_1.jsx(__1.Text, __assign({}, defaultProps, { children: "Test" }), void 0));
|
||||
expect(wrapper).toEqual(' Test\n');
|
||||
});
|
||||
test('Should always render indentation with tabs', function () {
|
||||
var defaultProps = {
|
||||
indent: 2,
|
||||
type: utils_1.IndentationTypes.TABS
|
||||
};
|
||||
var wrapper = __1.render(jsx_runtime_1.jsx(__1.Text, __assign({}, defaultProps, { children: "Test" }), void 0));
|
||||
expect(wrapper).toEqual(' Test\n');
|
||||
});
|
||||
test('Should be able to render nest texts', function () {
|
||||
var defaultProps = {};
|
||||
var wrapper = __1.render(jsx_runtime_1.jsx(__1.Text, __assign({}, defaultProps, { children: jsx_runtime_1.jsx(__1.Text, __assign({}, defaultProps, { children: "Test" }), void 0) }), void 0));
|
||||
expect(wrapper).toEqual('Test\n\n');
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=Text.spec.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Text.spec.js","sourceRoot":"","sources":["../../../src/components/__tests__/Text.spec.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,qCAA+C;AAC/C,2BAAqC;AAErC,QAAQ,CAAC,UAAU,EAAE;IACnB,IAAI,CAAC,oDAAoD,EAAE;QACzD,IAAM,YAAY,GAAG,EAAE,CAAC;QACxB,IAAM,OAAO,GAAG,UAAM,CAAC,kBAAC,QAAI,eAAK,YAAY,gCAAa,CAAC,CAAC;QAC5D,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,8CAA8C,EAAE;QACnD,IAAM,YAAY,GAAG;YACnB,MAAM,EAAE,CAAC;YACT,IAAI,EAAE,wBAAgB,CAAC,MAAM;SAC9B,CAAC;QACF,IAAM,OAAO,GAAG,UAAM,CAAC,kBAAC,QAAI,eAAK,YAAY,gCAAa,CAAC,CAAC;QAC5D,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,4CAA4C,EAAE;QACjD,IAAM,YAAY,GAAG;YACnB,MAAM,EAAE,CAAC;YACT,IAAI,EAAE,wBAAgB,CAAC,IAAI;SAC5B,CAAC;QACF,IAAM,OAAO,GAAG,UAAM,CAAC,kBAAC,QAAI,eAAK,YAAY,gCAAa,CAAC,CAAC;QAC5D,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,qCAAqC,EAAE;QAC1C,IAAM,YAAY,GAAG,EAAE,CAAC;QACxB,IAAM,OAAO,GAAG,UAAM,CAAC,kBAAC,QAAI,eAAK,YAAY,cAAE,kBAAC,QAAI,eAAK,YAAY,gCAAa,YAAO,CAAC,CAAC;QAC3F,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
||||
Generated
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
export { default as File } from "./File";
|
||||
export type { FileProps } from "./File";
|
||||
export { default as Text } from "./Text";
|
||||
export type { TextProps } from "./Text";
|
||||
export { default as Indent } from "./Indent";
|
||||
export type { IndentProps } from "./Indent";
|
||||
Generated
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Indent = exports.Text = exports.File = void 0;
|
||||
var File_1 = require("./File");
|
||||
Object.defineProperty(exports, "File", { enumerable: true, get: function () { return __importDefault(File_1).default; } });
|
||||
var Text_1 = require("./Text");
|
||||
Object.defineProperty(exports, "Text", { enumerable: true, get: function () { return __importDefault(Text_1).default; } });
|
||||
var Indent_1 = require("./Indent");
|
||||
Object.defineProperty(exports, "Indent", { enumerable: true, get: function () { return __importDefault(Indent_1).default; } });
|
||||
//# sourceMappingURL=index.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":";;;;;;AAAA,+BAAyC;AAAhC,6GAAA,OAAO,OAAQ;AAGxB,+BAAyC;AAAhC,6GAAA,OAAO,OAAQ;AAGxB,mCAA6C;AAApC,iHAAA,OAAO,OAAU"}
|
||||
Reference in New Issue
Block a user