From 0299d431a266a93a5b06601b9df133716446af82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A1=E5=93=A5?= Date: Sat, 28 Jun 2025 13:30:42 +0800 Subject: [PATCH] lizhouze@huawei.com MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 卡哥 --- ace-loader/test/rich/expected/eventBubble.js | 104 ++++++++++++++++++ ace-loader/test/rich/expected/eventCapture.js | 48 ++++++++ .../test/rich/expected/renderConditional.js | 91 +++++++++++++++ ace-loader/test/rich/test.js | 9 ++ ace-loader/test/rich/testcase/manifest.json | 5 +- .../pages/eventBubble/eventBubble.hml | 14 +++ .../testcase/pages/eventBubble/eventBubble.js | 23 ++++ .../pages/eventCapture/eventCapture.hml | 6 + .../pages/eventCapture/eventCapture.js | 20 ++++ .../renderConditional/renderConditional.hml | 7 ++ .../renderConditional/renderConditional.js | 27 +++++ .../renderConditional/renderconfitional.css | 9 ++ 12 files changed, 362 insertions(+), 1 deletion(-) create mode 100644 ace-loader/test/rich/expected/eventBubble.js create mode 100644 ace-loader/test/rich/expected/eventCapture.js create mode 100644 ace-loader/test/rich/expected/renderConditional.js create mode 100644 ace-loader/test/rich/testcase/pages/eventBubble/eventBubble.hml create mode 100644 ace-loader/test/rich/testcase/pages/eventBubble/eventBubble.js create mode 100644 ace-loader/test/rich/testcase/pages/eventCapture/eventCapture.hml create mode 100644 ace-loader/test/rich/testcase/pages/eventCapture/eventCapture.js create mode 100644 ace-loader/test/rich/testcase/pages/renderConditional/renderConditional.hml create mode 100644 ace-loader/test/rich/testcase/pages/renderConditional/renderConditional.js create mode 100644 ace-loader/test/rich/testcase/pages/renderConditional/renderconfitional.css diff --git a/ace-loader/test/rich/expected/eventBubble.js b/ace-loader/test/rich/expected/eventBubble.js new file mode 100644 index 0000000..7e2bc79 --- /dev/null +++ b/ace-loader/test/rich/expected/eventBubble.js @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "@app-component/eventBubble": { + "_descriptor": {}, + "clickfunc": "function (e) {\n console.log(e);\n }", + "data": {}, + "template": { + "attr": { + "debugLine": "pages/eventBubble/eventBubble:2", + "value": ";" + }, + "children": [ + { + "attr": { + "debugLine": "pages/eventBubble/eventBubble:3" + }, + "type": "div", + "onBubbleEvents": { + "touchstart": "touchstartfunc" + } + }, + { + "attr": { + "debugLine": "pages/eventBubble/eventBubble:4" + }, + "type": "div", + "onBubbleEvents": { + "touchstart": "touchstartfunc" + } + }, + { + "attr": { + "debugLine": "pages/eventBubble/eventBubble:6" + }, + "type": "div", + "catchBubbleEvents": { + "touchstart": "touchstartfunc" + } + }, + { + "attr": { + "debugLine": "pages/eventBubble/eventBubble:7" + }, + "type": "div", + "catchBubbleEvents": { + "touchstart": "touchstartfunc" + } + }, + { + "attr": { + "debugLine": "pages/eventBubble/eventBubble:9" + }, + "type": "div", + "events": { + "click": "clickfunc" + } + }, + { + "attr": { + "debugLine": "pages/eventBubble/eventBubble:10" + }, + "type": "div", + "events": { + "click": "clickfunc" + } + }, + { + "attr": { + "debugLine": "pages/eventBubble/eventBubble:12" + }, + "type": "div", + "events": { + "click": "clickfunc" + } + }, + { + "attr": { + "debugLine": "pages/eventBubble/eventBubble:13" + }, + "type": "div", + "events": { + "click": "clickfunc" + } + } + ], + "type": "div" + }, + "touchstartfunc": "function (e) {\n console.log(e);\n }" + } +} \ No newline at end of file diff --git a/ace-loader/test/rich/expected/eventCapture.js b/ace-loader/test/rich/expected/eventCapture.js new file mode 100644 index 0000000..cd7cc20 --- /dev/null +++ b/ace-loader/test/rich/expected/eventCapture.js @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "@app-component/eventCapture": { + "_descriptor": {}, + "data": {}, + "template": { + "attr": { + "debugLine": "pages/eventCapture/eventCapture:1" + }, + "type": "div", + "children": [ + { + "attr": { + "debugLine": "pages/eventCapture/eventCapture:3" + }, + "type": "div", + "onCaptureEvents": { + "touchstart": "touchstartfunc" + } + }, + { + "attr": { + "debugLine": "pages/eventCapture/eventCapture:5" + }, + "type": "div", + "catchCaptureEvents": { + "touchstart": "touchstartfunc" + } + } + ] + }, + "touchstartfunc": "function (e) {\n console.log(e);\n }" + } +} \ No newline at end of file diff --git a/ace-loader/test/rich/expected/renderConditional.js b/ace-loader/test/rich/expected/renderConditional.js new file mode 100644 index 0000000..f91ab85 --- /dev/null +++ b/ace-loader/test/rich/expected/renderConditional.js @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +{ + "@app-component/renderConditional": { + "data": { + "display": true, + "visible": false + }, + "template": { + "attr": { + "debugLine": "pages/renderConditional/renderConditional:1", + "className": "container" + }, + "type": "div", + "classList": [ + "container" + ], + "children": [ + { + "attr": { + "debugLine": "pages/renderConditional/renderConditional:2", + "className": "btn", + "type": "capsule", + "value": "toggleShow" + }, + "type": "button", + "classList": [ + "btn" + ], + "events": { + "click": "toggleShow" + } + }, + { + "attr": { + "debugLine": "pages/renderConditional/renderConditional:3", + "className": "btn", + "type": "capsule", + "value": "toggleDisplay" + }, + "type": "button", + "classList": [ + "btn" + ], + "events": { + "click": "toggleDisplay" + } + }, + { + "attr": { + "debugLine": "pages/renderConditional/renderConditional:4", + "value": "Hello-world1" + }, + "type": "text", + "shown": "function () {return this.visible}" + }, + { + "attr": { + "debugLine": "pages/renderConditional/renderConditional:5", + "value": "Hello-world2" + }, + "type": "text", + "shown": "function () {return this.display&&!this.visible}" + }, + { + "attr": { + "debugLine": "pages/renderConditional/renderConditional:6", + "value": "Hello-World" + }, + "type": "text", + "shown": "function () {return !this.display&&!this.visible}" + } + ] + }, + "toggleDisplay": "function () {\n this.display = !this.display;\n }", + "toggleShow": "function () {\n this.visible = !this.visible;\n }" + } +} \ No newline at end of file diff --git a/ace-loader/test/rich/test.js b/ace-loader/test/rich/test.js index 87d0109..e21647b 100644 --- a/ace-loader/test/rich/test.js +++ b/ace-loader/test/rich/test.js @@ -120,4 +120,13 @@ describe('build', () => { it('mediaQuery', () => { expectActual('mediaQuery'); }); + it('eventBubble', () => { + expectActual('eventBubble'); + }); + it('eventCapture', () => { + expectActual('eventCapture'); + }); + it('renderConditional', () => { + expectActual('renderConditional'); + }); }); \ No newline at end of file diff --git a/ace-loader/test/rich/testcase/manifest.json b/ace-loader/test/rich/testcase/manifest.json index 47c51b6..d3c8e3f 100644 --- a/ace-loader/test/rich/testcase/manifest.json +++ b/ace-loader/test/rich/testcase/manifest.json @@ -17,6 +17,9 @@ "pages/inlineStyle/inlineStyle", "pages/exteriorStyle/exteriorStyle", "pages/importCSS/importCSS", - "pages/mediaQuery/mediaQuery" + "pages/mediaQuery/mediaQuery", + "pages/eventBubble/eventBubble", + "pages/eventCapture/eventCapture", + "pages/renderConditional/renderConditional" ] } \ No newline at end of file diff --git a/ace-loader/test/rich/testcase/pages/eventBubble/eventBubble.hml b/ace-loader/test/rich/testcase/pages/eventBubble/eventBubble.hml new file mode 100644 index 0000000..5220b38 --- /dev/null +++ b/ace-loader/test/rich/testcase/pages/eventBubble/eventBubble.hml @@ -0,0 +1,14 @@ +
+ ; +
+
+ +
+
+ +
+
+ +
+
+
\ No newline at end of file diff --git a/ace-loader/test/rich/testcase/pages/eventBubble/eventBubble.js b/ace-loader/test/rich/testcase/pages/eventBubble/eventBubble.js new file mode 100644 index 0000000..38d5855 --- /dev/null +++ b/ace-loader/test/rich/testcase/pages/eventBubble/eventBubble.js @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default { + clickfunc: function(e) { + console.log(e); + }, + touchstartfunc: function(e) { + console.log(e); + }, +} \ No newline at end of file diff --git a/ace-loader/test/rich/testcase/pages/eventCapture/eventCapture.hml b/ace-loader/test/rich/testcase/pages/eventCapture/eventCapture.hml new file mode 100644 index 0000000..75fb1fb --- /dev/null +++ b/ace-loader/test/rich/testcase/pages/eventCapture/eventCapture.hml @@ -0,0 +1,6 @@ +
+ +
+ +
+
\ No newline at end of file diff --git a/ace-loader/test/rich/testcase/pages/eventCapture/eventCapture.js b/ace-loader/test/rich/testcase/pages/eventCapture/eventCapture.js new file mode 100644 index 0000000..0d6a677 --- /dev/null +++ b/ace-loader/test/rich/testcase/pages/eventCapture/eventCapture.js @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default { + touchstartfunc: function(e) { + console.log(e); + }, +} \ No newline at end of file diff --git a/ace-loader/test/rich/testcase/pages/renderConditional/renderConditional.hml b/ace-loader/test/rich/testcase/pages/renderConditional/renderConditional.hml new file mode 100644 index 0000000..70e1876 --- /dev/null +++ b/ace-loader/test/rich/testcase/pages/renderConditional/renderConditional.hml @@ -0,0 +1,7 @@ +
+ + + Hello-world1 + Hello-world2 + Hello-World +
\ No newline at end of file diff --git a/ace-loader/test/rich/testcase/pages/renderConditional/renderConditional.js b/ace-loader/test/rich/testcase/pages/renderConditional/renderConditional.js new file mode 100644 index 0000000..8a29514 --- /dev/null +++ b/ace-loader/test/rich/testcase/pages/renderConditional/renderConditional.js @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default { + data: { + visible: false, + display: true, + }, + toggleShow: function() { + this.visible = !this.visible; + }, + toggleDisplay: function() { + this.display = !this.display; + } +} \ No newline at end of file diff --git a/ace-loader/test/rich/testcase/pages/renderConditional/renderconfitional.css b/ace-loader/test/rich/testcase/pages/renderConditional/renderconfitional.css new file mode 100644 index 0000000..d304e6e --- /dev/null +++ b/ace-loader/test/rich/testcase/pages/renderConditional/renderconfitional.css @@ -0,0 +1,9 @@ +.container{ + flex-direction: column; + align-items: center; +} +.btn{ + width: 280px; + font-size: 26px; + margin: 10px 0; +} \ No newline at end of file -- Gitee