@lowdefy/block-dev 4.0.0-alpha.8 → 4.0.0-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
package/dist/mockBlock.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
14
14
  limitations under the License.
15
15
  */ import { makeCssClass } from '@lowdefy/block-utils';
16
16
  import stubBlockProps from './stubBlockProps.js';
17
- const mockBlock = ({ meta , logger , schema })=>{
17
+ const mockBlock = ({ meta , schema })=>{
18
18
  const mockMath = Object.create(global.Math);
19
19
  mockMath.random = ()=>0.5
20
20
  ;
@@ -87,7 +87,6 @@ const mockBlock = ({ meta , logger , schema })=>{
87
87
  return stubBlockProps({
88
88
  block,
89
89
  meta,
90
- logger,
91
90
  schema
92
91
  });
93
92
  };
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -31,10 +31,10 @@ function _extends() {
31
31
  };
32
32
  return _extends.apply(this, arguments);
33
33
  }
34
- const runMockMethodTests = ({ examples , logger , meta , mocks , schema , tests })=>{
34
+ const runMockMethodTests = ({ Block: Block1 , examples , mocks , schema , testConfig })=>{
35
+ const meta = Block1.meta;
35
36
  const { before , methods , getProps } = mockBlock({
36
37
  meta,
37
- logger,
38
38
  schema
39
39
  });
40
40
  beforeEach(()=>{
@@ -48,8 +48,8 @@ const runMockMethodTests = ({ examples , logger , meta , mocks , schema , tests
48
48
  ];
49
49
  examples.forEach((ex)=>{
50
50
  values.forEach((value, v)=>{
51
- if (tests && tests.methods) {
52
- tests.methods.forEach((method)=>{
51
+ if (testConfig && testConfig.methods) {
52
+ testConfig.methods.forEach((method)=>{
53
53
  mocks.forEach((mock)=>{
54
54
  test(`Mock for method: ${JSON.stringify(method)} - ${ex.id} - value[${v}] - ${mock.name}`, async ()=>{
55
55
  const mockFns = await mock.getMockFns();
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -16,40 +16,30 @@
16
16
  import { type } from '@lowdefy/helpers';
17
17
  import { makeCssClass, createIcon } from '@lowdefy/block-utils';
18
18
  import schemaTest from './schemaTest.js';
19
- function _extends() {
20
- _extends = Object.assign || function(target) {
21
- for(var i = 1; i < arguments.length; i++){
22
- var source = arguments[i];
23
- for(var key in source){
24
- if (Object.prototype.hasOwnProperty.call(source, key)) {
25
- target[key] = source[key];
26
- }
27
- }
28
- }
29
- return target;
30
- };
31
- return _extends.apply(this, arguments);
32
- }
33
19
  const validate = {};
34
20
  const Icons = {
35
- AiIcon: (props)=>/*#__PURE__*/ React.createElement("svg", _extends({}, props, {
36
- "data-testid": "AiIcon"
37
- }))
21
+ AiIcon: ({ onClick , ...props })=>/*#__PURE__*/ React.createElement("svg", {
22
+ "data-testid": "AiIcon",
23
+ onClick: onClick
24
+ }, "ICON PROPS: ", JSON.stringify(props))
38
25
  ,
39
- AiOutlineExclamationCircle: (props)=>/*#__PURE__*/ React.createElement("svg", _extends({}, props, {
40
- "data-testid": "AiOutlineExclamationCircle"
41
- }))
26
+ AiOutlineExclamationCircle: ({ onClick , ...props })=>/*#__PURE__*/ React.createElement("svg", {
27
+ "data-testid": "AiOutlineExclamationCircle",
28
+ onClick: onClick
29
+ }, "ICON PROPS: ", JSON.stringify(props))
42
30
  ,
43
- AiOutlineLoading3Quarters: (props)=>/*#__PURE__*/ React.createElement("svg", _extends({}, props, {
44
- "data-testid": "AiOutlineLoading3Quarters"
45
- }))
31
+ AiOutlineLoading3Quarters: ({ onClick , ...props })=>/*#__PURE__*/ React.createElement("svg", {
32
+ "data-testid": "AiOutlineLoading3Quarters",
33
+ onClick: onClick
34
+ }, "ICON PROPS: ", JSON.stringify(props))
46
35
  ,
47
36
  ErrorIcon: ()=>{
48
37
  throw new Error('ErrorIcon');
49
38
  }
50
39
  };
51
40
  const IconComponent = createIcon(Icons);
52
- const stubBlockProps = ({ block , meta , logger , initialValue , schema })=>{
41
+ const stubBlockProps = ({ block , meta , logger =()=>null
42
+ , initialValue , schema })=>{
53
43
  const [value, setState] = useState(type.enforceType(meta.valueType, block.value || initialValue));
54
44
  const setValue = (val)=>{
55
45
  setState(type.enforceType(meta.valueType, val));
@@ -77,9 +67,10 @@ const stubBlockProps = ({ block , meta , logger , initialValue , schema })=>{
77
67
  block.eventLog = [];
78
68
  block.components = {
79
69
  Icon: IconComponent,
80
- Link: (props)=>/*#__PURE__*/ React.createElement("a", _extends({
81
- "data-testid": `link-${props.href}`
82
- }, props), props.children)
70
+ Link: ({ id , children , onClick , ...props })=>/*#__PURE__*/ React.createElement("a", {
71
+ "data-testid": id,
72
+ onClick: onClick
73
+ }, "LINK PROPS:", JSON.stringify(props), " - CHILDREN: ", children('default_title'))
83
74
  };
84
75
  // mock default block methods
85
76
  block.methods = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/block-dev",
3
- "version": "4.0.0-alpha.8",
3
+ "version": "4.0.0-alpha.9",
4
4
  "licence": "Apache-2.0",
5
5
  "description": "Lowdefy Block Development Tools",
6
6
  "homepage": "https://lowdefy.com",
@@ -38,8 +38,8 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@emotion/jest": "11.7.1",
41
- "@lowdefy/block-utils": "4.0.0-alpha.8",
42
- "@lowdefy/helpers": "4.0.0-alpha.8",
41
+ "@lowdefy/block-utils": "4.0.0-alpha.9",
42
+ "@lowdefy/helpers": "4.0.0-alpha.9",
43
43
  "@testing-library/dom": "8.11.3",
44
44
  "@testing-library/react": "13.0.0-alpha.4",
45
45
  "@testing-library/user-event": "14.0.0-alpha.14",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "9d56b83cf45e868afe3a1eeba750fe826eb74c8c"
61
+ "gitHead": "98b544eca231bdcfca6c3a8601a891835d5ce571"
62
62
  }